Skip to content

Commit cffaa09

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: clean up opened code w/ {get,set}_nid()
Just cleanup, no logic change. Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 296b8cb commit cffaa09

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

fs/f2fs/node.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ static int truncate_partial_nodes(struct dnode_of_data *dn,
10661066
int i;
10671067
int idx = depth - 2;
10681068

1069-
nid[0] = le32_to_cpu(ri->i_nid[offset[0] - NODE_DIR1_BLOCK]);
1069+
nid[0] = get_nid(dn->inode_page, offset[0], true);
10701070
if (!nid[0])
10711071
return 0;
10721072

@@ -1177,7 +1177,7 @@ int f2fs_truncate_inode_blocks(struct inode *inode, pgoff_t from)
11771177

11781178
skip_partial:
11791179
while (cont) {
1180-
dn.nid = le32_to_cpu(ri->i_nid[offset[0] - NODE_DIR1_BLOCK]);
1180+
dn.nid = get_nid(page, offset[0], true);
11811181
switch (offset[0]) {
11821182
case NODE_DIR1_BLOCK:
11831183
case NODE_DIR2_BLOCK:
@@ -1209,13 +1209,10 @@ int f2fs_truncate_inode_blocks(struct inode *inode, pgoff_t from)
12091209
}
12101210
if (err < 0)
12111211
goto fail;
1212-
if (offset[1] == 0 &&
1213-
ri->i_nid[offset[0] - NODE_DIR1_BLOCK]) {
1212+
if (offset[1] == 0 && get_nid(page, offset[0], true)) {
12141213
lock_page(page);
12151214
BUG_ON(page->mapping != NODE_MAPPING(sbi));
1216-
f2fs_wait_on_page_writeback(page, NODE, true, true);
1217-
ri->i_nid[offset[0] - NODE_DIR1_BLOCK] = 0;
1218-
set_page_dirty(page);
1215+
set_nid(page, offset[0], 0, true);
12191216
unlock_page(page);
12201217
}
12211218
offset[1] = 0;

0 commit comments

Comments
 (0)