diff mbox series

[15/15] xfs: flag as supporting FOP_UNCACHED

Message ID 20241110152906.1747545-16-axboe@kernel.dk (mailing list archive)
State New
Headers show
Series Uncached buffered IO | expand

Commit Message

Jens Axboe Nov. 10, 2024, 3:28 p.m. UTC
Read side was already fully supported, for the write side all that's
needed now is calling generic_uncached_write() when uncached writes
have been submitted. With that, enable the use of RWF_UNCACHED with XFS
by flagging support with FOP_UNCACHED.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
 fs/xfs/xfs_file.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Christoph Hellwig Nov. 11, 2024, 3:27 p.m. UTC | #1
On Sun, Nov 10, 2024 at 08:28:07AM -0700, Jens Axboe wrote:
> Read side was already fully supported, for the write side all that's
> needed now is calling generic_uncached_write() when uncached writes
> have been submitted. With that, enable the use of RWF_UNCACHED with XFS
> by flagging support with FOP_UNCACHED.

It also might make sense to default to RWF_UNCACHED for the direct to
buffered I/O fallback for sub-block size writes to reflink files.

Also for the next round you probably want to add the xfs and ext4
lists.
Jens Axboe Nov. 11, 2024, 3:33 p.m. UTC | #2
On 11/11/24 8:27 AM, Christoph Hellwig wrote:
> On Sun, Nov 10, 2024 at 08:28:07AM -0700, Jens Axboe wrote:
>> Read side was already fully supported, for the write side all that's
>> needed now is calling generic_uncached_write() when uncached writes
>> have been submitted. With that, enable the use of RWF_UNCACHED with XFS
>> by flagging support with FOP_UNCACHED.
> 
> It also might make sense to default to RWF_UNCACHED for the direct to
> buffered I/O fallback for sub-block size writes to reflink files.

It very well may make sense, but that's probably something the fs folks
should add after the fact.

> Also for the next round you probably want to add the xfs and ext4
> lists.

Oh for sure, I deliberately didn't do the ext4/xfs folks just yet as I
want to iron out the main bits first. And hopefully get those sorted and
acked first, then move on to a separate xfs and ext4 set of patches. I
also did btrfs in the most recent version, but that'll be a separate
thing too. Just kept it as one big series for now with more limited
scope, so folks can actually test this if they want to, without needing
multiple series of patches.
diff mbox series

Patch

diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index b19916b11fd5..1a7f46e13464 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -825,6 +825,7 @@  xfs_file_buffered_write(
 
 	if (ret > 0) {
 		XFS_STATS_ADD(ip->i_mount, xs_write_bytes, ret);
+		generic_uncached_write(iocb, ret);
 		/* Handle various SYNC-type writes */
 		ret = generic_write_sync(iocb, ret);
 	}
@@ -1595,7 +1596,8 @@  const struct file_operations xfs_file_operations = {
 	.fadvise	= xfs_file_fadvise,
 	.remap_file_range = xfs_file_remap_range,
 	.fop_flags	= FOP_MMAP_SYNC | FOP_BUFFER_RASYNC |
-			  FOP_BUFFER_WASYNC | FOP_DIO_PARALLEL_WRITE,
+			  FOP_BUFFER_WASYNC | FOP_DIO_PARALLEL_WRITE |
+			  FOP_UNCACHED,
 };
 
 const struct file_operations xfs_dir_file_operations = {