Commit 42f834c3 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] ext3 ino_t removal

Patch from Andreas Dilger <adilger@clusterfs.com>

This patch against 2.5.53 removes my erronous use of ino_t in a couple of
places in the ext3 code.  This has been replaced with unsigned long (the same
as is used for inode->i_ino).  This patch matches the fix submitted to 2.4
for fixing 64-bit compiler warnings, and also replaces a couple of %ld with
%lu to forestall output wierdness with filesystems with a few billion inodes.
parent 9552d6bc
...@@ -417,7 +417,7 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode) ...@@ -417,7 +417,7 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode)
struct buffer_head *bitmap_bh = NULL; struct buffer_head *bitmap_bh = NULL;
struct buffer_head *bh2; struct buffer_head *bh2;
int group; int group;
ino_t ino; unsigned long ino;
struct inode * inode; struct inode * inode;
struct ext3_group_desc * gdp; struct ext3_group_desc * gdp;
struct ext3_super_block * es; struct ext3_super_block * es;
...@@ -463,7 +463,7 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode) ...@@ -463,7 +463,7 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode)
BUFFER_TRACE(bitmap_bh, "get_write_access"); BUFFER_TRACE(bitmap_bh, "get_write_access");
err = ext3_journal_get_write_access(handle, bitmap_bh); err = ext3_journal_get_write_access(handle, bitmap_bh);
if (err) goto fail; if (err) goto fail;
if (ext3_set_bit(ino, bitmap_bh->b_data)) { if (ext3_set_bit(ino, bitmap_bh->b_data)) {
ext3_error (sb, "ext3_new_inode", ext3_error (sb, "ext3_new_inode",
"bit already set for inode %lu", ino); "bit already set for inode %lu", ino);
...@@ -619,19 +619,18 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode) ...@@ -619,19 +619,18 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode)
} }
/* Verify that we are loading a valid orphan from disk */ /* Verify that we are loading a valid orphan from disk */
struct inode *ext3_orphan_get (struct super_block * sb, ino_t ino) struct inode *ext3_orphan_get(struct super_block *sb, unsigned long ino)
{ {
ino_t max_ino = le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count); unsigned long max_ino = le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count);
unsigned long block_group; unsigned long block_group;
int bit; int bit;
struct buffer_head *bitmap_bh = NULL; struct buffer_head *bitmap_bh = NULL;
struct inode *inode = NULL; struct inode *inode = NULL;
/* Error cases - e2fsck has already cleaned up for us */ /* Error cases - e2fsck has already cleaned up for us */
if (ino > max_ino) { if (ino > max_ino) {
ext3_warning(sb, __FUNCTION__, ext3_warning(sb, __FUNCTION__,
"bad orphan ino %lu! e2fsck was run?\n", "bad orphan ino %lu! e2fsck was run?\n", ino);
(unsigned long) ino);
goto out; goto out;
} }
...@@ -640,8 +639,7 @@ struct inode *ext3_orphan_get (struct super_block * sb, ino_t ino) ...@@ -640,8 +639,7 @@ struct inode *ext3_orphan_get (struct super_block * sb, ino_t ino)
bitmap_bh = read_inode_bitmap(sb, block_group); bitmap_bh = read_inode_bitmap(sb, block_group);
if (!bitmap_bh) { if (!bitmap_bh) {
ext3_warning(sb, __FUNCTION__, ext3_warning(sb, __FUNCTION__,
"inode bitmap error for orphan %lu\n", "inode bitmap error for orphan %lu\n", ino);
(unsigned long) ino);
goto out; goto out;
} }
...@@ -653,19 +651,17 @@ struct inode *ext3_orphan_get (struct super_block * sb, ino_t ino) ...@@ -653,19 +651,17 @@ struct inode *ext3_orphan_get (struct super_block * sb, ino_t ino)
!(inode = iget(sb, ino)) || is_bad_inode(inode) || !(inode = iget(sb, ino)) || is_bad_inode(inode) ||
NEXT_ORPHAN(inode) > max_ino) { NEXT_ORPHAN(inode) > max_ino) {
ext3_warning(sb, __FUNCTION__, ext3_warning(sb, __FUNCTION__,
"bad orphan inode %lu! e2fsck was run?\n", (unsigned long)ino); "bad orphan inode %lu! e2fsck was run?\n", ino);
printk(KERN_NOTICE "ext3_test_bit(bit=%d, block=%llu) = %d\n", printk(KERN_NOTICE "ext3_test_bit(bit=%d, block=%llu) = %d\n",
bit, bit, (unsigned long long)bitmap_bh->b_blocknr,
(unsigned long long)bitmap_bh->b_blocknr, ext3_test_bit(bit, bitmap_bh->b_data));
ext3_test_bit(bit, bitmap_bh->b_data));
printk(KERN_NOTICE "inode=%p\n", inode); printk(KERN_NOTICE "inode=%p\n", inode);
if (inode) { if (inode) {
printk(KERN_NOTICE "is_bad_inode(inode)=%d\n", printk(KERN_NOTICE "is_bad_inode(inode)=%d\n",
is_bad_inode(inode)); is_bad_inode(inode));
printk(KERN_NOTICE "NEXT_ORPHAN(inode)=%d\n", printk(KERN_NOTICE "NEXT_ORPHAN(inode)=%u\n",
NEXT_ORPHAN(inode)); NEXT_ORPHAN(inode));
printk(KERN_NOTICE "max_ino=%lu\n", printk(KERN_NOTICE "max_ino=%lu\n", max_ino);
(unsigned long) max_ino);
} }
/* Avoid freeing blocks if we got a bad deleted inode */ /* Avoid freeing blocks if we got a bad deleted inode */
if (inode && inode->i_nlink == 0) if (inode && inode->i_nlink == 0)
......
...@@ -1871,10 +1871,10 @@ int ext3_orphan_del(handle_t *handle, struct inode *inode) ...@@ -1871,10 +1871,10 @@ int ext3_orphan_del(handle_t *handle, struct inode *inode)
struct list_head *prev; struct list_head *prev;
struct ext3_inode_info *ei = EXT3_I(inode); struct ext3_inode_info *ei = EXT3_I(inode);
struct ext3_sb_info *sbi; struct ext3_sb_info *sbi;
ino_t ino_next; unsigned long ino_next;
struct ext3_iloc iloc; struct ext3_iloc iloc;
int err = 0; int err = 0;
lock_super(inode->i_sb); lock_super(inode->i_sb);
if (list_empty(&ei->i_orphan)) { if (list_empty(&ei->i_orphan)) {
unlock_super(inode->i_sb); unlock_super(inode->i_sb);
...@@ -1885,7 +1885,7 @@ int ext3_orphan_del(handle_t *handle, struct inode *inode) ...@@ -1885,7 +1885,7 @@ int ext3_orphan_del(handle_t *handle, struct inode *inode)
prev = ei->i_orphan.prev; prev = ei->i_orphan.prev;
sbi = EXT3_SB(inode->i_sb); sbi = EXT3_SB(inode->i_sb);
jbd_debug(4, "remove inode %ld from orphan list\n", inode->i_ino); jbd_debug(4, "remove inode %lu from orphan list\n", inode->i_ino);
list_del_init(&ei->i_orphan); list_del_init(&ei->i_orphan);
...@@ -1895,13 +1895,13 @@ int ext3_orphan_del(handle_t *handle, struct inode *inode) ...@@ -1895,13 +1895,13 @@ int ext3_orphan_del(handle_t *handle, struct inode *inode)
* list in memory. */ * list in memory. */
if (!handle) if (!handle)
goto out; goto out;
err = ext3_reserve_inode_write(handle, inode, &iloc); err = ext3_reserve_inode_write(handle, inode, &iloc);
if (err) if (err)
goto out_err; goto out_err;
if (prev == &sbi->s_orphan) { if (prev == &sbi->s_orphan) {
jbd_debug(4, "superblock will point to %ld\n", ino_next); jbd_debug(4, "superblock will point to %lu\n", ino_next);
BUFFER_TRACE(sbi->s_sbh, "get_write_access"); BUFFER_TRACE(sbi->s_sbh, "get_write_access");
err = ext3_journal_get_write_access(handle, sbi->s_sbh); err = ext3_journal_get_write_access(handle, sbi->s_sbh);
if (err) if (err)
...@@ -1912,8 +1912,8 @@ int ext3_orphan_del(handle_t *handle, struct inode *inode) ...@@ -1912,8 +1912,8 @@ int ext3_orphan_del(handle_t *handle, struct inode *inode)
struct ext3_iloc iloc2; struct ext3_iloc iloc2;
struct inode *i_prev = struct inode *i_prev =
&list_entry(prev, struct ext3_inode_info, i_orphan)->vfs_inode; &list_entry(prev, struct ext3_inode_info, i_orphan)->vfs_inode;
jbd_debug(4, "orphan inode %ld will point to %ld\n", jbd_debug(4, "orphan inode %lu will point to %lu\n",
i_prev->i_ino, ino_next); i_prev->i_ino, ino_next);
err = ext3_reserve_inode_write(handle, i_prev, &iloc2); err = ext3_reserve_inode_write(handle, i_prev, &iloc2);
if (err) if (err)
...@@ -1928,7 +1928,7 @@ int ext3_orphan_del(handle_t *handle, struct inode *inode) ...@@ -1928,7 +1928,7 @@ int ext3_orphan_del(handle_t *handle, struct inode *inode)
if (err) if (err)
goto out_brelse; goto out_brelse;
out_err: out_err:
ext3_std_error(inode->i_sb, err); ext3_std_error(inode->i_sb, err);
out: out:
unlock_super(inode->i_sb); unlock_super(inode->i_sb);
......
...@@ -707,7 +707,7 @@ extern int ext3fs_dirhash(const char *name, int len, struct ...@@ -707,7 +707,7 @@ extern int ext3fs_dirhash(const char *name, int len, struct
/* ialloc.c */ /* ialloc.c */
extern struct inode * ext3_new_inode (handle_t *, struct inode *, int); extern struct inode * ext3_new_inode (handle_t *, struct inode *, int);
extern void ext3_free_inode (handle_t *, struct inode *); extern void ext3_free_inode (handle_t *, struct inode *);
extern struct inode * ext3_orphan_get (struct super_block *, ino_t); extern struct inode * ext3_orphan_get (struct super_block *, unsigned long);
extern unsigned long ext3_count_free_inodes (struct super_block *); extern unsigned long ext3_count_free_inodes (struct super_block *);
extern unsigned long ext3_count_dirs (struct super_block *); extern unsigned long ext3_count_dirs (struct super_block *);
extern void ext3_check_inodes_bitmap (struct super_block *); extern void ext3_check_inodes_bitmap (struct super_block *);
......
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