From: Yunlei He <heyunlei@huawei.com>
To: jaegeuk@kernel.org, yuchao0@huawei.com,
linux-f2fs-devel@lists.sourceforge.net
Cc: heyunlei@huawei.com
Subject: [PATCH v2] f2fs: rebuild get_node_path function
Date: Thu, 22 Mar 2018 11:31:42 +0800 [thread overview]
Message-ID: <1521689502-6040-1-git-send-email-heyunlei@huawei.com> (raw)
This patch rebuild get_node_path function, no logic changes.
v1->v2: '<' has higher priority than '-='
Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
fs/f2fs/node.c | 28 ++++++----------------------
1 file changed, 6 insertions(+), 22 deletions(-)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index c511ef6..b8f2577 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -526,46 +526,31 @@ static int get_node_path(struct inode *inode, long block,
if (block < direct_index) {
offset[n] = block;
- goto got;
- }
- block -= direct_index;
- if (block < direct_blks) {
+ } else if ((block -= direct_index) < direct_blks) {
offset[n++] = NODE_DIR1_BLOCK;
noffset[n] = 1;
offset[n] = block;
level = 1;
- goto got;
- }
- block -= direct_blks;
- if (block < direct_blks) {
+ } else if ((block -= direct_blks) < direct_blks) {
offset[n++] = NODE_DIR2_BLOCK;
noffset[n] = 2;
offset[n] = block;
level = 1;
- goto got;
- }
- block -= direct_blks;
- if (block < indirect_blks) {
+ } else if ((block -= direct_blks) < indirect_blks) {
offset[n++] = NODE_IND1_BLOCK;
noffset[n] = 3;
offset[n++] = block / direct_blks;
noffset[n] = 4 + offset[n - 1];
offset[n] = block % direct_blks;
level = 2;
- goto got;
- }
- block -= indirect_blks;
- if (block < indirect_blks) {
+ } else if ((block -= indirect_blks) < indirect_blks) {
offset[n++] = NODE_IND2_BLOCK;
noffset[n] = 4 + dptrs_per_blk;
offset[n++] = block / direct_blks;
noffset[n] = 5 + dptrs_per_blk + offset[n - 1];
offset[n] = block % direct_blks;
level = 2;
- goto got;
- }
- block -= indirect_blks;
- if (block < dindirect_blks) {
+ } else if ((block -= indirect_blks) < dindirect_blks) {
offset[n++] = NODE_DIND_BLOCK;
noffset[n] = 5 + (dptrs_per_blk * 2);
offset[n++] = block / indirect_blks;
@@ -577,11 +562,10 @@ static int get_node_path(struct inode *inode, long block,
offset[n - 1];
offset[n] = block % direct_blks;
level = 3;
- goto got;
} else {
return -E2BIG;
}
-got:
+
return level;
}
--
1.9.1
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
next reply other threads:[~2018-03-22 3:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-22 3:31 Yunlei He [this message]
2018-03-28 1:41 ` [PATCH v2] f2fs: rebuild get_node_path function Chao Yu
2018-03-28 1:46 ` heyunlei
2018-03-28 2:13 ` Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1521689502-6040-1-git-send-email-heyunlei@huawei.com \
--to=heyunlei@huawei.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=yuchao0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).