Commit eee194e7 authored by Eric Sandeen's avatar Eric Sandeen Committed by Linus Torvalds

[PATCH] ext3: inode numbers are unsigned long

This is primarily format string fixes, with changes to ialloc.c where large
inode counts could overflow, and also pass around journal_inum as an
unsigned long, just to be pedantic about it....
Signed-off-by: default avatarEric Sandeen <esandeen@redhat.com>
Cc: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 41f04d85
...@@ -202,7 +202,7 @@ void ext3_free_inode (handle_t *handle, struct inode * inode) ...@@ -202,7 +202,7 @@ void ext3_free_inode (handle_t *handle, struct inode * inode)
static int find_group_dir(struct super_block *sb, struct inode *parent) static int find_group_dir(struct super_block *sb, struct inode *parent)
{ {
int ngroups = EXT3_SB(sb)->s_groups_count; int ngroups = EXT3_SB(sb)->s_groups_count;
int freei, avefreei; unsigned int freei, avefreei;
struct ext3_group_desc *desc, *best_desc = NULL; struct ext3_group_desc *desc, *best_desc = NULL;
struct buffer_head *bh; struct buffer_head *bh;
int group, best_group = -1; int group, best_group = -1;
...@@ -261,10 +261,10 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) ...@@ -261,10 +261,10 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
struct ext3_super_block *es = sbi->s_es; struct ext3_super_block *es = sbi->s_es;
int ngroups = sbi->s_groups_count; int ngroups = sbi->s_groups_count;
int inodes_per_group = EXT3_INODES_PER_GROUP(sb); int inodes_per_group = EXT3_INODES_PER_GROUP(sb);
int freei, avefreei; unsigned int freei, avefreei;
ext3_fsblk_t freeb, avefreeb; ext3_fsblk_t freeb, avefreeb;
ext3_fsblk_t blocks_per_dir; ext3_fsblk_t blocks_per_dir;
int ndirs; unsigned int ndirs;
int max_debt, max_dirs, min_inodes; int max_debt, max_dirs, min_inodes;
ext3_grpblk_t min_blocks; ext3_grpblk_t min_blocks;
int group = -1, i; int group = -1, i;
......
...@@ -2115,7 +2115,7 @@ static void ext3_free_branches(handle_t *handle, struct inode *inode, ...@@ -2115,7 +2115,7 @@ static void ext3_free_branches(handle_t *handle, struct inode *inode,
*/ */
if (!bh) { if (!bh) {
ext3_error(inode->i_sb, "ext3_free_branches", ext3_error(inode->i_sb, "ext3_free_branches",
"Read failure, inode=%ld, block="E3FSBLK, "Read failure, inode=%lu, block="E3FSBLK,
inode->i_ino, nr); inode->i_ino, nr);
continue; continue;
} }
......
...@@ -1919,8 +1919,8 @@ int ext3_orphan_add(handle_t *handle, struct inode *inode) ...@@ -1919,8 +1919,8 @@ int ext3_orphan_add(handle_t *handle, struct inode *inode)
if (!err) if (!err)
list_add(&EXT3_I(inode)->i_orphan, &EXT3_SB(sb)->s_orphan); list_add(&EXT3_I(inode)->i_orphan, &EXT3_SB(sb)->s_orphan);
jbd_debug(4, "superblock will point to %ld\n", inode->i_ino); jbd_debug(4, "superblock will point to %lu\n", inode->i_ino);
jbd_debug(4, "orphan inode %ld will point to %d\n", jbd_debug(4, "orphan inode %lu will point to %d\n",
inode->i_ino, NEXT_ORPHAN(inode)); inode->i_ino, NEXT_ORPHAN(inode));
out_unlock: out_unlock:
unlock_super(sb); unlock_super(sb);
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
static int ext3_load_journal(struct super_block *, struct ext3_super_block *, static int ext3_load_journal(struct super_block *, struct ext3_super_block *,
unsigned long journal_devnum); unsigned long journal_devnum);
static int ext3_create_journal(struct super_block *, struct ext3_super_block *, static int ext3_create_journal(struct super_block *, struct ext3_super_block *,
int); unsigned int);
static void ext3_commit_super (struct super_block * sb, static void ext3_commit_super (struct super_block * sb,
struct ext3_super_block * es, struct ext3_super_block * es,
int sync); int sync);
...@@ -376,7 +376,7 @@ static void dump_orphan_list(struct super_block *sb, struct ext3_sb_info *sbi) ...@@ -376,7 +376,7 @@ static void dump_orphan_list(struct super_block *sb, struct ext3_sb_info *sbi)
list_for_each(l, &sbi->s_orphan) { list_for_each(l, &sbi->s_orphan) {
struct inode *inode = orphan_list_entry(l); struct inode *inode = orphan_list_entry(l);
printk(KERN_ERR " " printk(KERN_ERR " "
"inode %s:%ld at %p: mode %o, nlink %d, next %d\n", "inode %s:%lu at %p: mode %o, nlink %d, next %d\n",
inode->i_sb->s_id, inode->i_ino, inode, inode->i_sb->s_id, inode->i_ino, inode,
inode->i_mode, inode->i_nlink, inode->i_mode, inode->i_nlink,
NEXT_ORPHAN(inode)); NEXT_ORPHAN(inode));
...@@ -753,7 +753,7 @@ static ext3_fsblk_t get_sb_block(void **data) ...@@ -753,7 +753,7 @@ static ext3_fsblk_t get_sb_block(void **data)
} }
static int parse_options (char *options, struct super_block *sb, static int parse_options (char *options, struct super_block *sb,
unsigned long *inum, unsigned long *journal_devnum, unsigned int *inum, unsigned long *journal_devnum,
ext3_fsblk_t *n_blocks_count, int is_remount) ext3_fsblk_t *n_blocks_count, int is_remount)
{ {
struct ext3_sb_info *sbi = EXT3_SB(sb); struct ext3_sb_info *sbi = EXT3_SB(sb);
...@@ -1306,17 +1306,17 @@ static void ext3_orphan_cleanup (struct super_block * sb, ...@@ -1306,17 +1306,17 @@ static void ext3_orphan_cleanup (struct super_block * sb,
DQUOT_INIT(inode); DQUOT_INIT(inode);
if (inode->i_nlink) { if (inode->i_nlink) {
printk(KERN_DEBUG printk(KERN_DEBUG
"%s: truncating inode %ld to %Ld bytes\n", "%s: truncating inode %lu to %Ld bytes\n",
__FUNCTION__, inode->i_ino, inode->i_size); __FUNCTION__, inode->i_ino, inode->i_size);
jbd_debug(2, "truncating inode %ld to %Ld bytes\n", jbd_debug(2, "truncating inode %lu to %Ld bytes\n",
inode->i_ino, inode->i_size); inode->i_ino, inode->i_size);
ext3_truncate(inode); ext3_truncate(inode);
nr_truncates++; nr_truncates++;
} else { } else {
printk(KERN_DEBUG printk(KERN_DEBUG
"%s: deleting unreferenced inode %ld\n", "%s: deleting unreferenced inode %lu\n",
__FUNCTION__, inode->i_ino); __FUNCTION__, inode->i_ino);
jbd_debug(2, "deleting unreferenced inode %ld\n", jbd_debug(2, "deleting unreferenced inode %lu\n",
inode->i_ino); inode->i_ino);
nr_orphans++; nr_orphans++;
} }
...@@ -1395,7 +1395,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) ...@@ -1395,7 +1395,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
ext3_fsblk_t sb_block = get_sb_block(&data); ext3_fsblk_t sb_block = get_sb_block(&data);
ext3_fsblk_t logic_sb_block; ext3_fsblk_t logic_sb_block;
unsigned long offset = 0; unsigned long offset = 0;
unsigned long journal_inum = 0; unsigned int journal_inum = 0;
unsigned long journal_devnum = 0; unsigned long journal_devnum = 0;
unsigned long def_mount_opts; unsigned long def_mount_opts;
struct inode *root; struct inode *root;
...@@ -1844,7 +1844,8 @@ static void ext3_init_journal_params(struct super_block *sb, journal_t *journal) ...@@ -1844,7 +1844,8 @@ static void ext3_init_journal_params(struct super_block *sb, journal_t *journal)
spin_unlock(&journal->j_state_lock); spin_unlock(&journal->j_state_lock);
} }
static journal_t *ext3_get_journal(struct super_block *sb, int journal_inum) static journal_t *ext3_get_journal(struct super_block *sb,
unsigned int journal_inum)
{ {
struct inode *journal_inode; struct inode *journal_inode;
journal_t *journal; journal_t *journal;
...@@ -1979,7 +1980,7 @@ static int ext3_load_journal(struct super_block *sb, ...@@ -1979,7 +1980,7 @@ static int ext3_load_journal(struct super_block *sb,
unsigned long journal_devnum) unsigned long journal_devnum)
{ {
journal_t *journal; journal_t *journal;
int journal_inum = le32_to_cpu(es->s_journal_inum); unsigned int journal_inum = le32_to_cpu(es->s_journal_inum);
dev_t journal_dev; dev_t journal_dev;
int err = 0; int err = 0;
int really_read_only; int really_read_only;
...@@ -2065,7 +2066,7 @@ static int ext3_load_journal(struct super_block *sb, ...@@ -2065,7 +2066,7 @@ static int ext3_load_journal(struct super_block *sb,
static int ext3_create_journal(struct super_block * sb, static int ext3_create_journal(struct super_block * sb,
struct ext3_super_block * es, struct ext3_super_block * es,
int journal_inum) unsigned int journal_inum)
{ {
journal_t *journal; journal_t *journal;
...@@ -2078,7 +2079,7 @@ static int ext3_create_journal(struct super_block * sb, ...@@ -2078,7 +2079,7 @@ static int ext3_create_journal(struct super_block * sb,
if (!(journal = ext3_get_journal(sb, journal_inum))) if (!(journal = ext3_get_journal(sb, journal_inum)))
return -EINVAL; return -EINVAL;
printk(KERN_INFO "EXT3-fs: creating new journal on inode %d\n", printk(KERN_INFO "EXT3-fs: creating new journal on inode %u\n",
journal_inum); journal_inum);
if (journal_create(journal)) { if (journal_create(journal)) {
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
#ifdef EXT3_XATTR_DEBUG #ifdef EXT3_XATTR_DEBUG
# define ea_idebug(inode, f...) do { \ # define ea_idebug(inode, f...) do { \
printk(KERN_DEBUG "inode %s:%ld: ", \ printk(KERN_DEBUG "inode %s:%lu: ", \
inode->i_sb->s_id, inode->i_ino); \ inode->i_sb->s_id, inode->i_ino); \
printk(f); \ printk(f); \
printk("\n"); \ printk("\n"); \
...@@ -233,7 +233,7 @@ ext3_xattr_block_get(struct inode *inode, int name_index, const char *name, ...@@ -233,7 +233,7 @@ ext3_xattr_block_get(struct inode *inode, int name_index, const char *name,
atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount));
if (ext3_xattr_check_block(bh)) { if (ext3_xattr_check_block(bh)) {
bad_block: ext3_error(inode->i_sb, __FUNCTION__, bad_block: ext3_error(inode->i_sb, __FUNCTION__,
"inode %ld: bad block "E3FSBLK, inode->i_ino, "inode %lu: bad block "E3FSBLK, inode->i_ino,
EXT3_I(inode)->i_file_acl); EXT3_I(inode)->i_file_acl);
error = -EIO; error = -EIO;
goto cleanup; goto cleanup;
...@@ -375,7 +375,7 @@ ext3_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size) ...@@ -375,7 +375,7 @@ ext3_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size)
atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount));
if (ext3_xattr_check_block(bh)) { if (ext3_xattr_check_block(bh)) {
ext3_error(inode->i_sb, __FUNCTION__, ext3_error(inode->i_sb, __FUNCTION__,
"inode %ld: bad block "E3FSBLK, inode->i_ino, "inode %lu: bad block "E3FSBLK, inode->i_ino,
EXT3_I(inode)->i_file_acl); EXT3_I(inode)->i_file_acl);
error = -EIO; error = -EIO;
goto cleanup; goto cleanup;
...@@ -647,7 +647,7 @@ ext3_xattr_block_find(struct inode *inode, struct ext3_xattr_info *i, ...@@ -647,7 +647,7 @@ ext3_xattr_block_find(struct inode *inode, struct ext3_xattr_info *i,
le32_to_cpu(BHDR(bs->bh)->h_refcount)); le32_to_cpu(BHDR(bs->bh)->h_refcount));
if (ext3_xattr_check_block(bs->bh)) { if (ext3_xattr_check_block(bs->bh)) {
ext3_error(sb, __FUNCTION__, ext3_error(sb, __FUNCTION__,
"inode %ld: bad block "E3FSBLK, inode->i_ino, "inode %lu: bad block "E3FSBLK, inode->i_ino,
EXT3_I(inode)->i_file_acl); EXT3_I(inode)->i_file_acl);
error = -EIO; error = -EIO;
goto cleanup; goto cleanup;
...@@ -848,7 +848,7 @@ ext3_xattr_block_set(handle_t *handle, struct inode *inode, ...@@ -848,7 +848,7 @@ ext3_xattr_block_set(handle_t *handle, struct inode *inode,
bad_block: bad_block:
ext3_error(inode->i_sb, __FUNCTION__, ext3_error(inode->i_sb, __FUNCTION__,
"inode %ld: bad block "E3FSBLK, inode->i_ino, "inode %lu: bad block "E3FSBLK, inode->i_ino,
EXT3_I(inode)->i_file_acl); EXT3_I(inode)->i_file_acl);
goto cleanup; goto cleanup;
...@@ -1077,14 +1077,14 @@ ext3_xattr_delete_inode(handle_t *handle, struct inode *inode) ...@@ -1077,14 +1077,14 @@ ext3_xattr_delete_inode(handle_t *handle, struct inode *inode)
bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl); bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl);
if (!bh) { if (!bh) {
ext3_error(inode->i_sb, __FUNCTION__, ext3_error(inode->i_sb, __FUNCTION__,
"inode %ld: block "E3FSBLK" read error", inode->i_ino, "inode %lu: block "E3FSBLK" read error", inode->i_ino,
EXT3_I(inode)->i_file_acl); EXT3_I(inode)->i_file_acl);
goto cleanup; goto cleanup;
} }
if (BHDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) || if (BHDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) ||
BHDR(bh)->h_blocks != cpu_to_le32(1)) { BHDR(bh)->h_blocks != cpu_to_le32(1)) {
ext3_error(inode->i_sb, __FUNCTION__, ext3_error(inode->i_sb, __FUNCTION__,
"inode %ld: bad block "E3FSBLK, inode->i_ino, "inode %lu: bad block "E3FSBLK, inode->i_ino,
EXT3_I(inode)->i_file_acl); EXT3_I(inode)->i_file_acl);
goto cleanup; goto cleanup;
} }
...@@ -1211,7 +1211,7 @@ ext3_xattr_cache_find(struct inode *inode, struct ext3_xattr_header *header, ...@@ -1211,7 +1211,7 @@ ext3_xattr_cache_find(struct inode *inode, struct ext3_xattr_header *header,
bh = sb_bread(inode->i_sb, ce->e_block); bh = sb_bread(inode->i_sb, ce->e_block);
if (!bh) { if (!bh) {
ext3_error(inode->i_sb, __FUNCTION__, ext3_error(inode->i_sb, __FUNCTION__,
"inode %ld: block %lu read error", "inode %lu: block %lu read error",
inode->i_ino, (unsigned long) ce->e_block); inode->i_ino, (unsigned long) ce->e_block);
} else if (le32_to_cpu(BHDR(bh)->h_refcount) >= } else if (le32_to_cpu(BHDR(bh)->h_refcount) >=
EXT3_XATTR_REFCOUNT_MAX) { EXT3_XATTR_REFCOUNT_MAX) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment