]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: lustre: llite: speedup in unlink/rmdir
authorAndrew Perepechko <andrew_perepechko@xyratex.com>
Tue, 12 Apr 2016 20:14:06 +0000 (16:14 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Apr 2016 22:13:13 +0000 (15:13 -0700)
Assume dchild argument is fully initialized in ->unlink and
->rmdir callbacks, so additional lookup for ELC is not needed.

Signed-off-by: Andrew Perepechko <andrew_perepechko@xyratex.com>
Reviewed-by: Alexander Boyko <Alexander_Boyko@xyratex.com>
Reviewed-by: Vitaly Fertman <Vitaly_Fertman@xyratex.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3473
Xyratex-bug-id: MRP-1027
Reviewed-on: http://review.whamcloud.com/6648
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/llite/namei.c

index 73e61cfe9a7f84ac6b8e5b07233e5ca866361557..9fa862b375477ee1ff50ac2402ba30b2660b39fc 100644 (file)
@@ -847,12 +847,6 @@ static int ll_create_nd(struct inode *dir, struct dentry *dentry,
        return rc;
 }
 
-static inline void ll_get_child_fid(struct dentry *child, struct lu_fid *fid)
-{
-       if (d_really_is_positive(child))
-               *fid = *ll_inode2fid(d_inode(child));
-}
-
 int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir)
 {
        struct mdt_body *body;
@@ -945,7 +939,9 @@ static int ll_unlink(struct inode *dir, struct dentry *dchild)
        if (IS_ERR(op_data))
                return PTR_ERR(op_data);
 
-       ll_get_child_fid(dchild, &op_data->op_fid3);
+       if (dchild && dchild->d_inode)
+               op_data->op_fid3 = *ll_inode2fid(dchild->d_inode);
+
        op_data->op_fid2 = op_data->op_fid3;
        rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
        ll_finish_md_op_data(op_data);
@@ -995,7 +991,9 @@ static int ll_rmdir(struct inode *dir, struct dentry *dchild)
        if (IS_ERR(op_data))
                return PTR_ERR(op_data);
 
-       ll_get_child_fid(dchild, &op_data->op_fid3);
+       if (dchild && dchild->d_inode)
+               op_data->op_fid3 = *ll_inode2fid(dchild->d_inode);
+
        op_data->op_fid2 = op_data->op_fid3;
        rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
        ll_finish_md_op_data(op_data);
@@ -1076,8 +1074,11 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild,
        if (IS_ERR(op_data))
                return PTR_ERR(op_data);
 
-       ll_get_child_fid(src_dchild, &op_data->op_fid3);
-       ll_get_child_fid(tgt_dchild, &op_data->op_fid4);
+       if (src_dchild && src_dchild->d_inode)
+               op_data->op_fid3 = *ll_inode2fid(src_dchild->d_inode);
+       if (tgt_dchild && tgt_dchild->d_inode)
+               op_data->op_fid4 = *ll_inode2fid(tgt_dchild->d_inode);
+
        err = md_rename(sbi->ll_md_exp, op_data,
                        src_dchild->d_name.name,
                        src_dchild->d_name.len,