Skip to content

Commit d6d64da

Browse files
author
Andreas Gruenbacher
committed
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>
1 parent 4c7b3f7 commit d6d64da

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

fs/gfs2/aops.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,12 @@ static int gfs2_write_jdata_batch(struct address_space *mapping,
214214
unsigned nrblocks;
215215
int i;
216216
int ret;
217-
int nr_pages = 0;
217+
size_t size = 0;
218218
int nr_folios = folio_batch_count(fbatch);
219219

220220
for (i = 0; i < nr_folios; i++)
221-
nr_pages += folio_nr_pages(fbatch->folios[i]);
222-
nrblocks = nr_pages * (PAGE_SIZE >> inode->i_blkbits);
221+
size += folio_size(fbatch->folios[i]);
222+
nrblocks = size >> inode->i_blkbits;
223223

224224
ret = gfs2_trans_begin(sdp, nrblocks, nrblocks);
225225
if (ret < 0)

0 commit comments

Comments
 (0)