iomap: Inline __iomap_zero_iter into its caller

To make the merge easier, replicate the inlining of __iomap_zero_iter()
into iomap_zero_iter() that is currently in the nvdimm tree.
Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
parent 67958013
......@@ -895,13 +895,32 @@ iomap_file_unshare(struct inode *inode, loff_t pos, loff_t len,
}
EXPORT_SYMBOL_GPL(iomap_file_unshare);
static s64 __iomap_zero_iter(struct iomap_iter *iter, loff_t pos, u64 length)
static loff_t iomap_zero_iter(struct iomap_iter *iter, bool *did_zero)
{
struct iomap *iomap = &iter->iomap;
const struct iomap *srcmap = iomap_iter_srcmap(iter);
loff_t pos = iter->pos;
loff_t length = iomap_length(iter);
loff_t written = 0;
/* already zeroed? we're done. */
if (srcmap->type == IOMAP_HOLE || srcmap->type == IOMAP_UNWRITTEN)
return length;
do {
struct folio *folio;
int status;
size_t offset;
size_t bytes = min_t(u64, SIZE_MAX, length);
if (IS_DAX(iter->inode)) {
s64 tmp = dax_iomap_zero(pos, bytes, iomap);
if (tmp < 0)
return tmp;
bytes = tmp;
goto good;
}
status = iomap_write_begin(iter, pos, bytes, &folio);
if (status)
return status;
......@@ -913,30 +932,10 @@ static s64 __iomap_zero_iter(struct iomap_iter *iter, loff_t pos, u64 length)
folio_zero_range(folio, offset, bytes);
folio_mark_accessed(folio);
return iomap_write_end(iter, pos, bytes, bytes, folio);
}
static loff_t iomap_zero_iter(struct iomap_iter *iter, bool *did_zero)
{
struct iomap *iomap = &iter->iomap;
const struct iomap *srcmap = iomap_iter_srcmap(iter);
loff_t pos = iter->pos;
loff_t length = iomap_length(iter);
loff_t written = 0;
/* already zeroed? we're done. */
if (srcmap->type == IOMAP_HOLE || srcmap->type == IOMAP_UNWRITTEN)
return length;
do {
s64 bytes;
if (IS_DAX(iter->inode))
bytes = dax_iomap_zero(pos, length, iomap);
else
bytes = __iomap_zero_iter(iter, pos, length);
if (bytes < 0)
return bytes;
bytes = iomap_write_end(iter, pos, bytes, bytes, folio);
good:
if (WARN_ON_ONCE(bytes == 0))
return -EIO;
pos += bytes;
length -= bytes;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment