[PATCH v2 1/2] bcachefs: use FGP_WRITEBEGIN instead of combining individual flags

Pankaj Raghav (Samsung) posted 2 patches 1 year, 6 months ago
[PATCH v2 1/2] bcachefs: use FGP_WRITEBEGIN instead of combining individual flags
Posted by Pankaj Raghav (Samsung) 1 year, 6 months ago
From: Pankaj Raghav <p.raghav@samsung.com>

Use FGP_WRITEBEGIN to avoid repeating the individual FGP flags before
starting a buffered write.

Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
---
 fs/bcachefs/fs-io-buffered.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/bcachefs/fs-io-buffered.c b/fs/bcachefs/fs-io-buffered.c
index 54873ecc635c..3c9a5a8edd1e 100644
--- a/fs/bcachefs/fs-io-buffered.c
+++ b/fs/bcachefs/fs-io-buffered.c
@@ -678,7 +678,7 @@ 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,
+				FGP_WRITEBEGIN,
 				mapping_gfp_mask(mapping));
 	if (IS_ERR_OR_NULL(folio))
 		goto err_unlock;
@@ -820,7 +820,7 @@ 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,
+				   FGP_WRITEBEGIN,
 				   mapping_gfp_mask(mapping),
 				   &fs);
 	if (ret)
-- 
2.44.1