Skip to content

Commit 060a72a

Browse files
committed
Merge tag 'for-5.9/block-merge-20200804' of git://git.kernel.dk/linux-block
Pull block stacking updates from Jens Axboe: "The stacking related fixes depended on both the core block and drivers branches, so here's a topic branch with that change. Outside of that, a late fix from Johannes for zone revalidation" * tag 'for-5.9/block-merge-20200804' of git://git.kernel.dk/linux-block: block: don't do revalidate zones on invalid devices block: remove blk_queue_stack_limits block: remove bdev_stack_limits block: inherit the zoned characteristics in blk_stack_limits
2 parents 22fcffe + 1a1206d commit 060a72a

File tree

6 files changed

+18
-63
lines changed

6 files changed

+18
-63
lines changed

block/blk-settings.c

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -455,17 +455,6 @@ void blk_queue_io_opt(struct request_queue *q, unsigned int opt)
455455
}
456456
EXPORT_SYMBOL(blk_queue_io_opt);
457457

458-
/**
459-
* blk_queue_stack_limits - inherit underlying queue limits for stacked drivers
460-
* @t: the stacking driver (top)
461-
* @b: the underlying device (bottom)
462-
**/
463-
void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b)
464-
{
465-
blk_stack_limits(&t->limits, &b->limits, 0);
466-
}
467-
EXPORT_SYMBOL(blk_queue_stack_limits);
468-
469458
/**
470459
* blk_stack_limits - adjust queue_limits for stacked devices
471460
* @t: the stacking driver limits (top device)
@@ -609,32 +598,11 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
609598
t->chunk_sectors = min_not_zero(t->chunk_sectors,
610599
b->chunk_sectors);
611600

601+
t->zoned = max(t->zoned, b->zoned);
612602
return ret;
613603
}
614604
EXPORT_SYMBOL(blk_stack_limits);
615605

616-
/**
617-
* bdev_stack_limits - adjust queue limits for stacked drivers
618-
* @t: the stacking driver limits (top device)
619-
* @bdev: the component block_device (bottom)
620-
* @start: first data sector within component device
621-
*
622-
* Description:
623-
* Merges queue limits for a top device and a block_device. Returns
624-
* 0 if alignment didn't change. Returns -1 if adding the bottom
625-
* device caused misalignment.
626-
*/
627-
int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev,
628-
sector_t start)
629-
{
630-
struct request_queue *bq = bdev_get_queue(bdev);
631-
632-
start += get_start_sect(bdev);
633-
634-
return blk_stack_limits(t, &bq->limits, start);
635-
}
636-
EXPORT_SYMBOL(bdev_stack_limits);
637-
638606
/**
639607
* disk_stack_limits - adjust queue limits for stacked drivers
640608
* @disk: MD/DM gendisk (top)
@@ -650,7 +618,8 @@ void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
650618
{
651619
struct request_queue *t = disk->queue;
652620

653-
if (bdev_stack_limits(&t->limits, bdev, offset >> 9) < 0) {
621+
if (blk_stack_limits(&t->limits, &bdev_get_queue(bdev)->limits,
622+
get_start_sect(bdev) + (offset >> 9)) < 0) {
654623
char top[BDEVNAME_SIZE], bottom[BDEVNAME_SIZE];
655624

656625
disk_name(disk, 0, top);

block/blk-zoned.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,9 @@ int blk_revalidate_disk_zones(struct gendisk *disk,
498498
if (WARN_ON_ONCE(!queue_is_mq(q)))
499499
return -EIO;
500500

501+
if (!get_capacity(disk))
502+
return -EIO;
503+
501504
/*
502505
* Ensure that all memory allocations in this context are done as if
503506
* GFP_NOIO was specified.

drivers/block/drbd/drbd_nl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ static void fixup_discard_if_not_supported(struct request_queue *q)
12501250

12511251
static void fixup_write_zeroes(struct drbd_device *device, struct request_queue *q)
12521252
{
1253-
/* Fixup max_write_zeroes_sectors after blk_queue_stack_limits():
1253+
/* Fixup max_write_zeroes_sectors after blk_stack_limits():
12541254
* if we can handle "zeroes" efficiently on the protocol,
12551255
* we want to do that, even if our backend does not announce
12561256
* max_write_zeroes_sectors itself. */
@@ -1361,7 +1361,7 @@ static void drbd_setup_queue_param(struct drbd_device *device, struct drbd_backi
13611361
decide_on_write_same_support(device, q, b, o, disable_write_same);
13621362

13631363
if (b) {
1364-
blk_queue_stack_limits(q, b);
1364+
blk_stack_limits(&q->limits, &b->limits, 0);
13651365

13661366
if (q->backing_dev_info->ra_pages !=
13671367
b->backing_dev_info->ra_pages) {

drivers/md/dm-table.c

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,8 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
458458
return 0;
459459
}
460460

461-
if (bdev_stack_limits(limits, bdev, start) < 0)
461+
if (blk_stack_limits(limits, &q->limits,
462+
get_start_sect(bdev) + start) < 0)
462463
DMWARN("%s: adding target device %s caused an alignment inconsistency: "
463464
"physical_block_size=%u, logical_block_size=%u, "
464465
"alignment_offset=%u, start=%llu",
@@ -467,9 +468,6 @@ static int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
467468
q->limits.logical_block_size,
468469
q->limits.alignment_offset,
469470
(unsigned long long) start << SECTOR_SHIFT);
470-
471-
limits->zoned = blk_queue_zoned_model(q);
472-
473471
return 0;
474472
}
475473

@@ -1528,22 +1526,6 @@ int dm_calculate_queue_limits(struct dm_table *table,
15281526
dm_device_name(table->md),
15291527
(unsigned long long) ti->begin,
15301528
(unsigned long long) ti->len);
1531-
1532-
/*
1533-
* FIXME: this should likely be moved to blk_stack_limits(), would
1534-
* also eliminate limits->zoned stacking hack in dm_set_device_limits()
1535-
*/
1536-
if (limits->zoned == BLK_ZONED_NONE && ti_limits.zoned != BLK_ZONED_NONE) {
1537-
/*
1538-
* By default, the stacked limits zoned model is set to
1539-
* BLK_ZONED_NONE in blk_set_stacking_limits(). Update
1540-
* this model using the first target model reported
1541-
* that is not BLK_ZONED_NONE. This will be either the
1542-
* first target device zoned model or the model reported
1543-
* by the target .io_hints.
1544-
*/
1545-
limits->zoned = ti_limits.zoned;
1546-
}
15471529
}
15481530

15491531
/*

drivers/nvme/host/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2081,7 +2081,8 @@ static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
20812081
#ifdef CONFIG_NVME_MULTIPATH
20822082
if (ns->head->disk) {
20832083
nvme_update_disk_info(ns->head->disk, ns, id);
2084-
blk_queue_stack_limits(ns->head->disk->queue, ns->queue);
2084+
blk_stack_limits(&ns->head->disk->queue->limits,
2085+
&ns->queue->limits, 0);
20852086
nvme_mpath_update_disk_size(ns->head->disk);
20862087
}
20872088
#endif

include/linux/blkdev.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,14 @@ enum blk_queue_state {
306306

307307
/*
308308
* Zoned block device models (zoned limit).
309+
*
310+
* Note: This needs to be ordered from the least to the most severe
311+
* restrictions for the inheritance in blk_stack_limits() to work.
309312
*/
310313
enum blk_zoned_model {
311-
BLK_ZONED_NONE, /* Regular block device */
312-
BLK_ZONED_HA, /* Host-aware zoned block device */
313-
BLK_ZONED_HM, /* Host-managed zoned block device */
314+
BLK_ZONED_NONE = 0, /* Regular block device */
315+
BLK_ZONED_HA, /* Host-aware zoned block device */
316+
BLK_ZONED_HM, /* Host-managed zoned block device */
314317
};
315318

316319
struct queue_limits {
@@ -1136,11 +1139,8 @@ extern void blk_set_default_limits(struct queue_limits *lim);
11361139
extern void blk_set_stacking_limits(struct queue_limits *lim);
11371140
extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
11381141
sector_t offset);
1139-
extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev,
1140-
sector_t offset);
11411142
extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
11421143
sector_t offset);
1143-
extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
11441144
extern void blk_queue_update_dma_pad(struct request_queue *, unsigned int);
11451145
extern void blk_queue_segment_boundary(struct request_queue *, unsigned long);
11461146
extern void blk_queue_virt_boundary(struct request_queue *, unsigned long);

0 commit comments

Comments
 (0)