Skip to content

Commit e0fc99e

Browse files
committed
Merge tag 'for-5.9/drivers-20200803' of git://git.kernel.dk/linux-block
Pull block driver updates from Jens Axboe: - NVMe: - ZNS support (Aravind, Keith, Matias, Niklas) - Misc cleanups, optimizations, fixes (Baolin, Chaitanya, David, Dongli, Max, Sagi) - null_blk zone capacity support (Aravind) - MD: - raid5/6 fixes (ChangSyun) - Warning fixes (Damien) - raid5 stripe fixes (Guoqing, Song, Yufen) - sysfs deadlock fix (Junxiao) - raid10 deadlock fix (Vitaly) - struct_size conversions (Gustavo) - Set of bcache updates/fixes (Coly) * tag 'for-5.9/drivers-20200803' of git://git.kernel.dk/linux-block: (117 commits) md/raid5: Allow degraded raid6 to do rmw md/raid5: Fix Force reconstruct-write io stuck in degraded raid5 raid5: don't duplicate code for different paths in handle_stripe raid5-cache: hold spinlock instead of mutex in r5c_journal_mode_show md: print errno in super_written md/raid5: remove the redundant setting of STRIPE_HANDLE md: register new md sysfs file 'uuid' read-only md: fix max sectors calculation for super 1.0 nvme-loop: remove extra variable in create ctrl nvme-loop: set ctrl state connecting after init nvme-multipath: do not fall back to __nvme_find_path() for non-optimized paths nvme-multipath: fix logic for non-optimized paths nvme-rdma: fix controller reset hang during traffic nvme-tcp: fix controller reset hang during traffic nvmet: introduce the passthru Kconfig option nvmet: introduce the passthru configfs interface nvmet: Add passthru enable/disable helpers nvmet: add passthru code to process commands nvme: export nvme_find_get_ns() and nvme_put_ns() nvme: introduce nvme_ctrl_get_by_path() ...
2 parents 4834ce9 + f59589f commit e0fc99e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+3149
-826
lines changed

Documentation/ABI/testing/sysfs-block

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,24 @@ Description:
273273
device ("host-aware" or "host-managed" zone model). For regular
274274
block devices, the value is always 0.
275275

276+
What: /sys/block/<disk>/queue/max_active_zones
277+
Date: July 2020
278+
Contact: Niklas Cassel <[email protected]>
279+
Description:
280+
For zoned block devices (zoned attribute indicating
281+
"host-managed" or "host-aware"), the sum of zones belonging to
282+
any of the zone states: EXPLICIT OPEN, IMPLICIT OPEN or CLOSED,
283+
is limited by this value. If this value is 0, there is no limit.
284+
285+
What: /sys/block/<disk>/queue/max_open_zones
286+
Date: July 2020
287+
Contact: Niklas Cassel <[email protected]>
288+
Description:
289+
For zoned block devices (zoned attribute indicating
290+
"host-managed" or "host-aware"), the sum of zones belonging to
291+
any of the zone states: EXPLICIT OPEN or IMPLICIT OPEN,
292+
is limited by this value. If this value is 0, there is no limit.
293+
276294
What: /sys/block/<disk>/queue/chunk_sectors
277295
Date: September 2016
278296
Contact: Hannes Reinecke <[email protected]>

Documentation/admin-guide/md.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,10 @@ All md devices contain:
426426
The accepted values when writing to this file are ``ppl`` and ``resync``,
427427
used to enable and disable PPL.
428428

429+
uuid
430+
This indicates the UUID of the array in the following format:
431+
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
432+
429433

430434
As component devices are added to an md array, they appear in the ``md``
431435
directory as new directories named::

Documentation/block/queue-sysfs.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,20 @@ Maximum number of elements in a DMA scatter/gather list with integrity
117117
data that will be submitted by the block layer core to the associated
118118
block driver.
119119

120+
max_active_zones (RO)
121+
---------------------
122+
For zoned block devices (zoned attribute indicating "host-managed" or
123+
"host-aware"), the sum of zones belonging to any of the zone states:
124+
EXPLICIT OPEN, IMPLICIT OPEN or CLOSED, is limited by this value.
125+
If this value is 0, there is no limit.
126+
127+
max_open_zones (RO)
128+
-------------------
129+
For zoned block devices (zoned attribute indicating "host-managed" or
130+
"host-aware"), the sum of zones belonging to any of the zone states:
131+
EXPLICIT OPEN or IMPLICIT OPEN, is limited by this value.
132+
If this value is 0, there is no limit.
133+
120134
max_sectors_kb (RW)
121135
-------------------
122136
This is the maximum number of kilobytes that the block layer will allow

block/Kconfig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ config BLK_DEV_ZONED
8686
select MQ_IOSCHED_DEADLINE
8787
help
8888
Block layer zoned block device support. This option enables
89-
support for ZAC/ZBC host-managed and host-aware zoned block devices.
89+
support for ZAC/ZBC/ZNS host-managed and host-aware zoned block
90+
devices.
9091

91-
Say yes here if you have a ZAC or ZBC storage device.
92+
Say yes here if you have a ZAC, ZBC, or ZNS storage device.
9293

9394
config BLK_DEV_THROTTLING
9495
bool "Block layer bio throttling support"

block/blk-sysfs.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,16 @@ static ssize_t queue_nr_zones_show(struct request_queue *q, char *page)
306306
return queue_var_show(blk_queue_nr_zones(q), page);
307307
}
308308

309+
static ssize_t queue_max_open_zones_show(struct request_queue *q, char *page)
310+
{
311+
return queue_var_show(queue_max_open_zones(q), page);
312+
}
313+
314+
static ssize_t queue_max_active_zones_show(struct request_queue *q, char *page)
315+
{
316+
return queue_var_show(queue_max_active_zones(q), page);
317+
}
318+
309319
static ssize_t queue_nomerges_show(struct request_queue *q, char *page)
310320
{
311321
return queue_var_show((blk_queue_nomerges(q) << 1) |
@@ -668,6 +678,16 @@ static struct queue_sysfs_entry queue_nr_zones_entry = {
668678
.show = queue_nr_zones_show,
669679
};
670680

681+
static struct queue_sysfs_entry queue_max_open_zones_entry = {
682+
.attr = {.name = "max_open_zones", .mode = 0444 },
683+
.show = queue_max_open_zones_show,
684+
};
685+
686+
static struct queue_sysfs_entry queue_max_active_zones_entry = {
687+
.attr = {.name = "max_active_zones", .mode = 0444 },
688+
.show = queue_max_active_zones_show,
689+
};
690+
671691
static struct queue_sysfs_entry queue_nomerges_entry = {
672692
.attr = {.name = "nomerges", .mode = 0644 },
673693
.show = queue_nomerges_show,
@@ -766,6 +786,8 @@ static struct attribute *queue_attrs[] = {
766786
&queue_nonrot_entry.attr,
767787
&queue_zoned_entry.attr,
768788
&queue_nr_zones_entry.attr,
789+
&queue_max_open_zones_entry.attr,
790+
&queue_max_active_zones_entry.attr,
769791
&queue_nomerges_entry.attr,
770792
&queue_rq_affinity_entry.attr,
771793
&queue_iostats_entry.attr,
@@ -793,6 +815,11 @@ static umode_t queue_attr_visible(struct kobject *kobj, struct attribute *attr,
793815
(!q->mq_ops || !q->mq_ops->timeout))
794816
return 0;
795817

818+
if ((attr == &queue_max_open_zones_entry.attr ||
819+
attr == &queue_max_active_zones_entry.attr) &&
820+
!blk_queue_is_zoned(q))
821+
return 0;
822+
796823
return attr->mode;
797824
}
798825

block/blk-zoned.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode,
312312
return ret;
313313

314314
rep.nr_zones = ret;
315+
rep.flags = BLK_ZONE_REP_CAPACITY;
315316
if (copy_to_user(argp, &rep, sizeof(struct blk_zone_report)))
316317
return -EFAULT;
317318
return 0;

drivers/acpi/property.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ static const guid_t prp_guids[] = {
4545
/* Thunderbolt GUID for WAKE_SUPPORTED: 6c501103-c189-4296-ba72-9bf5a26ebe5d */
4646
GUID_INIT(0x6c501103, 0xc189, 0x4296,
4747
0xba, 0x72, 0x9b, 0xf5, 0xa2, 0x6e, 0xbe, 0x5d),
48+
/* Storage device needs D3 GUID: 5025030f-842f-4ab4-a561-99a5189762d0 */
49+
GUID_INIT(0x5025030f, 0x842f, 0x4ab4,
50+
0xa5, 0x61, 0x99, 0xa5, 0x18, 0x97, 0x62, 0xd0),
4851
};
4952

5053
/* ACPI _DSD data subnodes GUID: dbb8e3e6-5886-4ba6-8795-1319f52a966b */

drivers/block/null_blk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ struct nullb_device {
4949
unsigned long completion_nsec; /* time in ns to complete a request */
5050
unsigned long cache_size; /* disk cache size in MB */
5151
unsigned long zone_size; /* zone size in MB if device is zoned */
52+
unsigned long zone_capacity; /* zone capacity in MB if device is zoned */
5253
unsigned int zone_nr_conv; /* number of conventional zones */
5354
unsigned int submit_queues; /* number of submission queues */
5455
unsigned int home_node; /* home node for the device */

drivers/block/null_blk_main.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ static unsigned long g_zone_size = 256;
200200
module_param_named(zone_size, g_zone_size, ulong, S_IRUGO);
201201
MODULE_PARM_DESC(zone_size, "Zone size in MB when block device is zoned. Must be power-of-two: Default: 256");
202202

203+
static unsigned long g_zone_capacity;
204+
module_param_named(zone_capacity, g_zone_capacity, ulong, 0444);
205+
MODULE_PARM_DESC(zone_capacity, "Zone capacity in MB when block device is zoned. Can be less than or equal to zone size. Default: Zone size");
206+
203207
static unsigned int g_zone_nr_conv;
204208
module_param_named(zone_nr_conv, g_zone_nr_conv, uint, 0444);
205209
MODULE_PARM_DESC(zone_nr_conv, "Number of conventional zones when block device is zoned. Default: 0");
@@ -341,6 +345,7 @@ NULLB_DEVICE_ATTR(mbps, uint, NULL);
341345
NULLB_DEVICE_ATTR(cache_size, ulong, NULL);
342346
NULLB_DEVICE_ATTR(zoned, bool, NULL);
343347
NULLB_DEVICE_ATTR(zone_size, ulong, NULL);
348+
NULLB_DEVICE_ATTR(zone_capacity, ulong, NULL);
344349
NULLB_DEVICE_ATTR(zone_nr_conv, uint, NULL);
345350

346351
static ssize_t nullb_device_power_show(struct config_item *item, char *page)
@@ -457,6 +462,7 @@ static struct configfs_attribute *nullb_device_attrs[] = {
457462
&nullb_device_attr_badblocks,
458463
&nullb_device_attr_zoned,
459464
&nullb_device_attr_zone_size,
465+
&nullb_device_attr_zone_capacity,
460466
&nullb_device_attr_zone_nr_conv,
461467
NULL,
462468
};
@@ -510,7 +516,8 @@ nullb_group_drop_item(struct config_group *group, struct config_item *item)
510516

511517
static ssize_t memb_group_features_show(struct config_item *item, char *page)
512518
{
513-
return snprintf(page, PAGE_SIZE, "memory_backed,discard,bandwidth,cache,badblocks,zoned,zone_size,zone_nr_conv\n");
519+
return snprintf(page, PAGE_SIZE,
520+
"memory_backed,discard,bandwidth,cache,badblocks,zoned,zone_size,zone_capacity,zone_nr_conv\n");
514521
}
515522

516523
CONFIGFS_ATTR_RO(memb_group_, features);
@@ -571,6 +578,7 @@ static struct nullb_device *null_alloc_dev(void)
571578
dev->use_per_node_hctx = g_use_per_node_hctx;
572579
dev->zoned = g_zoned;
573580
dev->zone_size = g_zone_size;
581+
dev->zone_capacity = g_zone_capacity;
574582
dev->zone_nr_conv = g_zone_nr_conv;
575583
return dev;
576584
}

drivers/block/null_blk_zoned.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q)
2828
return -EINVAL;
2929
}
3030

31+
if (!dev->zone_capacity)
32+
dev->zone_capacity = dev->zone_size;
33+
34+
if (dev->zone_capacity > dev->zone_size) {
35+
pr_err("null_blk: zone capacity (%lu MB) larger than zone size (%lu MB)\n",
36+
dev->zone_capacity, dev->zone_size);
37+
return -EINVAL;
38+
}
39+
3140
dev->zone_size_sects = dev->zone_size << ZONE_SIZE_SHIFT;
3241
dev->nr_zones = dev_size >>
3342
(SECTOR_SHIFT + ilog2(dev->zone_size_sects));
@@ -47,6 +56,7 @@ int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q)
4756

4857
zone->start = sector;
4958
zone->len = dev->zone_size_sects;
59+
zone->capacity = zone->len;
5060
zone->wp = zone->start + zone->len;
5161
zone->type = BLK_ZONE_TYPE_CONVENTIONAL;
5262
zone->cond = BLK_ZONE_COND_NOT_WP;
@@ -59,6 +69,7 @@ int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q)
5969

6070
zone->start = zone->wp = sector;
6171
zone->len = dev->zone_size_sects;
72+
zone->capacity = dev->zone_capacity << ZONE_SIZE_SHIFT;
6273
zone->type = BLK_ZONE_TYPE_SEQWRITE_REQ;
6374
zone->cond = BLK_ZONE_COND_EMPTY;
6475

@@ -185,6 +196,9 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector,
185196
return BLK_STS_IOERR;
186197
}
187198

199+
if (zone->wp + nr_sectors > zone->start + zone->capacity)
200+
return BLK_STS_IOERR;
201+
188202
if (zone->cond != BLK_ZONE_COND_EXP_OPEN)
189203
zone->cond = BLK_ZONE_COND_IMP_OPEN;
190204

@@ -193,7 +207,7 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector,
193207
return ret;
194208

195209
zone->wp += nr_sectors;
196-
if (zone->wp == zone->start + zone->len)
210+
if (zone->wp == zone->start + zone->capacity)
197211
zone->cond = BLK_ZONE_COND_FULL;
198212
return BLK_STS_OK;
199213
default:

0 commit comments

Comments
 (0)