btrfs: add support for uncached writes buffered-uncached.6
authorJens Axboe <axboe@kernel.dk>
Sun, 10 Nov 2024 20:44:52 +0000 (13:44 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 11 Nov 2024 23:35:20 +0000 (16:35 -0700)
commit7a836998c8c4509f8f36e4c4981689c1d53230f6
tree8c5d7f5e3354ffea3da0c04cbbdf56e3c5802a2b
parentde9bbff5b4d4a7e10a3c0534b04b6a328f64fdb7
btrfs: add support for uncached writes

The read side is already covered as btrfs uses the generic filemap
helpers. For writes, just pass in FGP_UNCACHED if uncached IO is being
done, then the folios created should be marked appropriately.

For IO completion, ensure that writing back folios that are uncached
gets punted to one of the btrfs workers, as task context is needed for
that. Add an 'uncached_io' member to struct btrfs_bio to manage that.

Outside of that, call generic_uncached_write() upon successful
completion of a buffered write.

With that, add FOP_UNCACHED to the btrfs file_operations fop_flags
structure, enabling use of RWF_UNCACHED.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/btrfs/bio.c
fs/btrfs/bio.h
fs/btrfs/extent_io.c
fs/btrfs/file.c