staging: lustre: llite: handle done flags differently in ll_dir_read
authorwang di <di.wang@intel.com>
Fri, 22 Jul 2016 02:44:05 +0000 (22:44 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Aug 2016 16:31:06 +0000 (18:31 +0200)
Invert the done flag test to reduce the code indentation.
If done is true release the page and break out of the
while loop.

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: Jinshan Xiong <jinshan.xiong@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 48eacee82a64473492694807760c9e3847a369ee..e4d3176f819063ef1a41155583a633327c276090 100644 (file)
@@ -562,37 +562,38 @@ int ll_dir_read(struct inode *inode, struct md_op_data *op_data,
                                         namelen, ino, type);
                }
 
-               if (!done) {
-                       next = le64_to_cpu(dp->ldp_hash_end);
-                       pos = next;
-                       if (pos == MDS_DIR_END_OFF) {
-                               /*
-                                * End of directory reached.
-                                */
-                               done = 1;
-                               ll_release_page(page, 0);
-                       } else if (1 /* chain is exhausted*/) {
-                               /*
-                                * Normal case: continue to the next
-                                * page.
-                                */
-                               ll_release_page(page,
-                                               le32_to_cpu(dp->ldp_flags) &
-                                               LDF_COLLIDE);
-                               next = pos;
-                               page = ll_get_dir_page(inode, pos,
-                                                      &chain);
-                       } else {
-                               /*
-                                * go into overflow page.
-                                */
-                               LASSERT(le32_to_cpu(dp->ldp_flags) &
-                                       LDF_COLLIDE);
-                               ll_release_page(page, 1);
-                       }
-               } else {
+               if (done) {
                        pos = hash;
                        ll_release_page(page, 0);
+                       break;
+               }
+
+               next = le64_to_cpu(dp->ldp_hash_end);
+               pos = next;
+               if (pos == MDS_DIR_END_OFF) {
+                       /*
+                        * End of directory reached.
+                        */
+                       done = 1;
+                       ll_release_page(page, 0);
+               } else if (1 /* chain is exhausted*/) {
+                       /*
+                        * Normal case: continue to the next
+                        * page.
+                        */
+                       ll_release_page(page,
+                                       le32_to_cpu(dp->ldp_flags) &
+                                       LDF_COLLIDE);
+                       next = pos;
+                       page = ll_get_dir_page(inode, pos,
+                                              &chain);
+               } else {
+                       /*
+                        * go into overflow page.
+                        */
+                       LASSERT(le32_to_cpu(dp->ldp_flags) &
+                               LDF_COLLIDE);
+                       ll_release_page(page, 1);
                }
        }