]> www.infradead.org Git - nvme.git/commit
block: Add fops atomic write support
authorJohn Garry <john.g.garry@oracle.com>
Thu, 20 Jun 2024 12:53:56 +0000 (12:53 +0000)
committerJens Axboe <axboe@kernel.dk>
Thu, 20 Jun 2024 21:19:17 +0000 (15:19 -0600)
commitcaf336f81b3a3ca744e335972e86ec7244512d4a
treedc5bf0641a35c57fd39f279f1d8343dee3ce26ef
parent9abcfbd235f59fb5b6379e5bc0231dad831ebace
block: Add fops atomic write support

Support atomic writes by submitting a single BIO with the REQ_ATOMIC set.

It must be ensured that the atomic write adheres to its rules, like
naturally aligned offset, so call blkdev_dio_invalid() ->
blkdev_atomic_write_valid() [with renaming blkdev_dio_unaligned() to
blkdev_dio_invalid()] for this purpose. The BIO submission path currently
checks for atomic writes which are too large, so no need to check here.

In blkdev_direct_IO(), if the nr_pages exceeds BIO_MAX_VECS, then we cannot
produce a single BIO, so error in this case.

Finally set FMODE_CAN_ATOMIC_WRITE when the bdev can support atomic writes
and the associated file flag is for O_DIRECT.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/20240620125359.2684798-8-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/fops.c