Whamcloud - gitweb
more efficient checking of zero-length string.
authorhuanghua <huanghua>
Wed, 18 Oct 2006 16:08:10 +0000 (16:08 +0000)
committerhuanghua <huanghua>
Wed, 18 Oct 2006 16:08:10 +0000 (16:08 +0000)
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_reint.c

index 4d395e9..ca6ecca 100644 (file)
@@ -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;
index 0addab2..da49c6b 100644 (file)
@@ -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.