Skip to content

Commit 28b68b2

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: clean up w/ bio_add_folio_nofail()
In add_bio_entry(), adding a page to newly allocated bio should never fail, let's use bio_add_folio_nofail() instead of bio_add_page() & unnecessary error handling for cleanup. Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 2308de2 commit 28b68b2

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

fs/f2fs/data.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ static bool io_is_mergeable(struct f2fs_sb_info *sbi, struct bio *bio,
752752
}
753753

754754
static void add_bio_entry(struct f2fs_sb_info *sbi, struct bio *bio,
755-
struct page *page, enum temp_type temp)
755+
struct folio *folio, enum temp_type temp)
756756
{
757757
struct f2fs_bio_info *io = sbi->write_io[DATA] + temp;
758758
struct bio_entry *be;
@@ -761,8 +761,7 @@ static void add_bio_entry(struct f2fs_sb_info *sbi, struct bio *bio,
761761
be->bio = bio;
762762
bio_get(bio);
763763

764-
if (bio_add_page(bio, page, PAGE_SIZE, 0) != PAGE_SIZE)
765-
f2fs_bug_on(sbi, 1);
764+
bio_add_folio_nofail(bio, folio, folio_size(folio), 0);
766765

767766
f2fs_down_write(&io->bio_list_lock);
768767
list_add_tail(&be->list, &io->bio_list);
@@ -904,7 +903,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio)
904903
f2fs_set_bio_crypt_ctx(bio, folio->mapping->host,
905904
folio->index, fio, GFP_NOIO);
906905

907-
add_bio_entry(fio->sbi, bio, &data_folio->page, fio->temp);
906+
add_bio_entry(fio->sbi, bio, data_folio, fio->temp);
908907
} else {
909908
if (add_ipu_page(fio, &bio, &data_folio->page))
910909
goto alloc_new;

0 commit comments

Comments
 (0)