From: Coly Li <colyli@suse.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: Liang Chen <liangchen.linux@gmail.com>,
kent.overstreet@gmail.com, linux-kernel@vger.kernel.org,
linux-bcache@vger.kernel.org
Subject: Re: [PATCH 2/2] [PATCH] bcache: __write_super to handle page sizes other than 4k
Date: Mon, 9 Dec 2019 17:52:45 +0800 [thread overview]
Message-ID: <dc01bf2c-4457-9658-c0a3-cbd4b7eff82b@suse.de> (raw)
In-Reply-To: <20191209073744.GB3852@infradead.org>
On 2019/12/9 3:37 下午, Christoph Hellwig wrote:
> On Fri, Dec 06, 2019 at 05:44:38PM +0800, Coly Li wrote:
>>> {
>>> - struct cache_sb *out = page_address(bio_first_page_all(bio));
>>> + struct cache_sb *out;
>>> unsigned int i;
>>> + struct buffer_head *bh;
>>> +
>>> + /*
>>> + * The page is held since read_super, this __bread * should not
>>> + * cause an extra io read.
>>> + */
>>> + bh = __bread(bdev, 1, SB_SIZE);
>>> + if (!bh)
>>> + goto out_bh;
>>> +
>>> + out = (struct cache_sb *) bh->b_data;
>>
>> This is quite tricky here. Could you please to move this code piece into
>> an inline function and add code comments to explain why a read is
>> necessary for a write.
>
> A read is not nessecary. He only added it because he was too fearful
> of calculating the data offset directly. But calculating it directly
> is almost trivial and should just be done here. Alternatively if that
> is still to hard just keep a pointer to the cache_sb around, which is
> how most file systems do it.
>
Copied, if Liang does not have time to handle this as your suggestion, I
will handle it.
Thanks for the hint.
--
Coly Li
next prev parent reply other threads:[~2019-12-09 9:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-06 8:55 [PATCH 1/2] [PATCH] bcache: cached_dev_free needs to put the sb page Liang Chen
2019-12-06 8:55 ` [PATCH 2/2] [PATCH] bcache: __write_super to handle page sizes other than 4k Liang Chen
2019-12-06 9:23 ` Christoph Hellwig
2019-12-06 11:23 ` Liang C
2019-12-06 9:44 ` Coly Li
2019-12-06 11:22 ` Liang C
2019-12-09 7:37 ` Christoph Hellwig
2019-12-09 9:52 ` Coly Li [this message]
2019-12-09 10:21 ` Liang C
2019-12-06 9:27 ` [PATCH 1/2] [PATCH] bcache: cached_dev_free needs to put the sb page Christoph Hellwig
2019-12-06 11:27 ` Liang C
2019-12-06 9:42 ` Coly Li
2019-12-06 23:08 ` Eric Wheeler
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=dc01bf2c-4457-9658-c0a3-cbd4b7eff82b@suse.de \
--to=colyli@suse.de \
--cc=hch@infradead.org \
--cc=kent.overstreet@gmail.com \
--cc=liangchen.linux@gmail.com \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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