From: Damien Le Moal <damien.lemoal@wdc.com>
To: dm-devel@redhat.com, Mike Snitzer <snitzer@redhat.com>,
linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
linux-nvme@lists.infradead.org, Christoph Hellwig <hch@lst.de>,
linux-scsi@vger.kernel.org,
"Martin K . Petersen" <martin.petersen@oracle.com>,
linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org,
David Sterba <dsterba@suse.com>,
Josef Bacik <josef@toxicpanda.com>
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>,
Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
Naohiro Aota <naohiro.aota@wdc.com>
Subject: [PATCH 3/4] btrfs: zoned: fail mount if the device does not support zone append
Date: Fri, 16 Apr 2021 12:05:27 +0900 [thread overview]
Message-ID: <20210416030528.757513-4-damien.lemoal@wdc.com> (raw)
In-Reply-To: <20210416030528.757513-1-damien.lemoal@wdc.com>
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
For zoned btrfs, zone append is mandatory to write to a sequential write
only zone, otherwise parallel writes to the same zone could result in
unaligned write errors.
If a zoned block device does not support zone append (e.g. a dm-crypt
zoned device using a non-NULL IV cypher), fail to mount.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
fs/btrfs/zoned.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index eeb3ebe11d7a..70b23a0d03b1 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -342,6 +342,13 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device)
if (!IS_ALIGNED(nr_sectors, zone_sectors))
zone_info->nr_zones++;
+ if (bdev_is_zoned(bdev) && zone_info->max_zone_append_size == 0) {
+ btrfs_err(fs_info, "zoned: device %pg does not support zone append",
+ bdev);
+ ret = -EINVAL;
+ goto out;
+ }
+
zone_info->seq_zones = bitmap_zalloc(zone_info->nr_zones, GFP_KERNEL);
if (!zone_info->seq_zones) {
ret = -ENOMEM;
--
2.30.2
next prev parent reply other threads:[~2021-04-16 3:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-16 3:05 [PATCH 0/4] Fix dm-crypt zoned block device support Damien Le Moal
2021-04-16 3:05 ` [PATCH 1/4] dm: Introduce zone append support control Damien Le Moal
2021-04-16 6:51 ` Johannes Thumshirn
2021-04-16 3:05 ` [PATCH 2/4] dm crypt: Fix zoned block device support Damien Le Moal
2021-04-16 7:13 ` Johannes Thumshirn
2021-04-16 7:30 ` Damien Le Moal
2021-04-16 9:10 ` Johannes Thumshirn
2021-04-16 3:05 ` Damien Le Moal [this message]
2021-04-16 16:17 ` [PATCH 3/4] btrfs: zoned: fail mount if the device does not support zone append David Sterba
2021-04-19 9:28 ` Christoph Hellwig
2021-04-19 9:35 ` Damien Le Moal
2021-04-19 9:39 ` hch
2021-04-19 9:46 ` Damien Le Moal
2021-04-19 16:48 ` David Sterba
2021-04-19 9:39 ` Johannes Thumshirn
2021-04-16 3:05 ` [PATCH 4/4] zonefs: fix synchronous write to sequential zone files Damien Le Moal
2021-04-16 6:50 ` Johannes Thumshirn
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=20210416030528.757513-4-damien.lemoal@wdc.com \
--to=damien.lemoal@wdc.com \
--cc=axboe@kernel.dk \
--cc=dm-devel@redhat.com \
--cc=dsterba@suse.com \
--cc=hch@lst.de \
--cc=johannes.thumshirn@wdc.com \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=naohiro.aota@wdc.com \
--cc=shinichiro.kawasaki@wdc.com \
--cc=snitzer@redhat.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).