]> Git Repo - linux.git/commitdiff
iomap: turn iomap_want_unshare_iter into an inline function
authorChristoph Hellwig <[email protected]>
Tue, 15 Oct 2024 04:13:50 +0000 (06:13 +0200)
committerChristian Brauner <[email protected]>
Mon, 21 Oct 2024 15:01:01 +0000 (17:01 +0200)
iomap_want_unshare_iter currently sits in fs/iomap/buffered-io.c, which
depends on CONFIG_BLOCK.  It is also in used in fs/dax.c whіch has no
such dependency.  Given that it is a trivial check turn it into an inline
in include/linux/iomap.h to fix the DAX && !BLOCK build.

Fixes: 6ef6a0e821d3 ("iomap: share iomap_unshare_iter predicate code with fsdax")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Brian Foster <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
fs/iomap/buffered-io.c
include/linux/iomap.h

index 3899169b2cf733d5f7bb3570080422cd7e4b1c15..6db2aaf808d5adb3b2c3f19a0d88d51a3ac165e6 100644 (file)
@@ -1309,23 +1309,6 @@ void iomap_file_buffered_write_punch_delalloc(struct inode *inode,
 }
 EXPORT_SYMBOL_GPL(iomap_file_buffered_write_punch_delalloc);
 
-bool iomap_want_unshare_iter(const struct iomap_iter *iter)
-{
-       /*
-        * Don't bother with blocks that are not shared to start with; or
-        * mappings that cannot be shared, such as inline data, delalloc
-        * reservations, holes or unwritten extents.
-        *
-        * Note that we use srcmap directly instead of iomap_iter_srcmap as
-        * unsharing requires providing a separate source map, and the presence
-        * of one is a good indicator that unsharing is needed, unlike
-        * IOMAP_F_SHARED which can be set for any data that goes into the COW
-        * fork for XFS.
-        */
-       return (iter->iomap.flags & IOMAP_F_SHARED) &&
-               iter->srcmap.type == IOMAP_MAPPED;
-}
-
 static loff_t iomap_unshare_iter(struct iomap_iter *iter)
 {
        struct iomap *iomap = &iter->iomap;
index d8a7fc84348c4df27ee6ca861446232b9ac26cb7..0198f36e521e27f5e16b4caaa4350fe0a62918a9 100644 (file)
@@ -256,6 +256,25 @@ static inline const struct iomap *iomap_iter_srcmap(const struct iomap_iter *i)
        return &i->iomap;
 }
 
+/*
+ * Check if the range needs to be unshared for a FALLOC_FL_UNSHARE_RANGE
+ * operation.
+ *
+ * Don't bother with blocks that are not shared to start with; or mappings that
+ * cannot be shared, such as inline data, delalloc reservations, holes or
+ * unwritten extents.
+ *
+ * Note that we use srcmap directly instead of iomap_iter_srcmap as unsharing
+ * requires providing a separate source map, and the presence of one is a good
+ * indicator that unsharing is needed, unlike IOMAP_F_SHARED which can be set
+ * for any data that goes into the COW fork for XFS.
+ */
+static inline bool iomap_want_unshare_iter(const struct iomap_iter *iter)
+{
+       return (iter->iomap.flags & IOMAP_F_SHARED) &&
+               iter->srcmap.type == IOMAP_MAPPED;
+}
+
 ssize_t iomap_file_buffered_write(struct kiocb *iocb, struct iov_iter *from,
                const struct iomap_ops *ops, void *private);
 int iomap_read_folio(struct folio *folio, const struct iomap_ops *ops);
@@ -267,7 +286,6 @@ void iomap_invalidate_folio(struct folio *folio, size_t offset, size_t len);
 bool iomap_dirty_folio(struct address_space *mapping, struct folio *folio);
 int iomap_file_unshare(struct inode *inode, loff_t pos, loff_t len,
                const struct iomap_ops *ops);
-bool iomap_want_unshare_iter(const struct iomap_iter *iter);
 int iomap_zero_range(struct inode *inode, loff_t pos, loff_t len,
                bool *did_zero, const struct iomap_ops *ops);
 int iomap_truncate_page(struct inode *inode, loff_t pos, bool *did_zero,
This page took 0.052519 seconds and 4 git commands to generate.