Re: [PATCH 13/30] IGET: Stop EXT4 from using iget() and read_inode()

From: Jan Kara
Date: Tue Oct 02 2007 - 08:27:10 EST


> diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
> index 427f830..8bb63f2 100644
> --- a/fs/ext4/ialloc.c
> +++ b/fs/ext4/ialloc.c
> @@ -682,9 +682,14 @@ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino)
> * is a valid orphan (no e2fsck run on fs). Orphans also include
> * inodes that were being truncated, so we can't check i_nlink==0.
> */
> - if (!ext4_test_bit(bit, bitmap_bh->b_data) ||
> - !(inode = iget(sb, ino)) || is_bad_inode(inode) ||
> - NEXT_ORPHAN(inode) > max_ino) {
> + if (ext4_test_bit(bit, bitmap_bh->b_data))
> + goto out;
> +
> + inode = ext4_iget(sb, ino);
> + if (IS_ERR(inode))
> + goto out;
> +
> + if (NEXT_ORPHAN(inode) > max_ino) {
> ext4_warning(sb, __FUNCTION__,
> "bad orphan inode %lu! e2fsck was run?", ino);
> printk(KERN_NOTICE "ext4_test_bit(bit=%d, block=%llu) = %d\n",
Same comments as for ext3 - I think you reversed ext4_test_bit() test
and also the warning won't be issued in some cases which is wrong.

> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 5fdb862..af98d07 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -1044,17 +1044,11 @@ static struct dentry *ext4_lookup(struct inode * dir, struct dentry *dentry, str
> if (!ext4_valid_inum(dir->i_sb, ino)) {
> ext4_error(dir->i_sb, "ext4_lookup",
> "bad inode number: %lu", ino);
> - inode = NULL;
> - } else
> - inode = iget(dir->i_sb, ino);
> -
> - if (!inode)
> return ERR_PTR(-EACCES);
-EIO more appropriate here?

Honza
--
Jan Kara <jack@xxxxxxx>
SuSE CR Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/