Skip to content

Commit 432acd5

Browse files
Christoph Hellwigbrauner
authored andcommitted
iomap: move the io_folios field out of struct iomap_ioend
The io_folios member in struct iomap_ioend counts the number of folios added to an ioend. It is only used at submission time and can thus be moved to iomap_writepage_ctx instead. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20231207072710.176093-4-hch@lst.de Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 80d012e commit 432acd5

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

fs/iomap/buffered-io.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,10 +1675,11 @@ iomap_alloc_ioend(struct inode *inode, struct iomap_writepage_ctx *wpc,
16751675
ioend->io_flags = wpc->iomap.flags;
16761676
ioend->io_inode = inode;
16771677
ioend->io_size = 0;
1678-
ioend->io_folios = 0;
16791678
ioend->io_offset = offset;
16801679
ioend->io_bio = bio;
16811680
ioend->io_sector = sector;
1681+
1682+
wpc->nr_folios = 0;
16821683
return ioend;
16831684
}
16841685

@@ -1722,7 +1723,7 @@ iomap_can_add_to_ioend(struct iomap_writepage_ctx *wpc, loff_t offset,
17221723
* also prevents long tight loops ending page writeback on all the
17231724
* folios in the ioend.
17241725
*/
1725-
if (wpc->ioend->io_folios >= IOEND_BATCH_SIZE)
1726+
if (wpc->nr_folios >= IOEND_BATCH_SIZE)
17261727
return false;
17271728
return true;
17281729
}
@@ -1819,7 +1820,7 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc,
18191820
count++;
18201821
}
18211822
if (count)
1822-
wpc->ioend->io_folios++;
1823+
wpc->nr_folios++;
18231824

18241825
WARN_ON_ONCE(!wpc->ioend && !list_empty(&submit_list));
18251826
WARN_ON_ONCE(!folio_test_locked(folio));

include/linux/iomap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@ struct iomap_ioend {
293293
struct list_head io_list; /* next ioend in chain */
294294
u16 io_type;
295295
u16 io_flags; /* IOMAP_F_* */
296-
u32 io_folios; /* folios added to ioend */
297296
struct inode *io_inode; /* file being written to */
298297
size_t io_size; /* size of the extent */
299298
loff_t io_offset; /* offset in the file */
@@ -329,6 +328,7 @@ struct iomap_writepage_ctx {
329328
struct iomap iomap;
330329
struct iomap_ioend *ioend;
331330
const struct iomap_writeback_ops *ops;
331+
u32 nr_folios; /* folios added to the ioend */
332332
};
333333

334334
void iomap_finish_ioends(struct iomap_ioend *ioend, int error);

0 commit comments

Comments
 (0)