aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2024-11-28 04:58:22 +0000
committerJaegeuk Kim <jaegeuk@kernel.org>2024-12-16 16:12:13 +0000
commite0821645dd2d79180418dd9389e3e9e7e10e7281 (patch)
treee1c1b7c3acba8c128f12ee1eef90c141ad79a179
parentf2fs: Add F2FS_F_SB() (diff)
downloadwireguard-linux-e0821645dd2d79180418dd9389e3e9e7e10e7281.tar.xz
wireguard-linux-e0821645dd2d79180418dd9389e3e9e7e10e7281.zip
f2fs: Convert f2fs_finish_read_bio() to use folios
Use bio_for_each_folio_all() to iterate over each folio in the bio. This lets us use folio_end_read() which saves an atomic operation and memory barrier compared to marking the folio uptodate and unlocking it as two separate operations. This also removes a few hidden calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/data.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 7cb2272c723e..aa08ab387e58 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -136,27 +136,22 @@ struct bio_post_read_ctx {
*/
static void f2fs_finish_read_bio(struct bio *bio, bool in_task)
{
- struct bio_vec *bv;
- struct bvec_iter_all iter_all;
+ struct folio_iter fi;
struct bio_post_read_ctx *ctx = bio->bi_private;
- bio_for_each_segment_all(bv, bio, iter_all) {
- struct page *page = bv->bv_page;
+ bio_for_each_folio_all(fi, bio) {
+ struct folio *folio = fi.folio;
- if (f2fs_is_compressed_page(page)) {
+ if (f2fs_is_compressed_page(&folio->page)) {
if (ctx && !ctx->decompression_attempted)
- f2fs_end_read_compressed_page(page, true, 0,
+ f2fs_end_read_compressed_page(&folio->page, true, 0,
in_task);
- f2fs_put_page_dic(page, in_task);
+ f2fs_put_page_dic(&folio->page, in_task);
continue;
}
- if (bio->bi_status)
- ClearPageUptodate(page);
- else
- SetPageUptodate(page);
- dec_page_count(F2FS_P_SB(page), __read_io_type(page));
- unlock_page(page);
+ dec_page_count(F2FS_F_SB(folio), __read_io_type(&folio->page));
+ folio_end_read(folio, bio->bi_status == 0);
}
if (ctx)