From: Anand Jain <anand.jain@oracle.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>, linux-btrfs@vger.kernel.org
Subject: Re: [RFC PATCH] btrfs: remove struct scrub_stx for superblock scrubbing
Date: Thu, 23 Mar 2023 10:56:48 +0800 [thread overview]
Message-ID: <1ebebb48-4796-66d4-35ff-8d1c1eab492e@oracle.com> (raw)
In-Reply-To: <24d97721-6906-7633-4fc8-c5d9b0b35b3e@gmx.com>
On 23/03/2023 09:13, Qu Wenruo wrote:
>
>
> On 2023/3/21 18:11, Anand Jain wrote:
>> On 3/21/23 15:26, Qu Wenruo wrote:
>>>
>>>
>>> On 2023/3/21 13:23, Anand Jain wrote:
>>>> Following the patchset that implements reader-friendly scrub code
>>>> made the struct scrub_stx is no longer required for scrubbing
>>>> superblocks.
>>>>
>>>> btrfs: scrub: use a more reader friendly code to implement
>>>> scrub_simple_mirror()
>>>>
>>>> Therefore, scrub_ctx does not need to be passed as a parameter,
>>>> (unless there are other plans for it).
>>>>
>>>> This patch cleans up the code and is built on top of the above
>>>> patchset.
>>>>
>>>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>>>
>>> Looks good, if you're fine I can fold this into the offending patch
>>> in the next update.
>>>
>>
>> IMO, this patch is a cleanup rather than a bug fix, so there
>> isn't offending patch. If it is folded to the patch 1/12, it
>> may be too many objectives in one patch.
>
> The cleanup is only possible because of the patch "btrfs: scrub: use
> dedicated super block verification function to scrub one super block".
>
> As the old code relies on the scrub_sectors() function, thus needing the
> @sctx parameter.
>
> And it's indeed my fault not fully cleaning up the parameters.
>
> Thus I believe it's better to fold it into the mentioned patch.
Yes. Please go ahead.
Thanks, Anand
> Thanks,
> Qu
>>
>> Nonetheless, I have no objections if you still decide to fold it.
>>
>> Thanks, Anand
>>
>>
>>> Thanks,
>>> Qu
>>>
>>>> ---
>>>> fs/btrfs/scrub.c | 15 +++++++--------
>>>> 1 file changed, 7 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
>>>> index beccf763ae64..bc87277559d3 100644
>>>> --- a/fs/btrfs/scrub.c
>>>> +++ b/fs/btrfs/scrub.c
>>>> @@ -4909,12 +4909,12 @@ int scrub_enumerate_chunks(struct scrub_ctx
>>>> *sctx,
>>>> return ret;
>>>> }
>>>> -static int scrub_one_super(struct scrub_ctx *sctx, struct
>>>> btrfs_device *dev,
>>>> - struct page *page, u64 physical, u64 generation)
>>>> +static int scrub_one_super(struct btrfs_device *dev, struct page
>>>> *page,
>>>> + u64 physical, u64 generation)
>>>> {
>>>> - struct btrfs_fs_info *fs_info = sctx->fs_info;
>>>> struct bio_vec bvec;
>>>> struct bio bio;
>>>> + struct btrfs_fs_info *fs_info = dev->fs_info;
>>>> struct btrfs_super_block *sb = page_address(page);
>>>> int ret;
>>>> @@ -4945,15 +4945,14 @@ static int scrub_one_super(struct scrub_ctx
>>>> *sctx, struct btrfs_device *dev,
>>>> return ret;
>>>> }
>>>> -static noinline_for_stack int scrub_supers(struct scrub_ctx *sctx,
>>>> - struct btrfs_device *scrub_dev)
>>>> +static noinline_for_stack int scrub_supers(struct btrfs_device
>>>> *scrub_dev)
>>>> {
>>>> int i;
>>>> u64 bytenr;
>>>> u64 gen;
>>>> int ret = 0;
>>>> struct page *page;
>>>> - struct btrfs_fs_info *fs_info = sctx->fs_info;
>>>> + struct btrfs_fs_info *fs_info = scrub_dev->fs_info;
>>>> if (BTRFS_FS_ERROR(fs_info))
>>>> return -EROFS;
>>>> @@ -4976,7 +4975,7 @@ static noinline_for_stack int
>>>> scrub_supers(struct scrub_ctx *sctx,
>>>> if (!btrfs_check_super_location(scrub_dev, bytenr))
>>>> continue;
>>>> - ret = scrub_one_super(sctx, scrub_dev, page, bytenr, gen);
>>>> + ret = scrub_one_super(scrub_dev, page, bytenr, gen);
>>>> if (ret)
>>>> break;
>>>> }
>>>> @@ -5172,7 +5171,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info
>>>> *fs_info, u64 devid, u64 start,
>>>> * kick off writing super in log tree sync.
>>>> */
>>>> mutex_lock(&fs_info->fs_devices->device_list_mutex);
>>>> - ret = scrub_supers(sctx, dev);
>>>> + ret = scrub_supers(dev);
>>>> mutex_unlock(&fs_info->fs_devices->device_list_mutex);
>>>> spin_lock(&sctx->stat_lock);
>>
prev parent reply other threads:[~2023-03-23 2:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 5:23 [RFC PATCH] btrfs: remove struct scrub_stx for superblock scrubbing Anand Jain
2023-03-21 7:26 ` Qu Wenruo
2023-03-21 10:11 ` Anand Jain
2023-03-23 1:13 ` Qu Wenruo
2023-03-23 2:56 ` Anand Jain [this message]
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=1ebebb48-4796-66d4-35ff-8d1c1eab492e@oracle.com \
--to=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo.btrfs@gmx.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;
as well as URLs for NNTP newsgroup(s).