ext4: reduce one "if" comparison in ext4_dirhash()
authorCong Ding <dinggnu@gmail.com>
Sat, 2 Feb 2013 03:33:21 +0000 (22:33 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 2 Feb 2013 03:33:21 +0000 (22:33 -0500)
It is unnecessary to check i<4 after the loop; just do it before the
break.

Signed-off-by: Cong Ding <dinggnu@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/hash.c

index fa8e4911d3545cdc78b1142cf74026785daa0840..3d586f02883e604740105dd4da3a2cd99db178e3 100644 (file)
@@ -155,11 +155,11 @@ int ext4fs_dirhash(const char *name, int len, struct dx_hash_info *hinfo)
        /* Check to see if the seed is all zero's */
        if (hinfo->seed) {
                for (i = 0; i < 4; i++) {
-                       if (hinfo->seed[i])
+                       if (hinfo->seed[i]) {
+                               memcpy(buf, hinfo->seed, sizeof(buf));
                                break;
+                       }
                }
-               if (i < 4)
-                       memcpy(buf, hinfo->seed, sizeof(buf));
        }
 
        switch (hinfo->hash_version) {