diff options
author | David Howells <dhowells@redhat.com> | 2008-02-07 03:15:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 11:42:27 -0500 |
commit | 1d1fe1ee02b9ac2660995b10e35dd41448fef011 (patch) | |
tree | 8961bbe5a36a07dc8ad8c6cd3e973ce0fcde5850 /fs/ext4/inode.c | |
parent | 473043dcee1874aab99f66b0362b344618eb3790 (diff) |
iget: stop EXT4 from using iget() and read_inode()
Stop the EXT4 filesystem from using iget() and read_inode(). Replace
ext4_read_inode() with ext4_iget(), and call that instead of iget().
ext4_iget() then uses iget_locked() directly and returns a proper error code
instead of an inode in the event of an error.
ext4_fill_super() returns any error incurred when getting the root inode
instead of EINVAL.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: "Theodore Ts'o" <tytso@mit.edu>
Acked-by: Jan Kara <jack@suse.cz>
Cc: <linux-ext4@vger.kernel.org>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r-- | fs/ext4/inode.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 0e9055cf700e..f4e387452246 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -2680,21 +2680,31 @@ static blkcnt_t ext4_inode_blocks(struct ext4_inode *raw_inode, | |||
2680 | } | 2680 | } |
2681 | } | 2681 | } |
2682 | 2682 | ||
2683 | void ext4_read_inode(struct inode * inode) | 2683 | struct inode *ext4_iget(struct super_block *sb, unsigned long ino) |
2684 | { | 2684 | { |
2685 | struct ext4_iloc iloc; | 2685 | struct ext4_iloc iloc; |
2686 | struct ext4_inode *raw_inode; | 2686 | struct ext4_inode *raw_inode; |
2687 | struct ext4_inode_info *ei = EXT4_I(inode); | 2687 | struct ext4_inode_info *ei; |
2688 | struct buffer_head *bh; | 2688 | struct buffer_head *bh; |
2689 | struct inode *inode; | ||
2690 | long ret; | ||
2689 | int block; | 2691 | int block; |
2690 | 2692 | ||
2693 | inode = iget_locked(sb, ino); | ||
2694 | if (!inode) | ||
2695 | return ERR_PTR(-ENOMEM); | ||
2696 | if (!(inode->i_state & I_NEW)) | ||
2697 | return inode; | ||
2698 | |||
2699 | ei = EXT4_I(inode); | ||
2691 | #ifdef CONFIG_EXT4DEV_FS_POSIX_ACL | 2700 | #ifdef CONFIG_EXT4DEV_FS_POSIX_ACL |
2692 | ei->i_acl = EXT4_ACL_NOT_CACHED; | 2701 | ei->i_acl = EXT4_ACL_NOT_CACHED; |
2693 | ei->i_default_acl = EXT4_ACL_NOT_CACHED; | 2702 | ei->i_default_acl = EXT4_ACL_NOT_CACHED; |
2694 | #endif | 2703 | #endif |
2695 | ei->i_block_alloc_info = NULL; | 2704 | ei->i_block_alloc_info = NULL; |
2696 | 2705 | ||
2697 | if (__ext4_get_inode_loc(inode, &iloc, 0)) | 2706 | ret = __ext4_get_inode_loc(inode, &iloc, 0); |
2707 | if (ret < 0) | ||
2698 | goto bad_inode; | 2708 | goto bad_inode; |
2699 | bh = iloc.bh; | 2709 | bh = iloc.bh; |
2700 | raw_inode = ext4_raw_inode(&iloc); | 2710 | raw_inode = ext4_raw_inode(&iloc); |
@@ -2720,6 +2730,7 @@ void ext4_read_inode(struct inode * inode) | |||
2720 | !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS)) { | 2730 | !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS)) { |
2721 | /* this inode is deleted */ | 2731 | /* this inode is deleted */ |
2722 | brelse (bh); | 2732 | brelse (bh); |
2733 | ret = -ESTALE; | ||
2723 | goto bad_inode; | 2734 | goto bad_inode; |
2724 | } | 2735 | } |
2725 | /* The only unlinked inodes we let through here have | 2736 | /* The only unlinked inodes we let through here have |
@@ -2758,6 +2769,7 @@ void ext4_read_inode(struct inode * inode) | |||
2758 | if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > | 2769 | if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > |
2759 | EXT4_INODE_SIZE(inode->i_sb)) { | 2770 | EXT4_INODE_SIZE(inode->i_sb)) { |
2760 | brelse (bh); | 2771 | brelse (bh); |
2772 | ret = -EIO; | ||
2761 | goto bad_inode; | 2773 | goto bad_inode; |
2762 | } | 2774 | } |
2763 | if (ei->i_extra_isize == 0) { | 2775 | if (ei->i_extra_isize == 0) { |
@@ -2811,11 +2823,12 @@ void ext4_read_inode(struct inode * inode) | |||
2811 | } | 2823 | } |
2812 | brelse (iloc.bh); | 2824 | brelse (iloc.bh); |
2813 | ext4_set_inode_flags(inode); | 2825 | ext4_set_inode_flags(inode); |
2814 | return; | 2826 | unlock_new_inode(inode); |
2827 | return inode; | ||
2815 | 2828 | ||
2816 | bad_inode: | 2829 | bad_inode: |
2817 | make_bad_inode(inode); | 2830 | iget_failed(inode); |
2818 | return; | 2831 | return ERR_PTR(ret); |
2819 | } | 2832 | } |
2820 | 2833 | ||
2821 | static int ext4_inode_blocks_set(handle_t *handle, | 2834 | static int ext4_inode_blocks_set(handle_t *handle, |