* [PATCH 0/4] Zoned device cleanups
@ 2026-03-10 11:55 cem
2026-03-10 11:55 ` [PATCH 1/4] xfs: factor out isize updates from xfs_dio_write_end_io cem
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: cem @ 2026-03-10 11:55 UTC (permalink / raw)
To: linux-xfs; +Cc: hch, dlemoal
From: Carlos Maiolino <cem@kernel.org>
These patches initially were part from an attempt to implement atomic
writes for zoned devices.
Due to unforeseen circumstances, we can't implement it, at least for now
without restructuring a big part of the code.
Christoph though suggested those cleanups were good enough to be sent
even without proceeding with the implementation.
Carlos Maiolino (4):
xfs: factor out isize updates from xfs_dio_write_end_io
xfs: move zoned dio ioend to its own function
xfs: factor out xfs_zone_inc_written
xfs: opencode xfs_zone_record_blocks
fs/xfs/xfs_file.c | 94 +++++++++++++++++++++++++++++------------
fs/xfs/xfs_zone_alloc.c | 32 ++++++--------
2 files changed, 81 insertions(+), 45 deletions(-)
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
--
2.53.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/4] xfs: factor out isize updates from xfs_dio_write_end_io
2026-03-10 11:55 [PATCH 0/4] Zoned device cleanups cem
@ 2026-03-10 11:55 ` cem
2026-03-10 12:51 ` Damien Le Moal
2026-03-10 12:52 ` Christoph Hellwig
2026-03-10 11:55 ` [PATCH 2/4] xfs: move zoned dio ioend to its own function cem
` (2 subsequent siblings)
3 siblings, 2 replies; 13+ messages in thread
From: cem @ 2026-03-10 11:55 UTC (permalink / raw)
To: linux-xfs; +Cc: hch, dlemoal
From: Carlos Maiolino <cem@kernel.org>
This is the only code needed for zoned inodes, so factor it out so
we can move zoned inodes ioend to its own callback.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---
fs/xfs/xfs_file.c | 59 +++++++++++++++++++++++++++++------------------
1 file changed, 36 insertions(+), 23 deletions(-)
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 6246f34df9fd..45ecd743fa32 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -560,6 +560,41 @@ xfs_zoned_write_space_reserve(
flags, ac);
}
+/*
+ * We need to lock the test/set EOF update as we can be racing with
+ * other IO completions here to update the EOF. Failing to serialise
+ * here can result in EOF moving backwards and Bad Things Happen when
+ * that occurs.
+ *
+ * As IO completion only ever extends EOF, we can do an unlocked check
+ * here to avoid taking the spinlock. If we land within the current EOF,
+ * then we do not need to do an extending update at all, and we don't
+ * need to take the lock to check this. If we race with an update moving
+ * EOF, then we'll either still be beyond EOF and need to take the lock,
+ * or we'll be within EOF and we don't need to take it at all.
+ */
+static int
+xfs_dio_endio_set_isize(
+ struct inode *inode,
+ loff_t offset,
+ ssize_t size)
+{
+ struct xfs_inode *ip = XFS_I(inode);
+
+ if (offset + size <= i_size_read(inode))
+ return 0;
+
+ spin_lock(&ip->i_flags_lock);
+ if (offset + size > i_size_read(inode)) {
+ i_size_write(inode, offset + size);
+ spin_unlock(&ip->i_flags_lock);
+ } else {
+ spin_unlock(&ip->i_flags_lock);
+ }
+
+ return xfs_setfilesize(ip, offset, size);
+}
+
static int
xfs_dio_write_end_io(
struct kiocb *iocb,
@@ -623,30 +658,8 @@ xfs_dio_write_end_io(
* with the on-disk inode size being outside the in-core inode size. We
* have no other method of updating EOF for AIO, so always do it here
* if necessary.
- *
- * We need to lock the test/set EOF update as we can be racing with
- * other IO completions here to update the EOF. Failing to serialise
- * here can result in EOF moving backwards and Bad Things Happen when
- * that occurs.
- *
- * As IO completion only ever extends EOF, we can do an unlocked check
- * here to avoid taking the spinlock. If we land within the current EOF,
- * then we do not need to do an extending update at all, and we don't
- * need to take the lock to check this. If we race with an update moving
- * EOF, then we'll either still be beyond EOF and need to take the lock,
- * or we'll be within EOF and we don't need to take it at all.
*/
- if (offset + size <= i_size_read(inode))
- goto out;
-
- spin_lock(&ip->i_flags_lock);
- if (offset + size > i_size_read(inode)) {
- i_size_write(inode, offset + size);
- spin_unlock(&ip->i_flags_lock);
- error = xfs_setfilesize(ip, offset, size);
- } else {
- spin_unlock(&ip->i_flags_lock);
- }
+ error = xfs_dio_endio_set_isize(inode, offset, size);
out:
memalloc_nofs_restore(nofs_flag);
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/4] xfs: move zoned dio ioend to its own function
2026-03-10 11:55 [PATCH 0/4] Zoned device cleanups cem
2026-03-10 11:55 ` [PATCH 1/4] xfs: factor out isize updates from xfs_dio_write_end_io cem
@ 2026-03-10 11:55 ` cem
2026-03-10 12:53 ` Christoph Hellwig
2026-03-10 12:54 ` Damien Le Moal
2026-03-10 11:55 ` [PATCH 3/4] xfs: factor out xfs_zone_inc_written cem
2026-03-10 11:55 ` [PATCH 4/4] xfs: opencode xfs_zone_record_blocks cem
3 siblings, 2 replies; 13+ messages in thread
From: cem @ 2026-03-10 11:55 UTC (permalink / raw)
To: linux-xfs; +Cc: hch, dlemoal
From: Carlos Maiolino <cem@kernel.org>
All zoned dio needs during endio is set the file size, so move it
out of the generic function.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---
fs/xfs/xfs_file.c | 35 ++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 45ecd743fa32..29b02673111b 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -595,6 +595,36 @@ xfs_dio_endio_set_isize(
return xfs_setfilesize(ip, offset, size);
}
+static int
+xfs_zoned_dio_write_end_io(
+ struct kiocb *iocb,
+ ssize_t size,
+ int error,
+ unsigned flags)
+{
+ struct inode *inode = file_inode(iocb->ki_filp);
+ struct xfs_inode *ip = XFS_I(inode);
+ unsigned int nofs_flag;
+
+ ASSERT(!(flags & (IOMAP_DIO_UNWRITTEN | IOMAP_DIO_COW)));
+
+ trace_xfs_end_io_direct_write(ip, iocb->ki_pos, size);
+
+ if (xfs_is_shutdown(ip->i_mount))
+ return -EIO;
+
+ if (error || !size)
+ return error;
+
+ XFS_STATS_ADD(ip->i_mount, xs_write_bytes, size);
+
+ nofs_flag = memalloc_nofs_save();
+ error = xfs_dio_endio_set_isize(inode, iocb->ki_pos, size);
+ memalloc_nofs_restore(nofs_flag);
+
+ return error;
+}
+
static int
xfs_dio_write_end_io(
struct kiocb *iocb,
@@ -607,8 +637,7 @@ xfs_dio_write_end_io(
loff_t offset = iocb->ki_pos;
unsigned int nofs_flag;
- ASSERT(!xfs_is_zoned_inode(ip) ||
- !(flags & (IOMAP_DIO_UNWRITTEN | IOMAP_DIO_COW)));
+ ASSERT(!xfs_is_zoned_inode(ip));
trace_xfs_end_io_direct_write(ip, offset, size);
@@ -701,7 +730,7 @@ xfs_dio_zoned_submit_io(
static const struct iomap_dio_ops xfs_dio_zoned_write_ops = {
.bio_set = &iomap_ioend_bioset,
.submit_io = xfs_dio_zoned_submit_io,
- .end_io = xfs_dio_write_end_io,
+ .end_io = xfs_zoned_dio_write_end_io,
};
/*
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/4] xfs: factor out xfs_zone_inc_written
2026-03-10 11:55 [PATCH 0/4] Zoned device cleanups cem
2026-03-10 11:55 ` [PATCH 1/4] xfs: factor out isize updates from xfs_dio_write_end_io cem
2026-03-10 11:55 ` [PATCH 2/4] xfs: move zoned dio ioend to its own function cem
@ 2026-03-10 11:55 ` cem
2026-03-10 12:54 ` Christoph Hellwig
2026-03-10 12:55 ` Damien Le Moal
2026-03-10 11:55 ` [PATCH 4/4] xfs: opencode xfs_zone_record_blocks cem
3 siblings, 2 replies; 13+ messages in thread
From: cem @ 2026-03-10 11:55 UTC (permalink / raw)
To: linux-xfs; +Cc: hch, dlemoal
From: Carlos Maiolino <cem@kernel.org>
Move the written blocks increment and full zone check into a new helper.
Also add an assert to ensure rmap lock is held here.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---
fs/xfs/xfs_zone_alloc.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/fs/xfs/xfs_zone_alloc.c b/fs/xfs/xfs_zone_alloc.c
index e3d19b6dc64a..97149bfc2512 100644
--- a/fs/xfs/xfs_zone_alloc.c
+++ b/fs/xfs/xfs_zone_alloc.c
@@ -189,6 +189,18 @@ xfs_open_zone_mark_full(
xfs_zone_account_reclaimable(rtg, rtg_blocks(rtg) - used);
}
+static inline void
+xfs_zone_inc_written(
+ struct xfs_open_zone *oz,
+ xfs_filblks_t len)
+{
+ xfs_assert_ilocked(rtg_rmap(oz->oz_rtg), XFS_ILOCK_EXCL);
+
+ oz->oz_written += len;
+ if (oz->oz_written == rtg_blocks(oz->oz_rtg))
+ xfs_open_zone_mark_full(oz);
+}
+
static void
xfs_zone_record_blocks(
struct xfs_trans *tp,
@@ -206,9 +218,7 @@ xfs_zone_record_blocks(
xfs_rtgroup_trans_join(tp, rtg, XFS_RTGLOCK_RMAP);
rmapip->i_used_blocks += len;
ASSERT(rmapip->i_used_blocks <= rtg_blocks(rtg));
- oz->oz_written += len;
- if (oz->oz_written == rtg_blocks(rtg))
- xfs_open_zone_mark_full(oz);
+ xfs_zone_inc_written(oz, len);
xfs_trans_log_inode(tp, rmapip, XFS_ILOG_CORE);
}
@@ -227,9 +237,7 @@ xfs_zone_skip_blocks(
trace_xfs_zone_skip_blocks(oz, 0, len);
xfs_rtgroup_lock(rtg, XFS_RTGLOCK_RMAP);
- oz->oz_written += len;
- if (oz->oz_written == rtg_blocks(rtg))
- xfs_open_zone_mark_full(oz);
+ xfs_zone_inc_written(oz, len);
xfs_rtgroup_unlock(rtg, XFS_RTGLOCK_RMAP);
xfs_add_frextents(rtg_mount(rtg), len);
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/4] xfs: opencode xfs_zone_record_blocks
2026-03-10 11:55 [PATCH 0/4] Zoned device cleanups cem
` (2 preceding siblings ...)
2026-03-10 11:55 ` [PATCH 3/4] xfs: factor out xfs_zone_inc_written cem
@ 2026-03-10 11:55 ` cem
2026-03-10 12:54 ` Christoph Hellwig
2026-03-10 12:56 ` Damien Le Moal
3 siblings, 2 replies; 13+ messages in thread
From: cem @ 2026-03-10 11:55 UTC (permalink / raw)
To: linux-xfs; +Cc: hch, dlemoal
From: Carlos Maiolino <cem@kernel.org>
We only have a single caller, no need to keep it in its own function.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---
fs/xfs/xfs_zone_alloc.c | 30 ++++++++----------------------
1 file changed, 8 insertions(+), 22 deletions(-)
diff --git a/fs/xfs/xfs_zone_alloc.c b/fs/xfs/xfs_zone_alloc.c
index 97149bfc2512..7d712d5a5ce0 100644
--- a/fs/xfs/xfs_zone_alloc.c
+++ b/fs/xfs/xfs_zone_alloc.c
@@ -201,27 +201,6 @@ xfs_zone_inc_written(
xfs_open_zone_mark_full(oz);
}
-static void
-xfs_zone_record_blocks(
- struct xfs_trans *tp,
- struct xfs_open_zone *oz,
- xfs_fsblock_t fsbno,
- xfs_filblks_t len)
-{
- struct xfs_mount *mp = tp->t_mountp;
- struct xfs_rtgroup *rtg = oz->oz_rtg;
- struct xfs_inode *rmapip = rtg_rmap(rtg);
-
- trace_xfs_zone_record_blocks(oz, xfs_rtb_to_rgbno(mp, fsbno), len);
-
- xfs_rtgroup_lock(rtg, XFS_RTGLOCK_RMAP);
- xfs_rtgroup_trans_join(tp, rtg, XFS_RTGLOCK_RMAP);
- rmapip->i_used_blocks += len;
- ASSERT(rmapip->i_used_blocks <= rtg_blocks(rtg));
- xfs_zone_inc_written(oz, len);
- xfs_trans_log_inode(tp, rmapip, XFS_ILOG_CORE);
-}
-
/*
* Called for blocks that have been written to disk, but not actually linked to
* an inode, which can happen when garbage collection races with user data
@@ -252,6 +231,8 @@ xfs_zoned_map_extent(
xfs_fsblock_t old_startblock)
{
struct xfs_bmbt_irec data;
+ struct xfs_rtgroup *rtg = oz->oz_rtg;
+ struct xfs_inode *rmapip = rtg_rmap(rtg);
int nmaps = 1;
int error;
@@ -310,7 +291,12 @@ xfs_zoned_map_extent(
}
}
- xfs_zone_record_blocks(tp, oz, new->br_startblock, new->br_blockcount);
+ xfs_rtgroup_lock(rtg, XFS_RTGLOCK_RMAP);
+ xfs_rtgroup_trans_join(tp, rtg, XFS_RTGLOCK_RMAP);
+ rmapip->i_used_blocks += new->br_blockcount;
+ ASSERT(rmapip->i_used_blocks <= rtg_blocks(rtg));
+ xfs_zone_inc_written(oz, new->br_blockcount);
+ xfs_trans_log_inode(tp, rmapip, XFS_ILOG_CORE);
/* Map the new blocks into the data fork. */
xfs_bmap_map_extent(tp, ip, XFS_DATA_FORK, new);
--
2.53.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 1/4] xfs: factor out isize updates from xfs_dio_write_end_io
2026-03-10 11:55 ` [PATCH 1/4] xfs: factor out isize updates from xfs_dio_write_end_io cem
@ 2026-03-10 12:51 ` Damien Le Moal
2026-03-10 12:52 ` Christoph Hellwig
1 sibling, 0 replies; 13+ messages in thread
From: Damien Le Moal @ 2026-03-10 12:51 UTC (permalink / raw)
To: cem, linux-xfs; +Cc: hch
On 2026/03/10 12:55, cem@kernel.org wrote:
> From: Carlos Maiolino <cem@kernel.org>
>
> This is the only code needed for zoned inodes, so factor it out so
> we can move zoned inodes ioend to its own callback.
>
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> ---
> fs/xfs/xfs_file.c | 59 +++++++++++++++++++++++++++++------------------
> 1 file changed, 36 insertions(+), 23 deletions(-)
>
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index 6246f34df9fd..45ecd743fa32 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -560,6 +560,41 @@ xfs_zoned_write_space_reserve(
> flags, ac);
> }
>
> +/*
> + * We need to lock the test/set EOF update as we can be racing with
> + * other IO completions here to update the EOF. Failing to serialise
> + * here can result in EOF moving backwards and Bad Things Happen when
> + * that occurs.
> + *
> + * As IO completion only ever extends EOF, we can do an unlocked check
> + * here to avoid taking the spinlock. If we land within the current EOF,
> + * then we do not need to do an extending update at all, and we don't
> + * need to take the lock to check this. If we race with an update moving
> + * EOF, then we'll either still be beyond EOF and need to take the lock,
> + * or we'll be within EOF and we don't need to take it at all.
> + */
> +static int
> +xfs_dio_endio_set_isize(
> + struct inode *inode,
> + loff_t offset,
> + ssize_t size)
> +{
> + struct xfs_inode *ip = XFS_I(inode);
> +
> + if (offset + size <= i_size_read(inode))
> + return 0;
> +
> + spin_lock(&ip->i_flags_lock);
> + if (offset + size > i_size_read(inode)) {
> + i_size_write(inode, offset + size);
> + spin_unlock(&ip->i_flags_lock);
> + } else {
> + spin_unlock(&ip->i_flags_lock);
> + }
The spinlock unlock does not need to be inside the if and else:
+ spin_lock(&ip->i_flags_lock);
+ if (offset + size > i_size_read(inode))
+ i_size_write(inode, offset + size);
+ spin_unlock(&ip->i_flags_lock);
Other than this, looks OK to me.
> +
> + return xfs_setfilesize(ip, offset, size);
> +}
> +
> static int
> xfs_dio_write_end_io(
> struct kiocb *iocb,
> @@ -623,30 +658,8 @@ xfs_dio_write_end_io(
> * with the on-disk inode size being outside the in-core inode size. We
> * have no other method of updating EOF for AIO, so always do it here
> * if necessary.
> - *
> - * We need to lock the test/set EOF update as we can be racing with
> - * other IO completions here to update the EOF. Failing to serialise
> - * here can result in EOF moving backwards and Bad Things Happen when
> - * that occurs.
> - *
> - * As IO completion only ever extends EOF, we can do an unlocked check
> - * here to avoid taking the spinlock. If we land within the current EOF,
> - * then we do not need to do an extending update at all, and we don't
> - * need to take the lock to check this. If we race with an update moving
> - * EOF, then we'll either still be beyond EOF and need to take the lock,
> - * or we'll be within EOF and we don't need to take it at all.
> */
> - if (offset + size <= i_size_read(inode))
> - goto out;
> -
> - spin_lock(&ip->i_flags_lock);
> - if (offset + size > i_size_read(inode)) {
> - i_size_write(inode, offset + size);
> - spin_unlock(&ip->i_flags_lock);
> - error = xfs_setfilesize(ip, offset, size);
> - } else {
> - spin_unlock(&ip->i_flags_lock);
> - }
> + error = xfs_dio_endio_set_isize(inode, offset, size);
>
> out:
> memalloc_nofs_restore(nofs_flag);
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 1/4] xfs: factor out isize updates from xfs_dio_write_end_io
2026-03-10 11:55 ` [PATCH 1/4] xfs: factor out isize updates from xfs_dio_write_end_io cem
2026-03-10 12:51 ` Damien Le Moal
@ 2026-03-10 12:52 ` Christoph Hellwig
1 sibling, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2026-03-10 12:52 UTC (permalink / raw)
To: cem; +Cc: linux-xfs, hch, dlemoal
On Tue, Mar 10, 2026 at 12:55:04PM +0100, cem@kernel.org wrote:
> +static int
> +xfs_dio_endio_set_isize(
> + struct inode *inode,
> + loff_t offset,
> + ssize_t size)
> +{
> + struct xfs_inode *ip = XFS_I(inode);
> +
> + if (offset + size <= i_size_read(inode))
> + return 0;
> +
> + spin_lock(&ip->i_flags_lock);
> + if (offset + size > i_size_read(inode)) {
> + i_size_write(inode, offset + size);
> + spin_unlock(&ip->i_flags_lock);
> + } else {
> + spin_unlock(&ip->i_flags_lock);
> + }
> +
> + return xfs_setfilesize(ip, offset, size);
This now calls xfs_setfilesize for the case where we don't update
the inode size. This looks harmless to be, but isn't needed.
This should become something like:
if (offset + size <= i_size_read(inode)) {
spin_unlock(&ip->i_flags_lock);
return 0;
}
i_size_write(inode, offset + size);
spin_unlock(&ip->i_flags_lock);
return xfs_setfilesize(ip, offset, size);
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/4] xfs: move zoned dio ioend to its own function
2026-03-10 11:55 ` [PATCH 2/4] xfs: move zoned dio ioend to its own function cem
@ 2026-03-10 12:53 ` Christoph Hellwig
2026-03-10 12:54 ` Damien Le Moal
1 sibling, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2026-03-10 12:53 UTC (permalink / raw)
To: cem; +Cc: linux-xfs, hch, dlemoal
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/4] xfs: factor out xfs_zone_inc_written
2026-03-10 11:55 ` [PATCH 3/4] xfs: factor out xfs_zone_inc_written cem
@ 2026-03-10 12:54 ` Christoph Hellwig
2026-03-10 12:55 ` Damien Le Moal
1 sibling, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2026-03-10 12:54 UTC (permalink / raw)
To: cem; +Cc: linux-xfs, hch, dlemoal
On Tue, Mar 10, 2026 at 12:55:06PM +0100, cem@kernel.org wrote:
> From: Carlos Maiolino <cem@kernel.org>
>
> Move the written blocks increment and full zone check into a new helper.
> Also add an assert to ensure rmap lock is held here.
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/4] xfs: move zoned dio ioend to its own function
2026-03-10 11:55 ` [PATCH 2/4] xfs: move zoned dio ioend to its own function cem
2026-03-10 12:53 ` Christoph Hellwig
@ 2026-03-10 12:54 ` Damien Le Moal
1 sibling, 0 replies; 13+ messages in thread
From: Damien Le Moal @ 2026-03-10 12:54 UTC (permalink / raw)
To: cem, linux-xfs; +Cc: hch
On 2026/03/10 12:55, cem@kernel.org wrote:
> From: Carlos Maiolino <cem@kernel.org>
>
> All zoned dio needs during endio is set the file size, so move it
> out of the generic function.
"move" is unclear here since this patch is adding code but not deleting
anything. Maye be rephrase this ?
>
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> ---
> fs/xfs/xfs_file.c | 35 ++++++++++++++++++++++++++++++++---
> 1 file changed, 32 insertions(+), 3 deletions(-)
>
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index 45ecd743fa32..29b02673111b 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -595,6 +595,36 @@ xfs_dio_endio_set_isize(
> return xfs_setfilesize(ip, offset, size);
> }
>
> +static int
> +xfs_zoned_dio_write_end_io(
> + struct kiocb *iocb,
> + ssize_t size,
> + int error,
> + unsigned flags)
> +{
> + struct inode *inode = file_inode(iocb->ki_filp);
> + struct xfs_inode *ip = XFS_I(inode);
> + unsigned int nofs_flag;
> +
> + ASSERT(!(flags & (IOMAP_DIO_UNWRITTEN | IOMAP_DIO_COW)));
> +
> + trace_xfs_end_io_direct_write(ip, iocb->ki_pos, size);
> +
> + if (xfs_is_shutdown(ip->i_mount))
> + return -EIO;
> +
> + if (error || !size)
> + return error;
> +
> + XFS_STATS_ADD(ip->i_mount, xs_write_bytes, size);
> +
> + nofs_flag = memalloc_nofs_save();
> + error = xfs_dio_endio_set_isize(inode, iocb->ki_pos, size);
> + memalloc_nofs_restore(nofs_flag);
> +
> + return error;
> +}
> +
> static int
> xfs_dio_write_end_io(
> struct kiocb *iocb,
> @@ -607,8 +637,7 @@ xfs_dio_write_end_io(
> loff_t offset = iocb->ki_pos;
> unsigned int nofs_flag;
>
> - ASSERT(!xfs_is_zoned_inode(ip) ||
> - !(flags & (IOMAP_DIO_UNWRITTEN | IOMAP_DIO_COW)));
> + ASSERT(!xfs_is_zoned_inode(ip));
>
> trace_xfs_end_io_direct_write(ip, offset, size);
>
> @@ -701,7 +730,7 @@ xfs_dio_zoned_submit_io(
> static const struct iomap_dio_ops xfs_dio_zoned_write_ops = {
> .bio_set = &iomap_ioend_bioset,
> .submit_io = xfs_dio_zoned_submit_io,
> - .end_io = xfs_dio_write_end_io,
> + .end_io = xfs_zoned_dio_write_end_io,
> };
>
> /*
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/4] xfs: opencode xfs_zone_record_blocks
2026-03-10 11:55 ` [PATCH 4/4] xfs: opencode xfs_zone_record_blocks cem
@ 2026-03-10 12:54 ` Christoph Hellwig
2026-03-10 12:56 ` Damien Le Moal
1 sibling, 0 replies; 13+ messages in thread
From: Christoph Hellwig @ 2026-03-10 12:54 UTC (permalink / raw)
To: cem; +Cc: linux-xfs, hch, dlemoal
On Tue, Mar 10, 2026 at 12:55:07PM +0100, cem@kernel.org wrote:
> From: Carlos Maiolino <cem@kernel.org>
>
> We only have a single caller, no need to keep it in its own function.
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/4] xfs: factor out xfs_zone_inc_written
2026-03-10 11:55 ` [PATCH 3/4] xfs: factor out xfs_zone_inc_written cem
2026-03-10 12:54 ` Christoph Hellwig
@ 2026-03-10 12:55 ` Damien Le Moal
1 sibling, 0 replies; 13+ messages in thread
From: Damien Le Moal @ 2026-03-10 12:55 UTC (permalink / raw)
To: cem, linux-xfs; +Cc: hch
On 2026/03/10 12:55, cem@kernel.org wrote:
> From: Carlos Maiolino <cem@kernel.org>
>
> Move the written blocks increment and full zone check into a new helper.
> Also add an assert to ensure rmap lock is held here.
>
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/4] xfs: opencode xfs_zone_record_blocks
2026-03-10 11:55 ` [PATCH 4/4] xfs: opencode xfs_zone_record_blocks cem
2026-03-10 12:54 ` Christoph Hellwig
@ 2026-03-10 12:56 ` Damien Le Moal
1 sibling, 0 replies; 13+ messages in thread
From: Damien Le Moal @ 2026-03-10 12:56 UTC (permalink / raw)
To: cem, linux-xfs; +Cc: hch
On 2026/03/10 12:55, cem@kernel.org wrote:
> From: Carlos Maiolino <cem@kernel.org>
>
> We only have a single caller, no need to keep it in its own function.
>
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-03-10 12:56 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10 11:55 [PATCH 0/4] Zoned device cleanups cem
2026-03-10 11:55 ` [PATCH 1/4] xfs: factor out isize updates from xfs_dio_write_end_io cem
2026-03-10 12:51 ` Damien Le Moal
2026-03-10 12:52 ` Christoph Hellwig
2026-03-10 11:55 ` [PATCH 2/4] xfs: move zoned dio ioend to its own function cem
2026-03-10 12:53 ` Christoph Hellwig
2026-03-10 12:54 ` Damien Le Moal
2026-03-10 11:55 ` [PATCH 3/4] xfs: factor out xfs_zone_inc_written cem
2026-03-10 12:54 ` Christoph Hellwig
2026-03-10 12:55 ` Damien Le Moal
2026-03-10 11:55 ` [PATCH 4/4] xfs: opencode xfs_zone_record_blocks cem
2026-03-10 12:54 ` Christoph Hellwig
2026-03-10 12:56 ` Damien Le Moal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox