aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/writeback.h
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2024-02-15 07:36:43 +0100
committerAndrew Morton <akpm@linux-foundation.org>2024-02-23 17:48:36 -0800
commit751e0d559c62a87dc828af22c3c58dc078c734e3 (patch)
tree532b088cc1f4e64212b9ffdb389e35efc2a254d7 /include/linux/writeback.h
parentwriteback: factor folio_prepare_writeback() out of write_cache_pages() (diff)
downloadwireguard-linux-751e0d559c62a87dc828af22c3c58dc078c734e3.tar.xz
wireguard-linux-751e0d559c62a87dc828af22c3c58dc078c734e3.zip
writeback: factor writeback_get_batch() out of write_cache_pages()
This simple helper will be the basis of the writeback iterator. To make this work, we need to remember the current index and end positions in writeback_control. [hch@lst.de: heavily rebased, add helpers to get the tag and end index, don't keep the end index in struct writeback_control] Link: https://lkml.kernel.org/r/20240215063649.2164017-9-hch@lst.de Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Jan Kara <jack@suse.cz> Acked-by: Dave Chinner <dchinner@redhat.com> Cc: Christian Brauner <brauner@kernel.org> Cc: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include/linux/writeback.h')
-rw-r--r--include/linux/writeback.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 4b8cf9e4810b..f67b3ea866a0 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -11,6 +11,7 @@
#include <linux/flex_proportions.h>
#include <linux/backing-dev-defs.h>
#include <linux/blk_types.h>
+#include <linux/pagevec.h>
struct bio;
@@ -40,6 +41,7 @@ enum writeback_sync_modes {
* in a manner such that unspecified fields are set to zero.
*/
struct writeback_control {
+ /* public fields that can be set and/or consumed by the caller: */
long nr_to_write; /* Write this many pages, and decrement
this for each page written */
long pages_skipped; /* Pages which were not written */
@@ -77,6 +79,10 @@ struct writeback_control {
*/
struct swap_iocb **swap_plug;
+ /* internal fields used by the ->writepages implementation: */
+ struct folio_batch fbatch;
+ pgoff_t index;
+
#ifdef CONFIG_CGROUP_WRITEBACK
struct bdi_writeback *wb; /* wb this writeback is issued under */
struct inode *inode; /* inode being written out */