aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ufs/inode.c')
-rw-r--r--fs/ufs/inode.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 4320782761ae..5446b888fc8e 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -30,7 +30,6 @@
30 30
31#include <linux/errno.h> 31#include <linux/errno.h>
32#include <linux/fs.h> 32#include <linux/fs.h>
33#include <linux/ufs_fs.h>
34#include <linux/time.h> 33#include <linux/time.h>
35#include <linux/stat.h> 34#include <linux/stat.h>
36#include <linux/string.h> 35#include <linux/string.h>
@@ -38,6 +37,7 @@
38#include <linux/smp_lock.h> 37#include <linux/smp_lock.h>
39#include <linux/buffer_head.h> 38#include <linux/buffer_head.h>
40 39
40#include "ufs_fs.h"
41#include "ufs.h" 41#include "ufs.h"
42#include "swab.h" 42#include "swab.h"
43#include "util.h" 43#include "util.h"
@@ -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)