[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250428125207.GB27794@lst.de>
Date: Mon, 28 Apr 2025 14:52:07 +0200
From: Christoph Hellwig <hch@....de>
To: Yu Kuai <yukuai1@...weicloud.com>
Cc: hch@....de, axboe@...nel.dk, kbusch@...nel.org,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
yukuai3@...wei.com, yi.zhang@...wei.com, yangerkun@...wei.com,
johnny.chenyi@...wei.com
Subject: Re: [PATCH v2 1/3] brd: protect page with rcu
On Sun, Apr 27, 2025 at 04:39:23PM +0800, Yu Kuai wrote:
> page = brd_lookup_page(brd, sector);
>
> kaddr = bvec_kmap_local(&bv);
> if (op_is_write(opf)) {
> - BUG_ON(!page);
> - memcpy_to_page(page, offset, kaddr, bv.bv_len);
> + if (page)
> + memcpy_to_page(page, offset, kaddr, bv.bv_len);
This could use a comment on why page can be NULL here.
> } else if (page) {
> memcpy_from_page(kaddr, page, offset, bv.bv_len);
> } else {
> memset(kaddr, 0, bv.bv_len);
And why the above change my if/else cascade doesn't really make much sense
any more and this should become:
} else {
if (page)
memcpy_from_page(kaddr, page, offset, bv.bv_len);
else
memset(kaddr, 0, bv.bv_len);
}
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch@....de>
Powered by blists - more mailing lists