Skip to content

Commit 2b02b95

Browse files
Panky-codesKent Overstreet
authored andcommitted
bcachefs: use FGP_WRITEBEGIN instead of combining individual flags
Use FGP_WRITEBEGIN to avoid repeating the individual FGP flags before starting a buffered write. Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent b0d3ab5 commit 2b02b95

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

fs/bcachefs/fs-io-buffered.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -677,9 +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,
681-
FGP_LOCK|FGP_WRITE|FGP_CREAT|FGP_STABLE,
682-
mapping_gfp_mask(mapping));
680+
folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT, FGP_WRITEBEGIN,
681+
mapping_gfp_mask(mapping));
683682
if (IS_ERR_OR_NULL(folio))
684683
goto err_unlock;
685684

@@ -820,9 +819,8 @@ static int __bch2_buffered_write(struct bch_inode_info *inode,
820819
darray_init(&fs);
821820

822821
ret = bch2_filemap_get_contig_folios_d(mapping, pos, end,
823-
FGP_LOCK|FGP_WRITE|FGP_STABLE|FGP_CREAT,
824-
mapping_gfp_mask(mapping),
825-
&fs);
822+
FGP_WRITEBEGIN,
823+
mapping_gfp_mask(mapping), &fs);
826824
if (ret)
827825
goto out;
828826

0 commit comments

Comments
 (0)