diff options
| author | Carlos Maiolino <cem@kernel.org> | 2026-03-10 20:36:47 +0300 |
|---|---|---|
| committer | Carlos Maiolino <cem@kernel.org> | 2026-03-12 10:49:36 +0300 |
| commit | 02a5d8993b09fe9a6754e57d0e25399baffe9a06 (patch) | |
| tree | 558da078155c29b930a8578b4cc8ff53988635a5 | |
| parent | db8367f63b301bbdff6eb00c2e09fad4f2ae75e9 (diff) | |
| download | linux-02a5d8993b09fe9a6754e57d0e25399baffe9a06.tar.xz | |
xfs: factor out xfs_dio_write_zoned_end_io
Stop sharing direct IO end_io between regular and zoned devices
by factoring out zoned dio end_io to its own function.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
| -rw-r--r-- | fs/xfs/xfs_file.c | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index fce6be55d90c..7918968e1d62 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -597,6 +597,36 @@ xfs_dio_endio_set_isize( } 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, ssize_t size, @@ -608,8 +638,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); @@ -702,7 +731,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, }; /* |
