]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bcachefs: use FGP_WRITEBEGIN instead of combining individual flags
authorPankaj Raghav <p.raghav@samsung.com>
Fri, 14 Jun 2024 10:50:30 +0000 (10:50 +0000)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 14 Jul 2024 23:00:15 +0000 (19:00 -0400)
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>
fs/bcachefs/fs-io-buffered.c

index 54873ecc635cb03176feb921badda3229ed525fd..865691dd0173e7b2b27a215ceff79ed3175b9d32 100644 (file)
@@ -677,9 +677,8 @@ int bch2_write_begin(struct file *file, struct address_space *mapping,
 
        bch2_pagecache_add_get(inode);
 
-       folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT,
-                               FGP_LOCK|FGP_WRITE|FGP_CREAT|FGP_STABLE,
-                               mapping_gfp_mask(mapping));
+       folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT, FGP_WRITEBEGIN,
+                                   mapping_gfp_mask(mapping));
        if (IS_ERR_OR_NULL(folio))
                goto err_unlock;
 
@@ -820,9 +819,8 @@ static int __bch2_buffered_write(struct bch_inode_info *inode,
        darray_init(&fs);
 
        ret = bch2_filemap_get_contig_folios_d(mapping, pos, end,
-                                  FGP_LOCK|FGP_WRITE|FGP_STABLE|FGP_CREAT,
-                                  mapping_gfp_mask(mapping),
-                                  &fs);
+                                              FGP_WRITEBEGIN,
+                                              mapping_gfp_mask(mapping), &fs);
        if (ret)
                goto out;