OSDN Git Service

zonefs: use iomap for synchronous direct writes
authorDamien Le Moal <dlemoal@kernel.org>
Thu, 1 Jun 2023 08:15:41 +0000 (17:15 +0900)
committerDamien Le Moal <dlemoal@kernel.org>
Tue, 13 Jun 2023 23:51:05 +0000 (08:51 +0900)
commit16d7fd3cfa7259729c8e2a7620bd5b4ca480da85
tree86343050bbd711f5535c88652daa2463596646bc
parent9561de3a55bed6bdd44a12820ba81ec416e705a7
zonefs: use iomap for synchronous direct writes

Remove the function zonefs_file_dio_append() that is used to manually
issue REQ_OP_ZONE_APPEND BIOs for processing synchronous direct writes
and use iomap instead.

To preserve the use of zone append operations for synchronous writes,
different struct iomap_dio_ops are defined. For synchronous direct
writes using zone append, zonefs_zone_append_dio_ops is introduced.
The submit_bio operation of this structure is defined as the function
zonefs_file_zone_append_dio_submit_io() which is used to change the BIO
opreation for synchronous direct IO writes to REQ_OP_ZONE_APPEND.

In order to preserve the write location check on completion of zone
append BIOs, the end_io operation is also defined using the function
zonefs_file_zone_append_dio_bio_end_io(). This check now relies on the
zonefs_zone_append_bio structure, allocated together with zone append
BIOs with a dedicated BIO set. This structure include the target inode
of a zone append BIO as well as the target append offset location for
the zone append operation. This is used to perform a check against
bio->bi_iter.bi_sector when the BIO completes, without needing to use
the zone information z_wpoffset field, thus removing the need for
taking the inode truncate mutex.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
fs/zonefs/file.c
fs/zonefs/super.c
fs/zonefs/zonefs.h