summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2023-07-18 15:49:08 +0200
committerAndreas Gruenbacher <agruenba@redhat.com>2023-11-06 01:51:25 +0100
commitd6d64dac1d3967f3e951ae1cf2753181b78f2f89 (patch)
treefaebe55c4bfcf64a3fd0d74a5f8df3caad6391bf
parent4c7b3f7fb7c8c66d669d107e717f9de41ef81e92 (diff)
gfs2: Minor gfs2_write_jdata_batch PAGE_SIZE cleanup
In gfs2_write_jdata_batch(), to compute the number of blocks, compute the total size of the folio batch instead of the number of pages it contains. Not a functional change. Note that we don't currently allow mounting filesystems with a block size bigger than the page size. We could change that after converting the page cache to folios. The page cache would then only contain block-size or bigger folios, so rounding wouldn't become an issue here. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
-rw-r--r--fs/gfs2/aops.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 52fad5bcb047..494484427ee3 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -214,12 +214,12 @@ static int gfs2_write_jdata_batch(struct address_space *mapping,
unsigned nrblocks;
int i;
int ret;
- int nr_pages = 0;
+ size_t size = 0;
int nr_folios = folio_batch_count(fbatch);
for (i = 0; i < nr_folios; i++)
- nr_pages += folio_nr_pages(fbatch->folios[i]);
- nrblocks = nr_pages * (PAGE_SIZE >> inode->i_blkbits);
+ size += folio_size(fbatch->folios[i]);
+ nrblocks = size >> inode->i_blkbits;
ret = gfs2_trans_begin(sdp, nrblocks, nrblocks);
if (ret < 0)