public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peng Tao <bergwolf@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
	Andrew Perepechko <andrew_perepechko@xyratex.com>,
	Peng Tao <bergwolf@gmail.com>,
	Andreas Dilger <andreas.dilger@intel.com>
Subject: [PATCH 08/26] staging/lustre/llite: speedup in unlink/rmdir
Date: Fri, 15 Nov 2013 00:42:55 +0800	[thread overview]
Message-ID: <1384447393-13838-9-git-send-email-bergwolf@gmail.com> (raw)
In-Reply-To: <1384447393-13838-1-git-send-email-bergwolf@gmail.com>

From: Andrew Perepechko <andrew_perepechko@xyratex.com>

Assume dchild argument is fully initialized in ->unlink and
->rmdir callbacks, so additional lookup for ELC is not needed.

Lustre-change: http://review.whamcloud.com/6648
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3473
Reviewed-by: Alexander Boyko <Alexander_Boyko@xyratex.com>
Reviewed-by: Vitaly Fertman <Vitaly_Fertman@xyratex.com>
Signed-off-by: Andrew Perepechko <andrew_perepechko@xyratex.com>
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: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
---
 drivers/staging/lustre/lustre/llite/namei.c |   30 +++++++++------------------
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c
index 3cfd34d..46b9ca8 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -942,22 +942,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)
 {
@@ -976,7 +960,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);
@@ -1117,7 +1102,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);
@@ -1157,8 +1144,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);
-- 
1.7.9.5


  parent reply	other threads:[~2013-11-14 16:49 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14 16:42 [PATCH 00/26] staging/lustre: patch bomb 3 Peng Tao
2013-11-14 16:42 ` [PATCH 01/26] staging/lustre/hsm: handle file ownership and timestamps Peng Tao
2013-11-14 16:42 ` [PATCH 02/26] staging/lustre/build: fix race issues thanks to oap_lock Peng Tao
2013-11-14 16:42 ` [PATCH 03/26] staging/lustre/clio: incorrect assertions in 'enable-invariants' Peng Tao
2013-11-14 16:42 ` [PATCH 04/26] staging/lustre/ldlm: Fix a race during FLock handling Peng Tao
2013-11-14 16:42 ` [PATCH 05/26] staging/lustre/dcache: Unsafe error handling arnd ll_splice_alias Peng Tao
2013-11-14 16:42 ` [PATCH 06/26] staging/lustre/build: fix 'NULL pointer dereference' errors Peng Tao
2013-11-14 16:42 ` [PATCH 07/26] staging/lustre/ldlm: refine LU-2665 patch for POSIX compliance Peng Tao
2013-11-14 16:42 ` Peng Tao [this message]
2013-11-14 16:42 ` [PATCH 09/26] staging/lustre/llite: error setting max_cache_mb at mount time Peng Tao
2013-11-14 16:42 ` [PATCH 10/26] staging/lustre/ldlm: MDT mount fails on MDS w/o MGS on it Peng Tao
2013-11-14 16:42 ` [PATCH 11/26] staging/lustre/ptlrpc: Return a meaningful status from ptlrpcd_init() Peng Tao
2013-11-14 16:42 ` [PATCH 12/26] staging/lustre/ldlm: Fix flock detection for different mounts Peng Tao
2013-11-14 16:43 ` [PATCH 13/26] staging/lustre/nrs: Fix a race condition in the ORR policy Peng Tao
2013-11-14 16:43 ` [PATCH 14/26] staging/lustre/ptlrpc: skip rpcs that fail ptl_send_rpc Peng Tao
2013-11-14 16:43 ` [PATCH 15/26] staging/lustre/llite: Truncate to restore file Peng Tao
2013-11-14 16:43 ` [PATCH 16/26] staging/lustre/lov: avoid subobj's coh_parent race Peng Tao
2013-11-14 16:43 ` [PATCH 17/26] staging/lustre/changelogs: Correct KUC code max changelog msg size Peng Tao
2013-11-14 16:43 ` [PATCH 18/26] staging/lustre/scrub: support dryrun mode OI scrub Peng Tao
2013-11-14 16:43 ` [PATCH 19/26] staging/lustre/mdt: return EXDEV for cross-MDT rename Peng Tao
2013-11-14 16:43 ` [PATCH 20/26] staging/lustre/hsm: reprocess LDLM resource in mdt_hsm_release() Peng Tao
2013-11-14 16:43 ` [PATCH 21/26] staging/lustre/clio: Do not shrink sublock at cancel Peng Tao
2013-11-14 16:43 ` [PATCH 22/26] staging/lustre/osc: osc_extent_wait() shouldn't be interruptible Peng Tao
2013-11-14 16:43 ` [PATCH 23/26] staging/lustre/seq: make seq_proc_write_common() safer Peng Tao
2013-11-14 16:43 ` [PATCH 24/26] staging/lustre/lprocfs: implement log2 using bitops Peng Tao
2013-11-14 16:43 ` [PATCH 25/26] staging/lustre/autoconf: remove quota_on/quota_off checks Peng Tao
2013-11-14 16:43 ` [PATCH 26/26] staging/lustre/autoconf: remove LC_BI_HW_SEGMENTS test Peng Tao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1384447393-13838-9-git-send-email-bergwolf@gmail.com \
    --to=bergwolf@gmail.com \
    --cc=andreas.dilger@intel.com \
    --cc=andrew_perepechko@xyratex.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox