Re: [PATCH 3/5] brd: use bvec_kmap_local in brd_do_bvec

Yu Kuai
2025-04-22T06:42:32Z

在 2025/04/21 15:26, Christoph Hellwig 写道:
> Use the proper helper to kmap a bvec in brd_do_bvec instead of directly
> accessing the bvec fields and use the deprecated kmap_atomic API.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> drivers/block/brd.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
LGTM

Reviewed-by: Yu Kuai <yukuai3@huawei.com>

> diff --git a/drivers/block/brd.c b/drivers/block/brd.c
> index 91eb50126355..0c70d29379f1 100644
> --- a/drivers/block/brd.c
> +++ b/drivers/block/brd.c
> @@ -207,15 +207,15 @@ static int brd_rw_bvec(struct brd_device *brd, struct bio_vec *bv,
> return err;
> }
>
> - mem = kmap_atomic(bv->bv_page);
> + mem = bvec_kmap_local(bv);
> if (!op_is_write(opf)) {
> - copy_from_brd(mem + bv->bv_offset, brd, sector, bv->bv_len);
> + copy_from_brd(mem, brd, sector, bv->bv_len);
> flush_dcache_page(bv->bv_page);
> } else {
> flush_dcache_page(bv->bv_page);
> - copy_to_brd(brd, mem + bv->bv_offset, sector, bv->bv_len);
> + copy_to_brd(brd, mem, sector, bv->bv_len);
> }
> - kunmap_atomic(mem);
> + kunmap_local(mem);
> return 0;
> }
>
>