Skip to content

Commit 4f43d64

Browse files
committed
Merge branch 'for-5.9/drivers' into for-5.9/block-merge
* for-5.9/drivers: (38 commits) block: add max_active_zones to blk-sysfs block: add max_open_zones to blk-sysfs s390/dasd: Use struct_size() helper s390/dasd: fix inability to use DASD with DIAG driver md-cluster: fix wild pointer of unlock_all_bitmaps() md/raid5-cache: clear MD_SB_CHANGE_PENDING before flushing stripes md: fix deadlock causing by sysfs_notify md: improve io stats accounting md: raid0/linear: fix dereference before null check on pointer mddev rsxx: switch from 'pci_free_consistent()' to 'dma_free_coherent()' nvme: remove ns->disk checks nvme-pci: use standard block status symbolic names nvme-pci: use the consistent return type of nvme_pci_iod_alloc_size() nvme-pci: add a blank line after declarations nvme-pci: fix some comments issues nvme-pci: remove redundant segment validation nvme: document quirked Intel models nvme: expose reconnect_delay and ctrl_loss_tmo via sysfs nvme: support for zoned namespaces nvme: support for multiple Command Sets Supported and Effects log pages ...
2 parents 9caaa66 + 659bf82 commit 4f43d64

39 files changed

+1115
-203
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/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/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:

drivers/block/rsxx/core.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -562,13 +562,15 @@ static int rsxx_eeh_frozen(struct pci_dev *dev)
562562

563563
for (i = 0; i < card->n_targets; i++) {
564564
if (card->ctrl[i].status.buf)
565-
pci_free_consistent(card->dev, STATUS_BUFFER_SIZE8,
566-
card->ctrl[i].status.buf,
567-
card->ctrl[i].status.dma_addr);
565+
dma_free_coherent(&card->dev->dev,
566+
STATUS_BUFFER_SIZE8,
567+
card->ctrl[i].status.buf,
568+
card->ctrl[i].status.dma_addr);
568569
if (card->ctrl[i].cmd.buf)
569-
pci_free_consistent(card->dev, COMMAND_BUFFER_SIZE8,
570-
card->ctrl[i].cmd.buf,
571-
card->ctrl[i].cmd.dma_addr);
570+
dma_free_coherent(&card->dev->dev,
571+
COMMAND_BUFFER_SIZE8,
572+
card->ctrl[i].cmd.buf,
573+
card->ctrl[i].cmd.dma_addr);
572574
}
573575

574576
return 0;
@@ -711,15 +713,15 @@ static pci_ers_result_t rsxx_slot_reset(struct pci_dev *dev)
711713
failed_hw_buffers_init:
712714
for (i = 0; i < card->n_targets; i++) {
713715
if (card->ctrl[i].status.buf)
714-
pci_free_consistent(card->dev,
715-
STATUS_BUFFER_SIZE8,
716-
card->ctrl[i].status.buf,
717-
card->ctrl[i].status.dma_addr);
716+
dma_free_coherent(&card->dev->dev,
717+
STATUS_BUFFER_SIZE8,
718+
card->ctrl[i].status.buf,
719+
card->ctrl[i].status.dma_addr);
718720
if (card->ctrl[i].cmd.buf)
719-
pci_free_consistent(card->dev,
720-
COMMAND_BUFFER_SIZE8,
721-
card->ctrl[i].cmd.buf,
722-
card->ctrl[i].cmd.dma_addr);
721+
dma_free_coherent(&card->dev->dev,
722+
COMMAND_BUFFER_SIZE8,
723+
card->ctrl[i].cmd.buf,
724+
card->ctrl[i].cmd.dma_addr);
723725
}
724726
failed_hw_setup:
725727
rsxx_eeh_failure(dev);

drivers/md/md-bitmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,7 @@ void md_bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector, bool force)
16311631
s += blocks;
16321632
}
16331633
bitmap->last_end_sync = jiffies;
1634-
sysfs_notify(&bitmap->mddev->kobj, NULL, "sync_completed");
1634+
sysfs_notify_dirent_safe(bitmap->mddev->sysfs_completed);
16351635
}
16361636
EXPORT_SYMBOL(md_bitmap_cond_end_sync);
16371637

0 commit comments

Comments
 (0)