staging: lustre: llite: set next only when needed in ll_dir_read
authorwang di <di.wang@intel.com>
Fri, 22 Jul 2016 02:44:04 +0000 (22:44 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Aug 2016 16:31:06 +0000 (18:31 +0200)
The variable next needs only to be set when done is false.

Signed-off-by: wang di <di.wang@intel.com>
Reviewed-on: http://review.whamcloud.com/10761
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4906
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/llite/dir.c

index 77fadf1d27701153d052185766cbfe3c9311e8e9..48eacee82a64473492694807760c9e3847a369ee 100644 (file)
@@ -561,8 +561,9 @@ int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
                        done = !dir_emit(ctx, ent->lde_name,
                                         namelen, ino, type);
                }
-               next = le64_to_cpu(dp->ldp_hash_end);
+
                if (!done) {
+                       next = le64_to_cpu(dp->ldp_hash_end);
                        pos = next;
                        if (pos == MDS_DIR_END_OFF) {
                                /*