From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, linux-bcache@vger.kernel.org,
dm-devel@lists.linux.dev, linux-raid@vger.kernel.org
Subject: [PATCH 4/6] block: move the misaligned flag into the features field
Date: Wed, 19 Jun 2024 17:45:36 +0200 [thread overview]
Message-ID: <20240619154623.450048-5-hch@lst.de> (raw)
In-Reply-To: <20240619154623.450048-1-hch@lst.de>
Move the misaligned flags into the features field to reclaim a little
bit of space.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
block/blk-settings.c | 20 ++++++++++----------
include/linux/blkdev.h | 4 +++-
2 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/block/blk-settings.c b/block/blk-settings.c
index d0e9096f93ca8a..a1b10404e500bc 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -258,7 +258,7 @@ static int blk_validate_limits(struct queue_limits *lim)
if (lim->alignment_offset) {
lim->alignment_offset &= (lim->physical_block_size - 1);
- lim->misaligned = 0;
+ lim->features &= ~BLK_FEAT_MISALIGNED;
}
if (!(lim->features & BLK_FEAT_WRITE_CACHE))
@@ -470,6 +470,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
if (!(b->features & BLK_FEAT_POLL))
t->features &= ~BLK_FEAT_POLL;
+ t->flags |= (b->flags & BLK_FEAT_MISALIGNED);
+
t->max_sectors = min_not_zero(t->max_sectors, b->max_sectors);
t->max_user_sectors = min_not_zero(t->max_user_sectors,
b->max_user_sectors);
@@ -494,8 +496,6 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
t->max_segment_size = min_not_zero(t->max_segment_size,
b->max_segment_size);
- t->misaligned |= b->misaligned;
-
alignment = queue_limit_alignment_offset(b, start);
/* Bottom device has different alignment. Check that it is
@@ -509,7 +509,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
/* Verify that top and bottom intervals line up */
if (max(top, bottom) % min(top, bottom)) {
- t->misaligned = 1;
+ t->flags |= BLK_FEAT_MISALIGNED;
ret = -1;
}
}
@@ -531,28 +531,28 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
/* Physical block size a multiple of the logical block size? */
if (t->physical_block_size & (t->logical_block_size - 1)) {
t->physical_block_size = t->logical_block_size;
- t->misaligned = 1;
+ t->flags |= BLK_FEAT_MISALIGNED;
ret = -1;
}
/* Minimum I/O a multiple of the physical block size? */
if (t->io_min & (t->physical_block_size - 1)) {
t->io_min = t->physical_block_size;
- t->misaligned = 1;
+ t->flags |= BLK_FEAT_MISALIGNED;
ret = -1;
}
/* Optimal I/O a multiple of the physical block size? */
if (t->io_opt & (t->physical_block_size - 1)) {
t->io_opt = 0;
- t->misaligned = 1;
+ t->flags |= BLK_FEAT_MISALIGNED;
ret = -1;
}
/* chunk_sectors a multiple of the physical block size? */
if ((t->chunk_sectors << 9) & (t->physical_block_size - 1)) {
t->chunk_sectors = 0;
- t->misaligned = 1;
+ t->flags |= BLK_FEAT_MISALIGNED;
ret = -1;
}
@@ -566,7 +566,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
/* Verify that new alignment_offset is on a logical block boundary */
if (t->alignment_offset & (t->logical_block_size - 1)) {
- t->misaligned = 1;
+ t->flags |= BLK_FEAT_MISALIGNED;
ret = -1;
}
@@ -729,7 +729,7 @@ int bdev_alignment_offset(struct block_device *bdev)
{
struct request_queue *q = bdev_get_queue(bdev);
- if (q->limits.misaligned)
+ if (q->limits.flags & BLK_FEAT_MISALIGNED)
return -1;
if (bdev_is_partition(bdev))
return queue_limit_alignment_offset(&q->limits,
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 713a98b6dbba08..7ad2b1240fc0bf 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -341,6 +341,9 @@ enum {
enum {
/* do not send FLUSH/FUA commands despite advertising a write cache */
BLK_FLAG_WRITE_CACHE_DISABLED = (1u << 0),
+
+ /* I/O topology is misaligned */
+ BLK_FEAT_MISALIGNED = (1u << 1),
};
struct queue_limits {
@@ -374,7 +377,6 @@ struct queue_limits {
unsigned short max_integrity_segments;
unsigned short max_discard_segments;
- unsigned char misaligned;
unsigned char discard_misaligned;
unsigned char raid_partial_stripes_expensive;
unsigned int max_open_zones;
--
2.43.0
next prev parent reply other threads:[~2024-06-19 15:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 15:45 misc queue_limits fixups Christoph Hellwig
2024-06-19 15:45 ` [PATCH 1/6] block: remove the unused blk_bounce enum Christoph Hellwig
2024-06-19 15:45 ` [PATCH 2/6] block: fix spelling and grammar for in writeback_cache_control.rst Christoph Hellwig
2024-06-19 23:17 ` Damien Le Moal
2024-06-19 15:45 ` [PATCH 3/6] block: renumber and rename the cache disabled flag Christoph Hellwig
2024-06-19 15:45 ` Christoph Hellwig [this message]
2024-06-19 15:45 ` [PATCH 5/6] block: remove the discard_alignment flag Christoph Hellwig
2024-06-19 15:45 ` [PATCH 6/6] block: move the raid_partial_stripes_expensive flag into the features field Christoph Hellwig
2024-06-19 16:03 ` misc queue_limits fixups Martin K. Petersen
2024-06-20 6:13 ` Johannes Thumshirn
2024-06-20 12:56 ` Jens Axboe
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=20240619154623.450048-5-hch@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=dm-devel@lists.linux.dev \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-raid@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