Re: [PATCH 02/17] block: add a bdev_rw_virt helper

Damien Le Moal
2025-04-24T05:59:37Z

On 4/22/25 23:26, Christoph Hellwig wrote:
> Add a helper to perform synchronous I/O on a kernel direct map range.
> Currently this is implemented in various places in usually not very
> efficient ways, so provide a generic helper instead.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> block/bio.c | 30 ++++++++++++++++++++++++++++++
> include/linux/bio.h | 5 ++++-
> 2 files changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/block/bio.c b/block/bio.c
> index 4e6c85a33d74..a6a867a432cf 100644
> --- a/block/bio.c
> +++ b/block/bio.c
> @@ -1301,6 +1301,36 @@ int submit_bio_wait(struct bio *bio)
> }
> EXPORT_SYMBOL(submit_bio_wait);
>
> +/**
> + * bdev_rw_virt - synchronously read into / write from kernel mapping
> + * @bdev: block device to access
> + * @sector: sector to accasse

s/accasse/access

> + * @data: data to read/write
> + * @len: length to read/write

Maybe "length in bytes to read/write", to avoid any confusion with sector unit.

With that, feel free to add:

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

--
Damien Le Moal
Western Digital Research