From: John Garry <john.g.garry@oracle.com>
To: axboe@kernel.dk, song@kernel.org, yukuai3@huawei.com,
kbusch@kernel.org, hch@lst.de, sagi@grimberg.me,
James.Bottomley@HansenPartnership.com,
martin.petersen@oracle.com
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org,
linux-scsi@vger.kernel.org, John Garry <john.g.garry@oracle.com>
Subject: [PATCH RFC 3/4] block: Support atomic writes limits for stacked devices
Date: Tue, 3 Sep 2024 15:07:47 +0000 [thread overview]
Message-ID: <20240903150748.2179966-4-john.g.garry@oracle.com> (raw)
In-Reply-To: <20240903150748.2179966-1-john.g.garry@oracle.com>
Allow stacked devices to support atomic writes by aggregating the minimum
capacility of all bottom devices.
If a bottom device does not support atomic writes, then
BLK_FEAT_ATOMIC_WRITES should be cleared for that device, and the top
device then will also not support atomic writes.
Signed-off-by: John Garry <john.g.garry@oracle.com>
---
block/blk-settings.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 036e67f73116..aeb05fb24801 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -682,6 +682,25 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
t->zone_write_granularity = 0;
t->max_zone_append_sectors = 0;
}
+ if (!(b->features & BLK_FEAT_ATOMIC_WRITES)) {
+ t->atomic_write_hw_max = 0;
+ t->atomic_write_hw_unit_max = 0;
+ t->atomic_write_hw_unit_min = 0;
+ t->atomic_write_hw_boundary = 0;
+ t->features &= ~BLK_FEAT_ATOMIC_WRITES;
+ } else if (t->features & BLK_FEAT_ATOMIC_WRITES) {
+ t->atomic_write_hw_max = min_not_zero(t->atomic_write_hw_max,
+ b->atomic_write_hw_max);
+ t->atomic_write_boundary_sectors =
+ min_not_zero(t->atomic_write_boundary_sectors,
+ b->atomic_write_boundary_sectors);
+ t->atomic_write_hw_unit_min = max(t->atomic_write_hw_unit_min,
+ b->atomic_write_hw_unit_min);
+ t->atomic_write_hw_unit_max =
+ min_not_zero(t->atomic_write_hw_unit_max,
+ b->atomic_write_hw_unit_max);
+ }
+
return ret;
}
EXPORT_SYMBOL(blk_stack_limits);
--
2.31.1
next prev parent reply other threads:[~2024-09-03 15:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-03 15:07 [PATCH RFC 0/4] RAID0 atomic write support John Garry
2024-09-03 15:07 ` [PATCH RFC 1/4] block: Make bdev_can_atomic_write() robust against mis-aligned bdev size John Garry
2024-09-12 13:15 ` Christoph Hellwig
2024-09-12 14:58 ` John Garry
2024-09-12 15:07 ` Christoph Hellwig
2024-09-12 15:22 ` John Garry
2024-09-13 8:36 ` Hannes Reinecke
2024-09-03 15:07 ` [PATCH RFC 2/4] block: Add BLK_FEAT_ATOMIC_WRITES flag John Garry
2024-09-12 13:16 ` Christoph Hellwig
2024-09-12 14:58 ` John Garry
2024-09-03 15:07 ` John Garry [this message]
2024-09-12 13:16 ` [PATCH RFC 3/4] block: Support atomic writes limits for stacked devices Christoph Hellwig
2024-09-12 15:05 ` John Garry
2024-09-03 15:07 ` [PATCH RFC 4/4] md/raid0: Atomic write support John Garry
2024-09-12 13:18 ` Christoph Hellwig
2024-09-12 14:48 ` John Garry
2024-09-12 15:10 ` Christoph Hellwig
2024-09-12 15:38 ` John Garry
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=20240903150748.2179966-4-john.g.garry@oracle.com \
--to=john.g.garry@oracle.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-raid@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=sagi@grimberg.me \
--cc=song@kernel.org \
--cc=yukuai3@huawei.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