From 946bd116c6e9f410508a186d6c93ed5cfeadb219 Mon Sep 17 00:00:00 2001 From: huanghua Date: Wed, 18 Oct 2006 16:08:10 +0000 Subject: [PATCH] more efficient checking of zero-length string. --- lustre/mdt/mdt_handler.c | 2 +- lustre/mdt/mdt_reint.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 4d395e9..ca6ecca 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -644,7 +644,7 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info, RETURN(rc); } - if (strlen(name) == 0) { + if (name[0] == 0) { /* strlen(name) == 0 */ /* Only getattr on the child. Parent is on another node. */ mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_POS); child = parent; diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index 0addab2..da49c6b 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -315,7 +315,7 @@ static int mdt_reint_create(struct mdt_thread_info *info, switch (info->mti_attr.ma_attr.la_mode & S_IFMT) { case S_IFREG: case S_IFDIR:{ - if (strlen(info->mti_rr.rr_name) == 0) { + if (info->mti_rr.rr_name[0] == 0) { rc = mdt_md_mkobj(info); break; } @@ -388,7 +388,7 @@ static int mdt_reint_unlink(struct mdt_thread_info *info, if (!ma->ma_lmm || !ma->ma_cookie) GOTO(out_unlock_parent, rc = -EINVAL); - if (strlen(rr->rr_name) == 0) { + if (rr->rr_name[0] == 0) { /* remote partial operation * It is possible that replay can happen on parent MDS * and this operation will be repeated. -- 1.8.3.1