Skip to content

Commit 0765b3f

Browse files
Matthew Wilcox (Oracle)Jaegeuk Kim
authored andcommitted
f2fs: Use a folio more in f2fs_submit_page_bio()
Cache the result of page_folio(fio->page) in a local variable so we don't have to keep calling it. Saves a couple of calls to compound_head() and removes an access to page->mapping. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent e082164 commit 0765b3f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/f2fs/data.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,7 @@ void f2fs_flush_merged_writes(struct f2fs_sb_info *sbi)
684684
int f2fs_submit_page_bio(struct f2fs_io_info *fio)
685685
{
686686
struct bio *bio;
687+
struct folio *fio_folio = page_folio(fio->page);
687688
struct page *page = fio->encrypted_page ?
688689
fio->encrypted_page : fio->page;
689690

@@ -697,17 +698,16 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio)
697698
/* Allocate a new bio */
698699
bio = __bio_alloc(fio, 1);
699700

700-
f2fs_set_bio_crypt_ctx(bio, fio->page->mapping->host,
701-
page_folio(fio->page)->index, fio, GFP_NOIO);
701+
f2fs_set_bio_crypt_ctx(bio, fio_folio->mapping->host,
702+
fio_folio->index, fio, GFP_NOIO);
702703

703704
if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE) {
704705
bio_put(bio);
705706
return -EFAULT;
706707
}
707708

708709
if (fio->io_wbc && !is_read_io(fio->op))
709-
wbc_account_cgroup_owner(fio->io_wbc, page_folio(fio->page),
710-
PAGE_SIZE);
710+
wbc_account_cgroup_owner(fio->io_wbc, fio_folio, PAGE_SIZE);
711711

712712
inc_page_count(fio->sbi, is_read_io(fio->op) ?
713713
__read_io_type(page) : WB_DATA_TYPE(fio->page, false));

0 commit comments

Comments
 (0)