fuse: clean up fuse_alloc_inode
authorzhangliguang <zhangliguang@linux.alibaba.com>
Mon, 6 May 2019 08:52:25 +0000 (16:52 +0800)
committerMiklos Szeredi <mszeredi@redhat.com>
Wed, 8 May 2019 11:58:29 +0000 (13:58 +0200)
This patch cleans up fuse_alloc_inode function, just simply the code, no
logic change.

Signed-off-by: zhangliguang <zhangliguang@linux.alibaba.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/inode.c

index c67b39e88fd558cf8d62d8ffe96339bef881b16e..2dfa5dcb1575b2d9433e0458cdfc398dda17a47e 100644 (file)
@@ -81,14 +81,12 @@ struct fuse_forget_link *fuse_alloc_forget(void)
 
 static struct inode *fuse_alloc_inode(struct super_block *sb)
 {
-       struct inode *inode;
        struct fuse_inode *fi;
 
-       inode = kmem_cache_alloc(fuse_inode_cachep, GFP_KERNEL);
-       if (!inode)
+       fi = kmem_cache_alloc(fuse_inode_cachep, GFP_KERNEL);
+       if (!fi)
                return NULL;
 
-       fi = get_fuse_inode(inode);
        fi->i_time = 0;
        fi->inval_mask = 0;
        fi->nodeid = 0;
@@ -100,11 +98,11 @@ static struct inode *fuse_alloc_inode(struct super_block *sb)
        spin_lock_init(&fi->lock);
        fi->forget = fuse_alloc_forget();
        if (!fi->forget) {
-               kmem_cache_free(fuse_inode_cachep, inode);
+               kmem_cache_free(fuse_inode_cachep, fi);
                return NULL;
        }
 
-       return inode;
+       return &fi->inode;
 }
 
 static void fuse_i_callback(struct rcu_head *head)