Skip to content

Commit febc33c

Browse files
Panky-codesKent Overstreet
authored andcommitted
bcachefs: set fgf order hint before starting a buffered write
Set the preferred folio order in the fgp_flags by calling fgf_set_order(). Page cache will try to allocate large folio of the preferred order whenever possible instead of allocating multiple 0 order folios. This improves the buffered write performance up to 1.25x with default mount options and up to 1.57x when mounted with no_data_io option with the following fio workload: fio --name=bcachefs --filename=/mnt/test --size=100G \ --ioengine=io_uring --iodepth=16 --rw=write --bs=128k Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 2b02b95 commit febc33c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

fs/bcachefs/fs-io-buffered.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,8 @@ int bch2_write_begin(struct file *file, struct address_space *mapping,
677677

678678
bch2_pagecache_add_get(inode);
679679

680-
folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT, FGP_WRITEBEGIN,
680+
folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT,
681+
FGP_WRITEBEGIN | fgf_set_order(len),
681682
mapping_gfp_mask(mapping));
682683
if (IS_ERR_OR_NULL(folio))
683684
goto err_unlock;
@@ -819,7 +820,7 @@ static int __bch2_buffered_write(struct bch_inode_info *inode,
819820
darray_init(&fs);
820821

821822
ret = bch2_filemap_get_contig_folios_d(mapping, pos, end,
822-
FGP_WRITEBEGIN,
823+
FGP_WRITEBEGIN | fgf_set_order(len),
823824
mapping_gfp_mask(mapping), &fs);
824825
if (ret)
825826
goto out;

0 commit comments

Comments
 (0)