From: Anand Jain <anand.jain@oracle.com>
To: Nikolay Borisov <nborisov@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 5/8] btrfs: check if the fsid in the primary sb and copy sb are same
Date: Wed, 28 Mar 2018 15:05:25 +0800 [thread overview]
Message-ID: <c820bed0-1603-c8ce-01c0-321dff874cca@oracle.com> (raw)
In-Reply-To: <7be2ec75-5b5a-7ed5-4fee-23aefae39719@suse.com>
>>>> + for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) {
>>>> + u64 bytenr = btrfs_sb_offset(i);
>>>> +
>>>> + ret = btrfs_read_disk_super(bdev, bytenr, &page, &disk_super);
>>>> + if (ret) {
>>>> + if (i == 0)
>>>> + goto error_kfree;
>>>> + /* copy2 is optional */
>>>> + ret = 0;
>>>> + continue;
>>>> + }
>>>> +
>>>> + if (i == 0) {
>>>> + memcpy(disk_super_primary, disk_super,
>>>> + sizeof(*disk_super_primary));
>>>> + btrfs_release_disk_super(page);
>>>> + continue;
>>>
>>> Doing the memcpy is enough here, the bottom of the loop already releases
>>> the disk page and continues on the next iteration.
>>
>> The page map happens inside btrfs_read_disk_super(), we
>> need unmap before going for the next superblock.
>
> You already have btrfs_release_disk_super(page); called at the end of
> the iteration, right after the closing bracket for the else, see below...
Ah. You meant only memcpy. Yes.
This part of the code is completely changed in V2. Thanks.
next prev parent reply other threads:[~2018-03-28 7:03 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-26 8:27 [PATCH 0/8] Superblock read and verify cleanups Anand Jain
2018-03-26 8:27 ` [PATCH 1/8] btrfs: cleanup btrfs_check_super_csum() for better code flow Anand Jain
2018-03-27 12:10 ` Nikolay Borisov
2018-03-26 8:27 ` [PATCH 2/8] btrfs: return required error from btrfs_check_super_csum Anand Jain
2018-03-27 8:05 ` Nikolay Borisov
2018-03-27 19:16 ` David Sterba
2018-03-27 20:43 ` Anand Jain
2018-04-05 14:48 ` David Sterba
2018-03-26 8:27 ` [PATCH 3/8] btrfs: cleanup btrfs_read_disk_super() to return std error Anand Jain
2018-03-27 8:07 ` Nikolay Borisov
2018-03-26 8:27 ` [PATCH 4/8] btrfs: make btrfs_check_super_csum() non-static Anand Jain
2018-03-27 12:10 ` Nikolay Borisov
2018-03-26 8:27 ` [PATCH 5/8] btrfs: check if the fsid in the primary sb and copy sb are same Anand Jain
2018-03-27 8:49 ` Nikolay Borisov
2018-03-27 22:06 ` Anand Jain
2018-03-28 6:08 ` Nikolay Borisov
2018-03-28 7:05 ` Anand Jain [this message]
2018-03-26 8:27 ` [PATCH 6/8] btrfs: verify checksum when superblock is read for scan Anand Jain
2018-03-27 11:30 ` Nikolay Borisov
2018-03-27 12:09 ` Nikolay Borisov
2018-03-27 23:01 ` Anand Jain
2018-03-28 6:12 ` Nikolay Borisov
2018-03-26 8:27 ` [PATCH 7/8] btrfs: verify checksum for all devices in mount context Anand Jain
2018-03-27 12:21 ` Nikolay Borisov
2018-03-27 22:48 ` Anand Jain
2018-03-26 8:27 ` [PATCH 8/8] btrfs: drop the redundant invalidate_bdev() Anand Jain
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=c820bed0-1603-c8ce-01c0-321dff874cca@oracle.com \
--to=anand.jain@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=nborisov@suse.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).