From: Andrew Perepechko Date: Fri, 14 Jun 2013 10:40:01 +0000 (+0400) Subject: LU-3473 llite: speedup in unlink/rmdir X-Git-Tag: 2.4.93~49 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=b117c34421890de18afcf23f29bdb4077acc5568 LU-3473 llite: speedup in unlink/rmdir Assume dchild argument is fully initialized in ->unlink and ->rmdir callbacks, so additional lookup for ELC is not needed. Reviewed-by: Alexander Boyko Reviewed-by: Vitaly Fertman Xyratex-bug-id: MRP-1027 Signed-off-by: Andrew Perepechko Change-Id: I984cc8260f8fb5be1f09938b2b38399636c2acd9 Reviewed-on: http://review.whamcloud.com/6648 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index c01e2e4..aaf864b 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -1096,22 +1096,6 @@ static int ll_mkdir_generic(struct inode *dir, struct qstr *name, RETURN(err); } -/* Try to find the child dentry by its name. - If found, put the result fid into @fid. */ -static void ll_get_child_fid(struct inode * dir, struct qstr *name, - struct lu_fid *fid) -{ - struct dentry *parent, *child; - - parent = ll_d_hlist_entry(dir->i_dentry, struct dentry, d_alias); - child = d_lookup(parent, name); - if (child) { - if (child->d_inode) - *fid = *ll_inode2fid(child->d_inode); - dput(child); - } -} - static int ll_rmdir_generic(struct inode *dir, struct dentry *dparent, struct dentry *dchild, struct qstr *name) { @@ -1131,7 +1115,8 @@ static int ll_rmdir_generic(struct inode *dir, struct dentry *dparent, if (IS_ERR(op_data)) RETURN(PTR_ERR(op_data)); - ll_get_child_fid(dir, name, &op_data->op_fid3); + if (dchild != NULL && dchild->d_inode != NULL) + 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); @@ -1275,7 +1260,9 @@ static int ll_unlink_generic(struct inode *dir, struct dentry *dparent, if (IS_ERR(op_data)) RETURN(PTR_ERR(op_data)); - ll_get_child_fid(dir, name, &op_data->op_fid3); + if (dchild != NULL && dchild->d_inode != NULL) + 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); @@ -1315,8 +1302,11 @@ static int ll_rename_generic(struct inode *src, struct dentry *src_dparent, if (IS_ERR(op_data)) RETURN(PTR_ERR(op_data)); - ll_get_child_fid(src, src_name, &op_data->op_fid3); - ll_get_child_fid(tgt, tgt_name, &op_data->op_fid4); + if (src_dchild != NULL && src_dchild->d_inode != NULL) + op_data->op_fid3 = *ll_inode2fid(src_dchild->d_inode); + if (tgt_dchild != NULL && tgt_dchild->d_inode != NULL) + op_data->op_fid4 = *ll_inode2fid(tgt_dchild->d_inode); + err = md_rename(sbi->ll_md_exp, op_data, src_name->name, src_name->len, tgt_name->name, tgt_name->len, &request);