mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yu Kuai <yukuai1@huaweicloud.com>
To: Christoph Hellwig <hch@lst.de>, Yu Kuai <yukuai1@huaweicloud.com>
Cc: axboe@kernel.dk, kbusch@kernel.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, yi.zhang@huawei.com,
	yangerkun@huawei.com, johnny.chenyi@huawei.com,
	"yukuai (C)" <yukuai3@huawei.com>
Subject: Re: [PATCH v2 1/3] brd: protect page with rcu
Date: Tue, 29 Apr 2025 09:48:12 +0800	[thread overview]
Message-ID: <cdca4c95-27a0-5964-e242-173281c4e8f9@huaweicloud.com> (raw)
In-Reply-To: <20250428125207.GB27794@lst.de>

Hi,

在 2025/04/28 20:52, Christoph Hellwig 写道:
> 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.
OK

> 
>>   	} 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);
>   	}
OK, I will send a new version soon.

Thanks for the review!
Kuai

> 
> Otherwise looks good:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> .
> 


  reply	other threads:[~2025-04-29  1:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-27  8:39 [PATCH v2 0/3] brd: discard bugfix Yu Kuai
2025-04-27  8:39 ` [PATCH v2 1/3] brd: protect page with rcu Yu Kuai
2025-04-28 12:52   ` Christoph Hellwig
2025-04-29  1:48     ` Yu Kuai [this message]
2025-04-27  8:39 ` [PATCH v2 2/3] brd: fix aligned_sector from brd_do_discard() Yu Kuai
2025-04-27  8:39 ` [PATCH v2 3/3] brd: fix discard end sector Yu Kuai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cdca4c95-27a0-5964-e242-173281c4e8f9@huaweicloud.com \
    --to=yukuai1@huaweicloud.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=johnny.chenyi@huawei.com \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®