util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
To: Naohiro Aota <Naohiro.Aota@wdc.com>, Karel Zak <kzak@redhat.com>
Cc: "util-linux@vger.kernel.org" <util-linux@vger.kernel.org>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	Damien Le Moal <Damien.LeMoal@wdc.com>
Subject: Re: [PATCH v2 2/3] blkid: add magic and probing for zoned btrfs
Date: Wed, 14 Apr 2021 09:49:08 +0000	[thread overview]
Message-ID: <PH0PR04MB7416CD7CF75F0EBFCC8488229B4E9@PH0PR04MB7416.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20210414013339.2936229-3-naohiro.aota@wdc.com

On 14/04/2021 03:33, Naohiro Aota wrote:
> This commit adds zone-aware magics and probing functions for zoned btrfs.
> 
> Superblock (and its copies) is the only data structure in btrfs with a

The superblock?

> fixed location on a device. Since we cannot overwrite in a sequential write

cannot do overwrites

> required zone, we cannot place superblock in the zone.

the superblock

> 
> Thus, zoned btrfs use superblock log writing to update superblock on

Thus, zoned btrfs uses superblock log writing to update superblocks on

> sequential write required zones. It uses two zones as a circular buffer to
> write updated superblocks. Once the first zone is filled up, start writing
> into the second buffer. When both zones are filled up and before start

starting to write

> writing to the first zone again, it reset the first zone.
> 
> We can determine the position of the latest superblock by reading write

reading the write pointer

> pointer information from a device. One corner case is when both zones are
> full. For this situation, we read out the last superblock of each zone and
> compare them to determine which zone is older.
> 
> The magics can detect a superblock magic ("_BHRfs_M") at the beginning of
> zone #0 or zone #1 to see if it is zoned btrfs. When both zones are filled
> up, zoned btrfs reset the first zone to write a new superblock. If btrfs


resets

> crash at the moment, we do not see a superblock at zone #0. Thus, we need

crashes

> to check not only zone #0 but also zone #1.
> 
> It also supports temporary magic ("!BHRfS_M") in zone #0. The mkfs.btrfs

the temporary magic [...]. Mkfs.btrfs

[...]

> +	 * Log position:
> +	 *   *: Special case, no superblock is written
> +	 *   0: Use write pointer of zones[0]
> +	 *   1: Use write pointer of zones[1]
> +	 *   C: Compare super blcoks from zones[0] and zones[1], use the latest
                        blocks ~^

[...]

> +	rep_size = sizeof(struct blk_zone_report) + sizeof(struct blk_zone) * 2;
> +	rep = malloc(rep_size);
> +	if (!rep)
> +		return -errno;
> +
> +	memset(rep, 0, rep_size);

I think Damien already pointed this out, but that's a good opportunity for calloc().

Otherwise,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Tested-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

  reply	other threads:[~2021-04-14  9:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14  1:33 [PATCH v2 0/3] implement zone-aware probing/wiping for zoned btrfs Naohiro Aota
2021-04-14  1:33 ` [PATCH v2 1/3] blkid: implement zone-aware probing Naohiro Aota
2021-04-14  9:14   ` Damien Le Moal
2021-04-14  9:17   ` Johannes Thumshirn
2021-04-14 13:31   ` Karel Zak
2021-04-14 15:03     ` Naohiro Aota
2021-04-14  1:33 ` [PATCH v2 2/3] blkid: add magic and probing for zoned btrfs Naohiro Aota
2021-04-14  9:49   ` Johannes Thumshirn [this message]
2021-04-14 13:47   ` Karel Zak
2021-04-14 15:08     ` Naohiro Aota
2021-04-16 15:52   ` David Sterba
2021-04-26  1:38     ` Naohiro Aota
2021-04-14  1:33 ` [PATCH v2 3/3] blkid: support zone reset for wipefs Naohiro Aota
2021-04-14  9:13   ` Damien Le Moal
2021-04-14  9:50   ` Johannes Thumshirn
2021-04-14 13:57   ` Karel Zak
2021-04-16 16:04     ` David Sterba
2021-04-14 14:09 ` [PATCH v2 0/3] implement zone-aware probing/wiping for zoned btrfs Karel Zak
2021-04-14 22:04   ` Damien Le Moal
2021-04-22 14:41 ` Karel Zak

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=PH0PR04MB7416CD7CF75F0EBFCC8488229B4E9@PH0PR04MB7416.namprd04.prod.outlook.com \
    --to=johannes.thumshirn@wdc.com \
    --cc=Damien.LeMoal@wdc.com \
    --cc=Naohiro.Aota@wdc.com \
    --cc=kzak@redhat.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=util-linux@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;
as well as URLs for NNTP newsgroup(s).