xfs
[Top] [All Lists]

[PATCH] cleanup root inode handling in xfs_fs_fill_super

To: xfs@xxxxxxxxxxx
Subject: [PATCH] cleanup root inode handling in xfs_fs_fill_super
From: Christoph Hellwig <hch@xxxxxx>
Date: Wed, 19 Mar 2008 21:47:24 +0100
Sender: xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.3.28i
 - rename rootvp to root for clarify
 - remove useless vn_to_inode call
 - check is_bad_inode before calling d_alloc_root
 - use iput instead of VN_RELE in the error case


Signed-off-by: Christoph Hellwig <hch@xxxxxx>

Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_super.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_super.c     2008-02-27 
00:40:51.000000000 +0100
+++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_super.c  2008-02-27 00:43:04.000000000 
+0100
@@ -1307,7 +1307,7 @@ xfs_fs_fill_super(
        void                    *data,
        int                     silent)
 {
-       struct inode            *rootvp;
+       struct inode            *root;
        struct xfs_mount        *mp = NULL;
        struct xfs_mount_args   *args = xfs_args_allocate(sb, silent);
        int                     error;
@@ -1345,19 +1345,18 @@ xfs_fs_fill_super(
        sb->s_time_gran = 1;
        set_posix_acl_flag(sb);
 
-       rootvp = igrab(mp->m_rootip->i_vnode);
-       if (!rootvp) {
+       root = igrab(mp->m_rootip->i_vnode);
+       if (!root) {
                error = ENOENT;
                goto fail_unmount;
        }
-
-       sb->s_root = d_alloc_root(vn_to_inode(rootvp));
-       if (!sb->s_root) {
-               error = ENOMEM;
+       if (is_bad_inode(root)) {
+               error = EINVAL;
                goto fail_vnrele;
        }
-       if (is_bad_inode(sb->s_root->d_inode)) {
-               error = EINVAL;
+       sb->s_root = d_alloc_root(root);
+       if (!sb->s_root) {
+               error = ENOMEM;
                goto fail_vnrele;
        }
 
@@ -1379,7 +1378,7 @@ fail_vnrele:
                dput(sb->s_root);
                sb->s_root = NULL;
        } else {
-               VN_RELE(rootvp);
+               iput(root);
        }
 
 fail_unmount:


<Prev in Thread] Current Thread [Next in Thread>