Commit e821bcec authored by Jens Axboe's avatar Jens Axboe
Browse files

Merge branch 'for-6.11/block-limits' into for-6.11/block

Merge in queue limits cleanups.

* for-6.11/block-limits:
  block: move the raid_partial_stripes_expensive flag into the features field
  block: remove the discard_alignment flag
  block: move the misaligned flag into the features field
  block: renumber and rename the cache disabled flag
  block: fix spelling and grammar for in writeback_cache_control.rst
  block: remove the unused blk_bounce enum
parents 5ddb88f2 7d4dec52
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -70,8 +70,8 @@ flag in the features field of the queue_limits structure.
Implementation details for bio based block drivers
--------------------------------------------------

For bio based drivers the REQ_PREFLUSH and REQ_FUA bit are simplify passed on
to the driver if the drivers sets the BLK_FEAT_WRITE_CACHE flag and the drivers
For bio based drivers the REQ_PREFLUSH and REQ_FUA bit are simply passed on to
the driver if the driver sets the BLK_FEAT_WRITE_CACHE flag and the driver
needs to handle them.

*NOTE*: The REQ_FUA bit also gets passed on when the BLK_FEAT_FUA flags is
@@ -89,7 +89,7 @@ When the BLK_FEAT_WRITE_CACHE flag is set, REQ_OP_WRITE | REQ_PREFLUSH requests
with a payload are automatically turned into a sequence of a REQ_OP_FLUSH
request followed by the actual write by the block layer.

When the BLK_FEAT_FUA flags is set, the REQ_FUA bit simplify passed on for the
When the BLK_FEAT_FUA flags is set, the REQ_FUA bit is simply passed on for the
REQ_OP_WRITE request, else a REQ_OP_FLUSH request is sent by the block layer
after the completion of the write request for bio submissions with the REQ_FUA
bit set.
+10 −24
Original line number Diff line number Diff line
@@ -266,7 +266,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))
@@ -477,6 +477,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);
@@ -501,8 +503,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
@@ -516,7 +516,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;
		}
	}
@@ -538,42 +538,38 @@ 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;
	}

	t->raid_partial_stripes_expensive =
		max(t->raid_partial_stripes_expensive,
		    b->raid_partial_stripes_expensive);

	/* Find lowest common alignment_offset */
	t->alignment_offset = lcm_not_zero(t->alignment_offset, alignment)
		% max(t->physical_block_size, t->io_min);

	/* 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;
	}

@@ -585,16 +581,6 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
	if (b->discard_granularity) {
		alignment = queue_limit_discard_alignment(b, start);

		if (t->discard_granularity != 0 &&
		    t->discard_alignment != alignment) {
			top = t->discard_granularity + t->discard_alignment;
			bottom = b->discard_granularity + alignment;

			/* Verify that top and bottom intervals line up */
			if ((max(top, bottom) % min(top, bottom)) != 0)
				t->discard_misaligned = 1;
		}

		t->max_discard_sectors = min_not_zero(t->max_discard_sectors,
						      b->max_discard_sectors);
		t->max_hw_discard_sectors = min_not_zero(t->max_hw_discard_sectors,
@@ -736,7 +722,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,
+3 −3
Original line number Diff line number Diff line
@@ -429,7 +429,7 @@ static ssize_t queue_io_timeout_store(struct request_queue *q, const char *page,

static ssize_t queue_wc_show(struct request_queue *q, char *page)
{
	if (q->limits.features & BLK_FLAGS_WRITE_CACHE_DISABLED)
	if (q->limits.features & BLK_FLAG_WRITE_CACHE_DISABLED)
		return sprintf(page, "write through\n");
	return sprintf(page, "write back\n");
}
@@ -452,9 +452,9 @@ static ssize_t queue_wc_store(struct request_queue *q, const char *page,

	lim = queue_limits_start_update(q);
	if (disable)
		lim.flags |= BLK_FLAGS_WRITE_CACHE_DISABLED;
		lim.flags |= BLK_FLAG_WRITE_CACHE_DISABLED;
	else
		lim.flags &= ~BLK_FLAGS_WRITE_CACHE_DISABLED;
		lim.flags &= ~BLK_FLAG_WRITE_CACHE_DISABLED;
	err = queue_limits_commit_update(q, &lim);
	if (err)
		return err;
+2 −2
Original line number Diff line number Diff line
@@ -1416,8 +1416,8 @@ static int cached_dev_init(struct cached_dev *dc, unsigned int block_size)
	}

	if (bdev_io_opt(dc->bdev))
		dc->partial_stripes_expensive =
			q->limits.raid_partial_stripes_expensive;
		dc->partial_stripes_expensive = q->limits.features &
			BLK_FEAT_RAID_PARTIAL_STRIPES_EXPENSIVE;

	ret = bcache_device_init(&dc->disk, block_size,
			 bdev_nr_sectors(dc->bdev) - dc->sb.data_offset,
+0 −1
Original line number Diff line number Diff line
@@ -3403,7 +3403,6 @@ static void set_discard_limits(struct cache *cache, struct queue_limits *limits)
	limits->max_hw_discard_sectors = origin_limits->max_hw_discard_sectors;
	limits->discard_granularity = origin_limits->discard_granularity;
	limits->discard_alignment = origin_limits->discard_alignment;
	limits->discard_misaligned = origin_limits->discard_misaligned;
}

static void cache_io_hints(struct dm_target *ti, struct queue_limits *limits)
Loading