aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Sandeen <esandeen@redhat.com>2006-09-27 04:49:30 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-27 11:26:09 -0400
commiteee194e76c681dbdbf5024b889fda1181b66ef57 (patch)
treebbefd2b2da5a49dcf8057e182f35c044445111e9
parent41f04d852e359582518f950d12b2287766613022 (diff)
[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: Eric Sandeen <esandeen@redhat.com> Cc: Mingming Cao <cmm@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/ext3/ialloc.c6
-rw-r--r--fs/ext3/inode.c2
-rw-r--r--fs/ext3/namei.c4
-rw-r--r--fs/ext3/super.c25
-rw-r--r--fs/ext3/xattr.c16
5 files changed, 27 insertions, 26 deletions
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index 5e288368499b..1e4ded8aa3cd 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -202,7 +202,7 @@ error_return:
202static int find_group_dir(struct super_block *sb, struct inode *parent) 202static int find_group_dir(struct super_block *sb, struct inode *parent)
203{ 203{
204 int ngroups = EXT3_SB(sb)->s_groups_count; 204 int ngroups = EXT3_SB(sb)->s_groups_count;
205 int freei, avefreei; 205 unsigned int freei, avefreei;
206 struct ext3_group_desc *desc, *best_desc = NULL; 206 struct ext3_group_desc *desc, *best_desc = NULL;
207 struct buffer_head *bh; 207 struct buffer_head *bh;
208 int group, best_group = -1; 208 int group, best_group = -1;
@@ -261,10 +261,10 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
261 struct ext3_super_block *es = sbi->s_es; 261 struct ext3_super_block *es = sbi->s_es;
262 int ngroups = sbi->s_groups_count; 262 int ngroups = sbi->s_groups_count;
263 int inodes_per_group = EXT3_INODES_PER_GROUP(sb); 263 int inodes_per_group = EXT3_INODES_PER_GROUP(sb);
264 int freei, avefreei; 264 unsigned int freei, avefreei;
265 ext3_fsblk_t freeb, avefreeb; 265 ext3_fsblk_t freeb, avefreeb;
266 ext3_fsblk_t blocks_per_dir; 266 ext3_fsblk_t blocks_per_dir;
267 int ndirs; 267 unsigned int ndirs;
268 int max_debt, max_dirs, min_inodes; 268 int max_debt, max_dirs, min_inodes;
269 ext3_grpblk_t min_blocks; 269 ext3_grpblk_t min_blocks;
270 int group = -1, i; 270 int group = -1, i;
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index 473d206b1d7e..56665fab027d 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -2115,7 +2115,7 @@ static void ext3_free_branches(handle_t *handle, struct inode *inode,
2115 */ 2115 */
2116 if (!bh) { 2116 if (!bh) {
2117 ext3_error(inode->i_sb, "ext3_free_branches", 2117 ext3_error(inode->i_sb, "ext3_free_branches",
2118 "Read failure, inode=%ld, block="E3FSBLK, 2118 "Read failure, inode=%lu, block="E3FSBLK,
2119 inode->i_ino, nr); 2119 inode->i_ino, nr);
2120 continue; 2120 continue;
2121 } 2121 }
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 4123f5261bcd..70dc5206ebfa 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1919,8 +1919,8 @@ int ext3_orphan_add(handle_t *handle, struct inode *inode)
1919 if (!err) 1919 if (!err)
1920 list_add(&EXT3_I(inode)->i_orphan, &EXT3_SB(sb)->s_orphan); 1920 list_add(&EXT3_I(inode)->i_orphan, &EXT3_SB(sb)->s_orphan);
1921 1921
1922 jbd_debug(4, "superblock will point to %ld\n", inode->i_ino); 1922 jbd_debug(4, "superblock will point to %lu\n", inode->i_ino);
1923 jbd_debug(4, "orphan inode %ld will point to %d\n", 1923 jbd_debug(4, "orphan inode %lu will point to %d\n",
1924 inode->i_ino, NEXT_ORPHAN(inode)); 1924 inode->i_ino, NEXT_ORPHAN(inode));
1925out_unlock: 1925out_unlock:
1926 unlock_super(sb); 1926 unlock_super(sb);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 762dff7b56fb..bc7a768f9bb4 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -45,7 +45,7 @@
45static int ext3_load_journal(struct super_block *, struct ext3_super_block *, 45static int ext3_load_journal(struct super_block *, struct ext3_super_block *,
46 unsigned long journal_devnum); 46 unsigned long journal_devnum);
47static int ext3_create_journal(struct super_block *, struct ext3_super_block *, 47static int ext3_create_journal(struct super_block *, struct ext3_super_block *,
48 int); 48 unsigned int);
49static void ext3_commit_super (struct super_block * sb, 49static void ext3_commit_super (struct super_block * sb,
50 struct ext3_super_block * es, 50 struct ext3_super_block * es,
51 int sync); 51 int sync);
@@ -376,7 +376,7 @@ static void dump_orphan_list(struct super_block *sb, struct ext3_sb_info *sbi)
376 list_for_each(l, &sbi->s_orphan) { 376 list_for_each(l, &sbi->s_orphan) {
377 struct inode *inode = orphan_list_entry(l); 377 struct inode *inode = orphan_list_entry(l);
378 printk(KERN_ERR " " 378 printk(KERN_ERR " "
379 "inode %s:%ld at %p: mode %o, nlink %d, next %d\n", 379 "inode %s:%lu at %p: mode %o, nlink %d, next %d\n",
380 inode->i_sb->s_id, inode->i_ino, inode, 380 inode->i_sb->s_id, inode->i_ino, inode,
381 inode->i_mode, inode->i_nlink, 381 inode->i_mode, inode->i_nlink,
382 NEXT_ORPHAN(inode)); 382 NEXT_ORPHAN(inode));
@@ -753,7 +753,7 @@ static ext3_fsblk_t get_sb_block(void **data)
753} 753}
754 754
755static int parse_options (char *options, struct super_block *sb, 755static int parse_options (char *options, struct super_block *sb,
756 unsigned long *inum, unsigned long *journal_devnum, 756 unsigned int *inum, unsigned long *journal_devnum,
757 ext3_fsblk_t *n_blocks_count, int is_remount) 757 ext3_fsblk_t *n_blocks_count, int is_remount)
758{ 758{
759 struct ext3_sb_info *sbi = EXT3_SB(sb); 759 struct ext3_sb_info *sbi = EXT3_SB(sb);
@@ -1306,17 +1306,17 @@ static void ext3_orphan_cleanup (struct super_block * sb,
1306 DQUOT_INIT(inode); 1306 DQUOT_INIT(inode);
1307 if (inode->i_nlink) { 1307 if (inode->i_nlink) {
1308 printk(KERN_DEBUG 1308 printk(KERN_DEBUG
1309 "%s: truncating inode %ld to %Ld bytes\n", 1309 "%s: truncating inode %lu to %Ld bytes\n",
1310 __FUNCTION__, inode->i_ino, inode->i_size); 1310 __FUNCTION__, inode->i_ino, inode->i_size);
1311 jbd_debug(2, "truncating inode %ld to %Ld bytes\n", 1311 jbd_debug(2, "truncating inode %lu to %Ld bytes\n",
1312 inode->i_ino, inode->i_size); 1312 inode->i_ino, inode->i_size);
1313 ext3_truncate(inode); 1313 ext3_truncate(inode);
1314 nr_truncates++; 1314 nr_truncates++;
1315 } else { 1315 } else {
1316 printk(KERN_DEBUG 1316 printk(KERN_DEBUG
1317 "%s: deleting unreferenced inode %ld\n", 1317 "%s: deleting unreferenced inode %lu\n",
1318 __FUNCTION__, inode->i_ino); 1318 __FUNCTION__, inode->i_ino);
1319 jbd_debug(2, "deleting unreferenced inode %ld\n", 1319 jbd_debug(2, "deleting unreferenced inode %lu\n",
1320 inode->i_ino); 1320 inode->i_ino);
1321 nr_orphans++; 1321 nr_orphans++;
1322 } 1322 }
@@ -1395,7 +1395,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1395 ext3_fsblk_t sb_block = get_sb_block(&data); 1395 ext3_fsblk_t sb_block = get_sb_block(&data);
1396 ext3_fsblk_t logic_sb_block; 1396 ext3_fsblk_t logic_sb_block;
1397 unsigned long offset = 0; 1397 unsigned long offset = 0;
1398 unsigned long journal_inum = 0; 1398 unsigned int journal_inum = 0;
1399 unsigned long journal_devnum = 0; 1399 unsigned long journal_devnum = 0;
1400 unsigned long def_mount_opts; 1400 unsigned long def_mount_opts;
1401 struct inode *root; 1401 struct inode *root;
@@ -1844,7 +1844,8 @@ static void ext3_init_journal_params(struct super_block *sb, journal_t *journal)
1844 spin_unlock(&journal->j_state_lock); 1844 spin_unlock(&journal->j_state_lock);
1845} 1845}
1846 1846
1847static journal_t *ext3_get_journal(struct super_block *sb, int journal_inum) 1847static journal_t *ext3_get_journal(struct super_block *sb,
1848 unsigned int journal_inum)
1848{ 1849{
1849 struct inode *journal_inode; 1850 struct inode *journal_inode;
1850 journal_t *journal; 1851 journal_t *journal;
@@ -1979,7 +1980,7 @@ static int ext3_load_journal(struct super_block *sb,
1979 unsigned long journal_devnum) 1980 unsigned long journal_devnum)
1980{ 1981{
1981 journal_t *journal; 1982 journal_t *journal;
1982 int journal_inum = le32_to_cpu(es->s_journal_inum); 1983 unsigned int journal_inum = le32_to_cpu(es->s_journal_inum);
1983 dev_t journal_dev; 1984 dev_t journal_dev;
1984 int err = 0; 1985 int err = 0;
1985 int really_read_only; 1986 int really_read_only;
@@ -2065,7 +2066,7 @@ static int ext3_load_journal(struct super_block *sb,
2065 2066
2066static int ext3_create_journal(struct super_block * sb, 2067static int ext3_create_journal(struct super_block * sb,
2067 struct ext3_super_block * es, 2068 struct ext3_super_block * es,
2068 int journal_inum) 2069 unsigned int journal_inum)
2069{ 2070{
2070 journal_t *journal; 2071 journal_t *journal;
2071 2072
@@ -2078,7 +2079,7 @@ static int ext3_create_journal(struct super_block * sb,
2078 if (!(journal = ext3_get_journal(sb, journal_inum))) 2079 if (!(journal = ext3_get_journal(sb, journal_inum)))
2079 return -EINVAL; 2080 return -EINVAL;
2080 2081
2081 printk(KERN_INFO "EXT3-fs: creating new journal on inode %d\n", 2082 printk(KERN_INFO "EXT3-fs: creating new journal on inode %u\n",
2082 journal_inum); 2083 journal_inum);
2083 2084
2084 if (journal_create(journal)) { 2085 if (journal_create(journal)) {
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index a44a0562203a..f86f2482f01d 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -75,7 +75,7 @@
75 75
76#ifdef EXT3_XATTR_DEBUG 76#ifdef EXT3_XATTR_DEBUG
77# define ea_idebug(inode, f...) do { \ 77# define ea_idebug(inode, f...) do { \
78 printk(KERN_DEBUG "inode %s:%ld: ", \ 78 printk(KERN_DEBUG "inode %s:%lu: ", \
79 inode->i_sb->s_id, inode->i_ino); \ 79 inode->i_sb->s_id, inode->i_ino); \
80 printk(f); \ 80 printk(f); \
81 printk("\n"); \ 81 printk("\n"); \
@@ -233,7 +233,7 @@ ext3_xattr_block_get(struct inode *inode, int name_index, const char *name,
233 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); 233 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount));
234 if (ext3_xattr_check_block(bh)) { 234 if (ext3_xattr_check_block(bh)) {
235bad_block: ext3_error(inode->i_sb, __FUNCTION__, 235bad_block: ext3_error(inode->i_sb, __FUNCTION__,
236 "inode %ld: bad block "E3FSBLK, inode->i_ino, 236 "inode %lu: bad block "E3FSBLK, inode->i_ino,
237 EXT3_I(inode)->i_file_acl); 237 EXT3_I(inode)->i_file_acl);
238 error = -EIO; 238 error = -EIO;
239 goto cleanup; 239 goto cleanup;
@@ -375,7 +375,7 @@ ext3_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size)
375 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); 375 atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount));
376 if (ext3_xattr_check_block(bh)) { 376 if (ext3_xattr_check_block(bh)) {
377 ext3_error(inode->i_sb, __FUNCTION__, 377 ext3_error(inode->i_sb, __FUNCTION__,
378 "inode %ld: bad block "E3FSBLK, inode->i_ino, 378 "inode %lu: bad block "E3FSBLK, inode->i_ino,
379 EXT3_I(inode)->i_file_acl); 379 EXT3_I(inode)->i_file_acl);
380 error = -EIO; 380 error = -EIO;
381 goto cleanup; 381 goto cleanup;
@@ -647,7 +647,7 @@ ext3_xattr_block_find(struct inode *inode, struct ext3_xattr_info *i,
647 le32_to_cpu(BHDR(bs->bh)->h_refcount)); 647 le32_to_cpu(BHDR(bs->bh)->h_refcount));
648 if (ext3_xattr_check_block(bs->bh)) { 648 if (ext3_xattr_check_block(bs->bh)) {
649 ext3_error(sb, __FUNCTION__, 649 ext3_error(sb, __FUNCTION__,
650 "inode %ld: bad block "E3FSBLK, inode->i_ino, 650 "inode %lu: bad block "E3FSBLK, inode->i_ino,
651 EXT3_I(inode)->i_file_acl); 651 EXT3_I(inode)->i_file_acl);
652 error = -EIO; 652 error = -EIO;
653 goto cleanup; 653 goto cleanup;
@@ -848,7 +848,7 @@ cleanup_dquot:
848 848
849bad_block: 849bad_block:
850 ext3_error(inode->i_sb, __FUNCTION__, 850 ext3_error(inode->i_sb, __FUNCTION__,
851 "inode %ld: bad block "E3FSBLK, inode->i_ino, 851 "inode %lu: bad block "E3FSBLK, inode->i_ino,
852 EXT3_I(inode)->i_file_acl); 852 EXT3_I(inode)->i_file_acl);
853 goto cleanup; 853 goto cleanup;
854 854
@@ -1077,14 +1077,14 @@ ext3_xattr_delete_inode(handle_t *handle, struct inode *inode)
1077 bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl); 1077 bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl);
1078 if (!bh) { 1078 if (!bh) {
1079 ext3_error(inode->i_sb, __FUNCTION__, 1079 ext3_error(inode->i_sb, __FUNCTION__,
1080 "inode %ld: block "E3FSBLK" read error", inode->i_ino, 1080 "inode %lu: block "E3FSBLK" read error", inode->i_ino,
1081 EXT3_I(inode)->i_file_acl); 1081 EXT3_I(inode)->i_file_acl);
1082 goto cleanup; 1082 goto cleanup;
1083 } 1083 }
1084 if (BHDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) || 1084 if (BHDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) ||
1085 BHDR(bh)->h_blocks != cpu_to_le32(1)) { 1085 BHDR(bh)->h_blocks != cpu_to_le32(1)) {
1086 ext3_error(inode->i_sb, __FUNCTION__, 1086 ext3_error(inode->i_sb, __FUNCTION__,
1087 "inode %ld: bad block "E3FSBLK, inode->i_ino, 1087 "inode %lu: bad block "E3FSBLK, inode->i_ino,
1088 EXT3_I(inode)->i_file_acl); 1088 EXT3_I(inode)->i_file_acl);
1089 goto cleanup; 1089 goto cleanup;
1090 } 1090 }
@@ -1211,7 +1211,7 @@ again:
1211 bh = sb_bread(inode->i_sb, ce->e_block); 1211 bh = sb_bread(inode->i_sb, ce->e_block);
1212 if (!bh) { 1212 if (!bh) {
1213 ext3_error(inode->i_sb, __FUNCTION__, 1213 ext3_error(inode->i_sb, __FUNCTION__,
1214 "inode %ld: block %lu read error", 1214 "inode %lu: block %lu read error",
1215 inode->i_ino, (unsigned long) ce->e_block); 1215 inode->i_ino, (unsigned long) ce->e_block);
1216 } else if (le32_to_cpu(BHDR(bh)->h_refcount) >= 1216 } else if (le32_to_cpu(BHDR(bh)->h_refcount) >=
1217 EXT3_XATTR_REFCOUNT_MAX) { 1217 EXT3_XATTR_REFCOUNT_MAX) {