Skip to content

Commit 80f31d2

Browse files
Christoph HellwigJaegeuk Kim
authored andcommitted
f2fs: return bool from __write_node_folio
__write_node_folio can only return 0 or AOP_WRITEPAGE_ACTIVATE. As part of phasing out AOP_WRITEPAGE_ACTIVATE, switch to a bool return instead. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 0638f28 commit 80f31d2

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

fs/f2fs/node.c

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,7 +1651,7 @@ static struct folio *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino)
16511651
return last_folio;
16521652
}
16531653

1654-
static int __write_node_folio(struct folio *folio, bool atomic, bool *submitted,
1654+
static bool __write_node_folio(struct folio *folio, bool atomic, bool *submitted,
16551655
struct writeback_control *wbc, bool do_balance,
16561656
enum iostat_type io_type, unsigned int *seq_id)
16571657
{
@@ -1681,7 +1681,7 @@ static int __write_node_folio(struct folio *folio, bool atomic, bool *submitted,
16811681
folio_clear_uptodate(folio);
16821682
dec_page_count(sbi, F2FS_DIRTY_NODES);
16831683
folio_unlock(folio);
1684-
return 0;
1684+
return true;
16851685
}
16861686

16871687
if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
@@ -1707,7 +1707,7 @@ static int __write_node_folio(struct folio *folio, bool atomic, bool *submitted,
17071707
dec_page_count(sbi, F2FS_DIRTY_NODES);
17081708
f2fs_up_read(&sbi->node_write);
17091709
folio_unlock(folio);
1710-
return 0;
1710+
return true;
17111711
}
17121712

17131713
if (__is_valid_data_blkaddr(ni.blk_addr) &&
@@ -1746,11 +1746,12 @@ static int __write_node_folio(struct folio *folio, bool atomic, bool *submitted,
17461746

17471747
if (do_balance)
17481748
f2fs_balance_fs(sbi, false);
1749-
return 0;
1749+
return true;
17501750

17511751
redirty_out:
17521752
folio_redirty_for_writepage(wbc, folio);
1753-
return AOP_WRITEPAGE_ACTIVATE;
1753+
folio_unlock(folio);
1754+
return false;
17541755
}
17551756

17561757
int f2fs_move_node_folio(struct folio *node_folio, int gc_type)
@@ -1772,11 +1773,9 @@ int f2fs_move_node_folio(struct folio *node_folio, int gc_type)
17721773
goto out_page;
17731774
}
17741775

1775-
if (__write_node_folio(node_folio, false, NULL,
1776-
&wbc, false, FS_GC_NODE_IO, NULL)) {
1776+
if (!__write_node_folio(node_folio, false, NULL,
1777+
&wbc, false, FS_GC_NODE_IO, NULL))
17771778
err = -EAGAIN;
1778-
folio_unlock(node_folio);
1779-
}
17801779
goto release_page;
17811780
} else {
17821781
/* set page dirty and write it */
@@ -1871,11 +1870,10 @@ int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,
18711870
if (!folio_clear_dirty_for_io(folio))
18721871
goto continue_unlock;
18731872

1874-
if (__write_node_folio(folio, atomic &&
1873+
if (!__write_node_folio(folio, atomic &&
18751874
folio == last_folio,
18761875
&submitted, wbc, true,
18771876
FS_NODE_IO, seq_id)) {
1878-
folio_unlock(folio);
18791877
f2fs_folio_put(last_folio, false);
18801878
folio_batch_release(&fbatch);
18811879
ret = -EIO;
@@ -2078,16 +2076,15 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,
20782076
set_fsync_mark(&folio->page, 0);
20792077
set_dentry_mark(&folio->page, 0);
20802078

2081-
ret = __write_node_folio(folio, false, &submitted,
2082-
wbc, do_balance, io_type, NULL);
2083-
if (ret) {
2079+
if (!__write_node_folio(folio, false, &submitted,
2080+
wbc, do_balance, io_type, NULL)) {
20842081
folio_unlock(folio);
20852082
folio_batch_release(&fbatch);
20862083
ret = -EIO;
20872084
goto out;
2088-
} else if (submitted) {
2089-
nwritten++;
20902085
}
2086+
if (submitted)
2087+
nwritten++;
20912088

20922089
if (--wbc->nr_to_write == 0)
20932090
break;

0 commit comments

Comments
 (0)