aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs/inode.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2008-02-07 03:15:48 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 11:42:29 -0500
commitb55c460da6df4e8dfc6f68c00fafe7337b54e2f8 (patch)
treeef38152ff42e3a50a9e193cd66bd81107d58a2e4 /fs/ufs/inode.c
parentb8e1343f67460554ca5321956c440cc064e9889b (diff)
iget: stop UFS from using iget() and read_inode()
Stop the UFS filesystem from using iget() and read_inode(). Replace ufs_read_inode() with ufs_iget(), and call that instead of iget(). ufs_iget() then uses iget_locked() directly and returns a proper error code instead of an inode in the event of an error. ufs_fill_super() returns any error incurred when getting the root inode instead of EINVAL. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: David Howells <dhowells@redhat.com> Cc: Evgeniy Dushistov <dushistov@mail.ru> 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/ufs/inode.c')
-rw-r--r--fs/ufs/inode.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 4320782761ae..489f26bc26d9 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -714,26 +714,30 @@ static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode)
714 return 0; 714 return 0;
715} 715}
716 716
717void ufs_read_inode(struct inode * inode) 717struct inode *ufs_iget(struct super_block *sb, unsigned long ino)
718{ 718{
719 struct ufs_inode_info *ufsi = UFS_I(inode); 719 struct ufs_inode_info *ufsi;
720 struct super_block * sb; 720 struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
721 struct ufs_sb_private_info * uspi;
722 struct buffer_head * bh; 721 struct buffer_head * bh;
722 struct inode *inode;
723 int err; 723 int err;
724 724
725 UFSD("ENTER, ino %lu\n", inode->i_ino); 725 UFSD("ENTER, ino %lu\n", ino);
726
727 sb = inode->i_sb;
728 uspi = UFS_SB(sb)->s_uspi;
729 726
730 if (inode->i_ino < UFS_ROOTINO || 727 if (ino < UFS_ROOTINO || ino > (uspi->s_ncg * uspi->s_ipg)) {
731 inode->i_ino > (uspi->s_ncg * uspi->s_ipg)) {
732 ufs_warning(sb, "ufs_read_inode", "bad inode number (%lu)\n", 728 ufs_warning(sb, "ufs_read_inode", "bad inode number (%lu)\n",
733 inode->i_ino); 729 ino);
734 goto bad_inode; 730 return ERR_PTR(-EIO);
735 } 731 }
736 732
733 inode = iget_locked(sb, ino);
734 if (!inode)
735 return ERR_PTR(-ENOMEM);
736 if (!(inode->i_state & I_NEW))
737 return inode;
738
739 ufsi = UFS_I(inode);
740
737 bh = sb_bread(sb, uspi->s_sbbase + ufs_inotofsba(inode->i_ino)); 741 bh = sb_bread(sb, uspi->s_sbbase + ufs_inotofsba(inode->i_ino));
738 if (!bh) { 742 if (!bh) {
739 ufs_warning(sb, "ufs_read_inode", "unable to read inode %lu\n", 743 ufs_warning(sb, "ufs_read_inode", "unable to read inode %lu\n",
@@ -765,10 +769,12 @@ void ufs_read_inode(struct inode * inode)
765 brelse(bh); 769 brelse(bh);
766 770
767 UFSD("EXIT\n"); 771 UFSD("EXIT\n");
768 return; 772 unlock_new_inode(inode);
773 return inode;
769 774
770bad_inode: 775bad_inode:
771 make_bad_inode(inode); 776 iget_failed(inode);
777 return ERR_PTR(-EIO);
772} 778}
773 779
774static void ufs1_update_inode(struct inode *inode, struct ufs_inode *ufs_inode) 780static void ufs1_update_inode(struct inode *inode, struct ufs_inode *ufs_inode)