summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2026-11-05 15:53:00 +0100
committerChristian Brauner <brauner@kernel.org>2026-11-05 15:53:00 +0100
commitd2bf796905dfc706cbbb180b59f77d68aa9af7ac (patch)
tree7989bc47908d8c0460d7aedbf62232d5c28d84b5 /include
parent66a52b662e5c09c7e784d2656e0b7ab14b396a8f (diff)
parent5612225809c78959c888fa7066bdfdf46b8aee45 (diff)
Merge patch series "iomap: remaining patches for iomap_iter_next conversion"
Joanne Koong <joannelkoong@gmail.com> says: This is a resend of the last 3 patches from the "iomap: convert to in-iter iomap_next() model" patch series [1]. Those 3 patches are rebased on top of current mainline (commit 83f32c773255 ("Merge tag 'erofs-for-7.4-rc1-2' ...")) in Linus's tree. They require two new preparatory patches (patches 1 and 2 in this series), which are trivial ->iomap_next() conversions of the nilfs2 and fuse iomap code that was added during this merge window. There were conflicts with "iomap: pass iomap_iter_next_fn directly instead of struct iomap_ops" (patch 4 in this series) during the rebase. These are resolved in the patch, which now also converts the iomap users added this merge window (ext4 iomap buffered I/O, exfat swap activation, nilfs2, and fuse ext_map). Jan's Acked-by and Christoph's Reviewed-by on it predate these changes. These patches are being sent out now in case anyone wants to look at the preparatory patches or patch 4. This series applies cleanly to both current mainline and next-20261027. If anything conflicts by the time you pick it up at the end of the merge window, I'll rebase and resend. [1] https://lore.kernel.org/linux-fsdevel/20260729192737.3190206-1-joannelkoong@gmail.com/ * patches from https://patch.msgid.link/20261027215326.2693300-1-joannelkoong@gmail.com: Documentation: iomap: update docs to reflect iomap_iter_next model iomap: pass iomap_iter_next_fn directly instead of struct iomap_ops iomap: remove ->iomap_begin()/->iomap_end() legacy path fuse: convert ext_map iomap ops to ->iomap_next() nilfs2: convert iomap ops to ->iomap_next() Link: https://patch.msgid.link/20261027215326.2693300-1-joannelkoong@gmail.com Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/dax.h18
-rw-r--r--include/linux/fs.h7
-rw-r--r--include/linux/iomap.h66
3 files changed, 47 insertions, 44 deletions
diff --git a/include/linux/dax.h b/include/linux/dax.h
index a3af0c63c61b..2e0797e4d408 100644
--- a/include/linux/dax.h
+++ b/include/linux/dax.h
@@ -3,6 +3,7 @@
#define _LINUX_DAX_H
#include <linux/fs.h>
+#include <linux/iomap.h>
#include <linux/mm.h>
#include <linux/radix-tree.h>
@@ -10,9 +11,6 @@ typedef unsigned long dax_entry_t;
struct dax_device;
struct gendisk;
-struct iomap_ops;
-struct iomap_iter;
-struct iomap;
enum dax_access_mode {
DAX_ACCESS,
@@ -200,11 +198,11 @@ static inline void dax_unlock_mapping_entry(struct address_space *mapping,
#endif
int dax_file_unshare(struct inode *inode, loff_t pos, loff_t len,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
int dax_zero_range(struct inode *inode, loff_t pos, loff_t len, bool *did_zero,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
int dax_truncate_page(struct inode *inode, loff_t pos, bool *did_zero,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
static inline bool dax_page_is_idle(struct page *page)
{
@@ -253,10 +251,10 @@ int dax_holder_notify_failure(struct dax_device *dax_dev, u64 off, u64 len,
void dax_flush(struct dax_device *dax_dev, void *addr, size_t size);
ssize_t dax_iomap_rw(struct kiocb *iocb, struct iov_iter *iter,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
vm_fault_t dax_iomap_fault(struct vm_fault *vmf, unsigned int order,
unsigned long *pfnp, int *errp,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
vm_fault_t dax_finish_sync_fault(struct vm_fault *vmf,
unsigned int order, unsigned long pfn);
int dax_delete_mapping_entry(struct address_space *mapping, pgoff_t index);
@@ -275,11 +273,11 @@ void dax_break_layout_final(struct inode *inode);
int dax_dedupe_file_range_compare(struct inode *src, loff_t srcoff,
struct inode *dest, loff_t destoff,
loff_t len, bool *is_same,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
int dax_remap_file_range_prep(struct file *file_in, loff_t pos_in,
struct file *file_out, loff_t pos_out,
loff_t *len, unsigned int remap_flags,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
static inline bool dax_mapping(struct address_space *mapping)
{
return mapping->host && IS_DAX(mapping->host);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index acea6c40caaa..5b3a100aba77 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -70,7 +70,8 @@ struct fsnotify_mark_connector;
struct fs_context;
struct fs_parameter_spec;
struct file_kattr;
-struct iomap_ops;
+struct iomap_iter;
+struct iomap;
struct delegated_inode;
extern void __init inode_init(void);
@@ -2083,7 +2084,9 @@ int remap_verify_area(struct file *file, loff_t pos, loff_t len, bool write);
int __generic_remap_file_range_prep(struct file *file_in, loff_t pos_in,
struct file *file_out, loff_t pos_out,
loff_t *len, unsigned int remap_flags,
- const struct iomap_ops *dax_read_ops);
+ int (*dax_read_next)(const struct iomap_iter *iter,
+ struct iomap *iomap,
+ struct iomap *srcmap));
int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in,
struct file *file_out, loff_t pos_out,
loff_t *count, unsigned int remap_flags);
diff --git a/include/linux/iomap.h b/include/linux/iomap.h
index 5254430844b2..78a1b7603a4f 100644
--- a/include/linux/iomap.h
+++ b/include/linux/iomap.h
@@ -195,7 +195,7 @@ struct iomap_write_ops {
};
/*
- * Flags for iomap_begin / iomap_end. No flag implies a read.
+ * Flags for iomap_next. No flag implies a read.
*/
#define IOMAP_WRITE (1 << 0) /* writing, must allocate blocks */
#define IOMAP_ZERO (1 << 1) /* zeroing operation, may skip holes */
@@ -239,12 +239,6 @@ typedef int (*iomap_iter_end_fn)(struct inode *inode, loff_t pos, loff_t length,
typedef int (*iomap_iter_next_fn)(const struct iomap_iter *iter,
struct iomap *iomap, struct iomap *srcmap);
-struct iomap_ops {
- iomap_iter_begin_fn iomap_begin;
- iomap_iter_end_fn iomap_end;
- iomap_iter_next_fn iomap_next;
-};
-
/**
* struct iomap_iter - Iterate through a range of a file
* @inode: Set at the start of the iteration and should not change.
@@ -256,7 +250,7 @@ struct iomap_ops {
* incremental iter advance.
* @status: Status of the most recent iteration. Zero on success or a negative
* errno on error.
- * @flags: Zero or more of the iomap_begin flags above.
+ * @flags: Zero or more of the iomap_iter_next flags above.
* @iomap: Map describing the I/O iteration
* @srcmap: Source map for COW operations
*/
@@ -273,7 +267,7 @@ struct iomap_iter {
void *private;
};
-int iomap_iter(struct iomap_iter *iter, const struct iomap_ops *ops);
+int iomap_iter(struct iomap_iter *iter, iomap_iter_next_fn next);
int iomap_iter_advance(struct iomap_iter *iter, u64 count);
/**
@@ -341,7 +335,7 @@ int iomap_iter_continue(const struct iomap_iter *iter, struct iomap *iomap,
* @begin: callback that produces a mapping for the current position
* @end: optional callback that finishes the previous mapping, or NULL
*
- * Inline helper that implements the common body of an ->iomap_next()
+ * Inline helper that implements the common body of an iomap_iter_next_fn
* callback: it finishes the previous mapping via @end (if present), decides
* via iomap_iter_continue() whether to keep going, and obtains the next
* mapping via @begin.
@@ -396,6 +390,14 @@ int name(const struct iomap_iter *iter, struct iomap *iomap, \
DEFINE_IOMAP_ITER_NEXT_END(name, begin_fn, NULL)
/*
+ * Forward-declare an iomap_iter_next_fn callback generated by
+ * DEFINE_IOMAP_ITER_NEXT().
+ */
+#define DECLARE_IOMAP_ITER_NEXT(name) \
+int name(const struct iomap_iter *iter, struct iomap *iomap, \
+ struct iomap *srcmap)
+
+/*
* Return the file offset for the first unchanged block after a short write.
*
* If nothing was written, round @pos down to point at the first block in
@@ -429,15 +431,15 @@ static inline bool iomap_want_unshare_iter(const struct iomap_iter *iter)
}
ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from,
- const struct iomap_ops *ops,
+ iomap_iter_next_fn next,
const struct iomap_write_ops *write_ops, void *private);
int iomap_fsverity_write(struct file *file, loff_t pos, size_t length,
- const void *buf, const struct iomap_ops *ops,
+ const void *buf, iomap_iter_next_fn next,
const struct iomap_write_ops *write_ops);
-void iomap_read_folio(const struct iomap_ops *ops,
- struct iomap_read_folio_ctx *ctx, void *private);
-void iomap_readahead(const struct iomap_ops *ops,
- struct iomap_read_folio_ctx *ctx, void *private);
+void iomap_read_folio(iomap_iter_next_fn next, struct iomap_read_folio_ctx *ctx,
+ void *private);
+void iomap_readahead(iomap_iter_next_fn next, struct iomap_read_folio_ctx *ctx,
+ void *private);
bool iomap_is_partially_uptodate(struct folio *, size_t from, size_t count);
struct folio *iomap_get_folio(struct iomap_iter *iter, loff_t pos, size_t len);
bool iomap_release_folio(struct folio *folio, gfp_t gfp_flags);
@@ -445,17 +447,17 @@ void iomap_invalidate_folio(struct folio *folio, size_t offset, size_t len);
bool iomap_dirty_folio(struct address_space *mapping, struct folio *folio);
void iomap_folio_mark_uptodate(struct folio *folio);
int iomap_file_unshare(struct inode *inode, loff_t pos, loff_t len,
- const struct iomap_ops *ops,
+ iomap_iter_next_fn next,
const struct iomap_write_ops *write_ops);
unsigned int iomap_fill_dirty_folios(struct iomap_iter *iter, loff_t *start,
loff_t end, unsigned int *iomap_flags);
int iomap_zero_range(struct inode *inode, loff_t pos, loff_t len,
- bool *did_zero, const struct iomap_ops *ops,
+ bool *did_zero, iomap_iter_next_fn next,
const struct iomap_write_ops *write_ops, void *private);
int iomap_truncate_page(struct inode *inode, loff_t pos, bool *did_zero,
- const struct iomap_ops *ops,
+ iomap_iter_next_fn next,
const struct iomap_write_ops *write_ops, void *private);
-vm_fault_t iomap_page_mkwrite(struct vm_fault *vmf, const struct iomap_ops *ops,
+vm_fault_t iomap_page_mkwrite(struct vm_fault *vmf, iomap_iter_next_fn next,
void *private);
typedef void (*iomap_punch_t)(struct inode *inode, loff_t offset, loff_t length,
struct iomap *iomap);
@@ -464,13 +466,13 @@ void iomap_write_delalloc_release(struct inode *inode, loff_t start_byte,
iomap_punch_t punch);
int iomap_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
- u64 start, u64 len, const struct iomap_ops *ops);
+ u64 start, u64 len, iomap_iter_next_fn next);
loff_t iomap_seek_hole(struct inode *inode, loff_t offset,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
loff_t iomap_seek_data(struct inode *inode, loff_t offset,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
sector_t iomap_bmap(struct address_space *mapping, sector_t bno,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
/*
* Flags for iomap_ioend->io_flags.
@@ -711,10 +713,10 @@ struct iomap_dio_ops {
#define IOMAP_DIO_BOUNCE (1 << 4)
ssize_t iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
- const struct iomap_ops *ops, const struct iomap_dio_ops *dops,
+ iomap_iter_next_fn next, const struct iomap_dio_ops *dops,
unsigned int dio_flags, void *private, size_t done_before);
struct iomap_dio *__iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
- const struct iomap_ops *ops, const struct iomap_dio_ops *dops,
+ iomap_iter_next_fn next, const struct iomap_dio_ops *dops,
unsigned int dio_flags, void *private, size_t done_before);
ssize_t iomap_dio_complete(struct iomap_dio *dio);
void iomap_dio_bio_end_io(struct bio *bio);
@@ -790,9 +792,9 @@ struct swap_info_struct;
int iomap_swapfile_activate(struct swap_info_struct *sis,
struct file *swap_file, sector_t *pagespan,
- const struct iomap_ops *ops);
+ iomap_iter_next_fn next);
#else
-# define iomap_swapfile_activate(sis, swapfile, pagespan, ops) (-EIO)
+# define iomap_swapfile_activate(sis, swapfile, pagespan, next) (-EIO)
#endif /* CONFIG_SWAP */
extern struct bio_set iomap_ioend_bioset;
@@ -806,25 +808,25 @@ void iomap_bio_submit_read_endio(const struct iomap_iter *iter,
extern const struct iomap_read_ops iomap_bio_read_ops;
static inline void iomap_bio_read_folio(struct folio *folio,
- const struct iomap_ops *ops)
+ iomap_iter_next_fn next)
{
struct iomap_read_folio_ctx ctx = {
.ops = &iomap_bio_read_ops,
.cur_folio = folio,
};
- iomap_read_folio(ops, &ctx, NULL);
+ iomap_read_folio(next, &ctx, NULL);
}
static inline void iomap_bio_readahead(struct readahead_control *rac,
- const struct iomap_ops *ops)
+ iomap_iter_next_fn next)
{
struct iomap_read_folio_ctx ctx = {
.ops = &iomap_bio_read_ops,
.rac = rac,
};
- iomap_readahead(ops, &ctx, NULL);
+ iomap_readahead(next, &ctx, NULL);
}
#endif /* CONFIG_BLOCK */