From: wang di Date: Fri, 22 Jul 2016 02:44:05 +0000 (-0400) Subject: staging: lustre: llite: handle done flags differently in ll_dir_read X-Git-Tag: v4.9-rc1~119^2~1210 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=fee8cc87512ff3835093392656bcaa140c479709;p=karo-tx-linux.git staging: lustre: llite: handle done flags differently in ll_dir_read 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 Reviewed-on: http://review.whamcloud.com/10761 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4906 Reviewed-by: John L. Hammond Reviewed-by: Jinshan Xiong Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 48eacee82a64..e4d3176f8190 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -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); } }