Skip to content

Commit f58d864

Browse files
Matthew Wilcox (Oracle)Jaegeuk Kim
authored andcommitted
f2fs: Use a data folio in f2fs_submit_page_bio()
Remove a call to compound_head(). We can call bio_add_folio_nofail() here because we just allocated the bio, so we know it can't fail and thus the error path can never be taken. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 0765b3f commit f58d864

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

fs/f2fs/data.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -685,32 +685,28 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio)
685685
{
686686
struct bio *bio;
687687
struct folio *fio_folio = page_folio(fio->page);
688-
struct page *page = fio->encrypted_page ?
689-
fio->encrypted_page : fio->page;
688+
struct folio *data_folio = fio->encrypted_page ?
689+
page_folio(fio->encrypted_page) : fio_folio;
690690

691691
if (!f2fs_is_valid_blkaddr(fio->sbi, fio->new_blkaddr,
692692
fio->is_por ? META_POR : (__is_meta_io(fio) ?
693693
META_GENERIC : DATA_GENERIC_ENHANCE)))
694694
return -EFSCORRUPTED;
695695

696-
trace_f2fs_submit_folio_bio(page_folio(page), fio);
696+
trace_f2fs_submit_folio_bio(data_folio, fio);
697697

698698
/* Allocate a new bio */
699699
bio = __bio_alloc(fio, 1);
700700

701701
f2fs_set_bio_crypt_ctx(bio, fio_folio->mapping->host,
702702
fio_folio->index, fio, GFP_NOIO);
703-
704-
if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) {
705-
bio_put(bio);
706-
return -EFAULT;
707-
}
703+
bio_add_folio_nofail(bio, data_folio, folio_size(data_folio), 0);
708704

709705
if (fio->io_wbc && !is_read_io(fio->op))
710706
wbc_account_cgroup_owner(fio->io_wbc, fio_folio, PAGE_SIZE);
711707

712708
inc_page_count(fio->sbi, is_read_io(fio->op) ?
713-
__read_io_type(page) : WB_DATA_TYPE(fio->page, false));
709+
__read_io_type(&data_folio->page) : WB_DATA_TYPE(fio->page, false));
714710

715711
if (is_read_io(bio_op(bio)))
716712
f2fs_submit_read_bio(fio->sbi, bio, fio->type);

0 commit comments

Comments
 (0)