[PATCH 06/10] dax: advance the iomap_iter on unshare range

Brian Foster
2025-02-12T13:55:01Z

Advance the iter and return 0 or an error code for success or
failure.

Signed-off-by: Brian Foster <bfoster@redhat.com>
---
fs/dax.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index 0f611209ee37..d0430ded4b83 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1266,11 +1266,11 @@ static s64 dax_unshare_iter(struct iomap_iter *iter)
u64 copy_len = iomap_length(iter);
u32 mod;
int id = 0;
- s64 ret = 0;
+ s64 ret = iomap_length(iter);
void *daddr = NULL, *saddr = NULL;

if (!iomap_want_unshare_iter(iter))
- return iomap_length(iter);
+ return iomap_iter_advance(iter, &ret);

/*
* Extend the file range to be aligned to fsblock/pagesize, because
@@ -1307,7 +1307,9 @@ static s64 dax_unshare_iter(struct iomap_iter *iter)

out_unlock:
dax_read_unlock(id);
- return dax_mem2blk_err(ret);
+ if (ret < 0)
+ return dax_mem2blk_err(ret);
+ return iomap_iter_advance(iter, &ret);
}

int dax_file_unshare(struct inode *inode, loff_t pos, loff_t len,
--
2.48.1