aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Le Moal <damien.lemoal@wdc.com>2018-10-12 06:08:50 -0400
committerJens Axboe <axboe@kernel.dk>2018-10-25 13:17:40 -0400
commitbf5054569653c491ece544cc7ee333ae53b47121 (patch)
treec8ace4bf3912858b15dc1ab91d48a12fd57ae7f1
parente76239a3748c90a8b0e197f8f4544a8ce52f126e (diff)
block: Introduce blk_revalidate_disk_zones()
Drivers exposing zoned block devices have to initialize and maintain correctness (i.e. revalidate) of the device zone bitmaps attached to the device request queue (seq_zones_bitmap and seq_zones_wlock). To simplify coding this, introduce a generic helper function blk_revalidate_disk_zones() suitable for most (and likely all) cases. This new function always update the seq_zones_bitmap and seq_zones_wlock bitmaps as well as the queue nr_zones field when called for a disk using a request based queue. For a disk using a BIO based queue, only the number of zones is updated since these queues do not have schedulers and so do not need the zone bitmaps. With this change, the zone bitmap initialization code in sd_zbc.c can be replaced with a call to this function in sd_zbc_read_zones(), which is called from the disk revalidate block operation method. A call to blk_revalidate_disk_zones() is also added to the null_blk driver for devices created with the zoned mode enabled. Finally, to ensure that zoned devices created with dm-linear or dm-flakey expose the correct number of zones through sysfs, a call to blk_revalidate_disk_zones() is added to dm_table_set_restrictions(). The zone bitmaps allocated and initialized with blk_revalidate_disk_zones() are freed automatically from __blk_release_queue() using the block internal function blk_queue_free_zone_bitmaps(). Reviewed-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--block/blk-sysfs.c2
-rw-r--r--block/blk-zoned.c136
-rw-r--r--block/blk.h6
-rw-r--r--drivers/block/null_blk_main.c7
-rw-r--r--drivers/md/dm-table.c10
-rw-r--r--drivers/scsi/sd.c2
-rw-r--r--drivers/scsi/sd.h4
-rw-r--r--drivers/scsi/sd_zbc.c218
-rw-r--r--include/linux/blkdev.h7
9 files changed, 194 insertions, 198 deletions
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 92be8092ca4f..0641533597f1 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -852,6 +852,8 @@ static void __blk_release_queue(struct work_struct *work)
852 if (q->queue_tags) 852 if (q->queue_tags)
853 __blk_queue_free_tags(q); 853 __blk_queue_free_tags(q);
854 854
855 blk_queue_free_zone_bitmaps(q);
856
855 if (!q->mq_ops) { 857 if (!q->mq_ops) {
856 if (q->exit_rq_fn) 858 if (q->exit_rq_fn)
857 q->exit_rq_fn(q, q->fq->flush_rq); 859 q->exit_rq_fn(q, q->fq->flush_rq);
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 90cf503091d5..13ba2011a306 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -12,6 +12,7 @@
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/rbtree.h> 13#include <linux/rbtree.h>
14#include <linux/blkdev.h> 14#include <linux/blkdev.h>
15#include <linux/blk-mq.h>
15 16
16#include "blk.h" 17#include "blk.h"
17 18
@@ -359,3 +360,138 @@ int blkdev_reset_zones_ioctl(struct block_device *bdev, fmode_t mode,
359 return blkdev_reset_zones(bdev, zrange.sector, zrange.nr_sectors, 360 return blkdev_reset_zones(bdev, zrange.sector, zrange.nr_sectors,
360 GFP_KERNEL); 361 GFP_KERNEL);
361} 362}
363
364static inline unsigned long *blk_alloc_zone_bitmap(int node,
365 unsigned int nr_zones)
366{
367 return kcalloc_node(BITS_TO_LONGS(nr_zones), sizeof(unsigned long),
368 GFP_NOIO, node);
369}
370
371/*
372 * Allocate an array of struct blk_zone to get nr_zones zone information.
373 * The allocated array may be smaller than nr_zones.
374 */
375static struct blk_zone *blk_alloc_zones(int node, unsigned int *nr_zones)
376{
377 size_t size = *nr_zones * sizeof(struct blk_zone);
378 struct page *page;
379 int order;
380
381 for (order = get_order(size); order > 0; order--) {
382 page = alloc_pages_node(node, GFP_NOIO | __GFP_ZERO, order);
383 if (page) {
384 *nr_zones = min_t(unsigned int, *nr_zones,
385 (PAGE_SIZE << order) / sizeof(struct blk_zone));
386 return page_address(page);
387 }
388 }
389
390 return NULL;
391}
392
393void blk_queue_free_zone_bitmaps(struct request_queue *q)
394{
395 kfree(q->seq_zones_bitmap);
396 q->seq_zones_bitmap = NULL;
397 kfree(q->seq_zones_wlock);
398 q->seq_zones_wlock = NULL;
399}
400
401/**
402 * blk_revalidate_disk_zones - (re)allocate and initialize zone bitmaps
403 * @disk: Target disk
404 *
405 * Helper function for low-level device drivers to (re) allocate and initialize
406 * a disk request queue zone bitmaps. This functions should normally be called
407 * within the disk ->revalidate method. For BIO based queues, no zone bitmap
408 * is allocated.
409 */
410int blk_revalidate_disk_zones(struct gendisk *disk)
411{
412 struct request_queue *q = disk->queue;
413 unsigned int nr_zones = __blkdev_nr_zones(q, get_capacity(disk));
414 unsigned long *seq_zones_wlock = NULL, *seq_zones_bitmap = NULL;
415 unsigned int i, rep_nr_zones = 0, z = 0, nrz;
416 struct blk_zone *zones = NULL;
417 sector_t sector = 0;
418 int ret = 0;
419
420 /*
421 * BIO based queues do not use a scheduler so only q->nr_zones
422 * needs to be updated so that the sysfs exposed value is correct.
423 */
424 if (!queue_is_rq_based(q)) {
425 q->nr_zones = nr_zones;
426 return 0;
427 }
428
429 if (!blk_queue_is_zoned(q) || !nr_zones) {
430 nr_zones = 0;
431 goto update;
432 }
433
434 /* Allocate bitmaps */
435 ret = -ENOMEM;
436 seq_zones_wlock = blk_alloc_zone_bitmap(q->node, nr_zones);
437 if (!seq_zones_wlock)
438 goto out;
439 seq_zones_bitmap = blk_alloc_zone_bitmap(q->node, nr_zones);
440 if (!seq_zones_bitmap)
441 goto out;
442
443 /* Get zone information and initialize seq_zones_bitmap */
444 rep_nr_zones = nr_zones;
445 zones = blk_alloc_zones(q->node, &rep_nr_zones);
446 if (!zones)
447 goto out;
448
449 while (z < nr_zones) {
450 nrz = min(nr_zones - z, rep_nr_zones);
451 ret = blk_report_zones(disk, sector, zones, &nrz, GFP_NOIO);
452 if (ret)
453 goto out;
454 if (!nrz)
455 break;
456 for (i = 0; i < nrz; i++) {
457 if (zones[i].type != BLK_ZONE_TYPE_CONVENTIONAL)
458 set_bit(z, seq_zones_bitmap);
459 z++;
460 }
461 sector += nrz * blk_queue_zone_sectors(q);
462 }
463
464 if (WARN_ON(z != nr_zones)) {
465 ret = -EIO;
466 goto out;
467 }
468
469update:
470 /*
471 * Install the new bitmaps, making sure the queue is stopped and
472 * all I/Os are completed (i.e. a scheduler is not referencing the
473 * bitmaps).
474 */
475 blk_mq_freeze_queue(q);
476 q->nr_zones = nr_zones;
477 swap(q->seq_zones_wlock, seq_zones_wlock);
478 swap(q->seq_zones_bitmap, seq_zones_bitmap);
479 blk_mq_unfreeze_queue(q);
480
481out:
482 free_pages((unsigned long)zones,
483 get_order(rep_nr_zones * sizeof(struct blk_zone)));
484 kfree(seq_zones_wlock);
485 kfree(seq_zones_bitmap);
486
487 if (ret) {
488 pr_warn("%s: failed to revalidate zones\n", disk->disk_name);
489 blk_mq_freeze_queue(q);
490 blk_queue_free_zone_bitmaps(q);
491 blk_mq_unfreeze_queue(q);
492 }
493
494 return ret;
495}
496EXPORT_SYMBOL_GPL(blk_revalidate_disk_zones);
497
diff --git a/block/blk.h b/block/blk.h
index 93574baaa6b8..a1841b8ff129 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -490,4 +490,10 @@ static inline int blk_iolatency_init(struct request_queue *q) { return 0; }
490 490
491struct bio *blk_next_bio(struct bio *bio, unsigned int nr_pages, gfp_t gfp); 491struct bio *blk_next_bio(struct bio *bio, unsigned int nr_pages, gfp_t gfp);
492 492
493#ifdef CONFIG_BLK_DEV_ZONED
494void blk_queue_free_zone_bitmaps(struct request_queue *q);
495#else
496static inline void blk_queue_free_zone_bitmaps(struct request_queue *q) {}
497#endif
498
493#endif /* BLK_INTERNAL_H */ 499#endif /* BLK_INTERNAL_H */
diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
index 5ba426dbf377..09339203dfba 100644
--- a/drivers/block/null_blk_main.c
+++ b/drivers/block/null_blk_main.c
@@ -1528,6 +1528,13 @@ static int null_gendisk_register(struct nullb *nullb)
1528 disk->queue = nullb->q; 1528 disk->queue = nullb->q;
1529 strncpy(disk->disk_name, nullb->disk_name, DISK_NAME_LEN); 1529 strncpy(disk->disk_name, nullb->disk_name, DISK_NAME_LEN);
1530 1530
1531 if (nullb->dev->zoned) {
1532 int ret = blk_revalidate_disk_zones(disk);
1533
1534 if (ret != 0)
1535 return ret;
1536 }
1537
1531 add_disk(disk); 1538 add_disk(disk);
1532 return 0; 1539 return 0;
1533} 1540}
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 3d0e2c198f06..fb4bea20657b 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1937,6 +1937,16 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
1937 */ 1937 */
1938 if (blk_queue_add_random(q) && dm_table_all_devices_attribute(t, device_is_not_random)) 1938 if (blk_queue_add_random(q) && dm_table_all_devices_attribute(t, device_is_not_random))
1939 blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, q); 1939 blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, q);
1940
1941 /*
1942 * For a zoned target, the number of zones should be updated for the
1943 * correct value to be exposed in sysfs queue/nr_zones. For a BIO based
1944 * target, this is all that is needed. For a request based target, the
1945 * queue zone bitmaps must also be updated.
1946 * Use blk_revalidate_disk_zones() to handle this.
1947 */
1948 if (blk_queue_is_zoned(q))
1949 blk_revalidate_disk_zones(t->md->disk);
1940} 1950}
1941 1951
1942unsigned int dm_table_get_num_targets(struct dm_table *t) 1952unsigned int dm_table_get_num_targets(struct dm_table *t)
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 42c0f299021d..3bb2b3351e35 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3414,8 +3414,6 @@ static int sd_remove(struct device *dev)
3414 del_gendisk(sdkp->disk); 3414 del_gendisk(sdkp->disk);
3415 sd_shutdown(dev); 3415 sd_shutdown(dev);
3416 3416
3417 sd_zbc_remove(sdkp);
3418
3419 free_opal_dev(sdkp->opal_dev); 3417 free_opal_dev(sdkp->opal_dev);
3420 3418
3421 blk_register_region(devt, SD_MINORS, NULL, 3419 blk_register_region(devt, SD_MINORS, NULL,
diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h
index f72f20fd0d8b..1d63f3a23ffb 100644
--- a/drivers/scsi/sd.h
+++ b/drivers/scsi/sd.h
@@ -76,7 +76,6 @@ struct scsi_disk {
76#ifdef CONFIG_BLK_DEV_ZONED 76#ifdef CONFIG_BLK_DEV_ZONED
77 u32 nr_zones; 77 u32 nr_zones;
78 u32 zone_blocks; 78 u32 zone_blocks;
79 u32 zone_shift;
80 u32 zones_optimal_open; 79 u32 zones_optimal_open;
81 u32 zones_optimal_nonseq; 80 u32 zones_optimal_nonseq;
82 u32 zones_max_open; 81 u32 zones_max_open;
@@ -271,7 +270,6 @@ static inline int sd_is_zoned(struct scsi_disk *sdkp)
271#ifdef CONFIG_BLK_DEV_ZONED 270#ifdef CONFIG_BLK_DEV_ZONED
272 271
273extern int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buffer); 272extern int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buffer);
274extern void sd_zbc_remove(struct scsi_disk *sdkp);
275extern void sd_zbc_print_zones(struct scsi_disk *sdkp); 273extern void sd_zbc_print_zones(struct scsi_disk *sdkp);
276extern int sd_zbc_setup_reset_cmnd(struct scsi_cmnd *cmd); 274extern int sd_zbc_setup_reset_cmnd(struct scsi_cmnd *cmd);
277extern void sd_zbc_complete(struct scsi_cmnd *cmd, unsigned int good_bytes, 275extern void sd_zbc_complete(struct scsi_cmnd *cmd, unsigned int good_bytes,
@@ -288,8 +286,6 @@ static inline int sd_zbc_read_zones(struct scsi_disk *sdkp,
288 return 0; 286 return 0;
289} 287}
290 288
291static inline void sd_zbc_remove(struct scsi_disk *sdkp) {}
292
293static inline void sd_zbc_print_zones(struct scsi_disk *sdkp) {} 289static inline void sd_zbc_print_zones(struct scsi_disk *sdkp) {}
294 290
295static inline int sd_zbc_setup_reset_cmnd(struct scsi_cmnd *cmd) 291static inline int sd_zbc_setup_reset_cmnd(struct scsi_cmnd *cmd)
diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
index 0f2cfc81fce3..e06c48c866e4 100644
--- a/drivers/scsi/sd_zbc.c
+++ b/drivers/scsi/sd_zbc.c
@@ -425,191 +425,10 @@ out_free:
425 return ret; 425 return ret;
426} 426}
427 427
428/**
429 * sd_zbc_alloc_zone_bitmap - Allocate a zone bitmap (one bit per zone).
430 * @nr_zones: Number of zones to allocate space for.
431 * @numa_node: NUMA node to allocate the memory from.
432 */
433static inline unsigned long *
434sd_zbc_alloc_zone_bitmap(u32 nr_zones, int numa_node)
435{
436 return kcalloc_node(BITS_TO_LONGS(nr_zones), sizeof(unsigned long),
437 GFP_KERNEL, numa_node);
438}
439
440/**
441 * sd_zbc_get_seq_zones - Parse report zones reply to identify sequential zones
442 * @sdkp: disk used
443 * @buf: report reply buffer
444 * @buflen: length of @buf
445 * @zone_shift: logarithm base 2 of the number of blocks in a zone
446 * @seq_zones_bitmap: bitmap of sequential zones to set
447 *
448 * Parse reported zone descriptors in @buf to identify sequential zones and
449 * set the reported zone bit in @seq_zones_bitmap accordingly.
450 * Since read-only and offline zones cannot be written, do not
451 * mark them as sequential in the bitmap.
452 * Return the LBA after the last zone reported.
453 */
454static sector_t sd_zbc_get_seq_zones(struct scsi_disk *sdkp, unsigned char *buf,
455 unsigned int buflen, u32 zone_shift,
456 unsigned long *seq_zones_bitmap)
457{
458 sector_t lba, next_lba = sdkp->capacity;
459 unsigned int buf_len, list_length;
460 unsigned char *rec;
461 u8 type, cond;
462
463 list_length = get_unaligned_be32(&buf[0]) + 64;
464 buf_len = min(list_length, buflen);
465 rec = buf + 64;
466
467 while (rec < buf + buf_len) {
468 type = rec[0] & 0x0f;
469 cond = (rec[1] >> 4) & 0xf;
470 lba = get_unaligned_be64(&rec[16]);
471 if (type != ZBC_ZONE_TYPE_CONV &&
472 cond != ZBC_ZONE_COND_READONLY &&
473 cond != ZBC_ZONE_COND_OFFLINE)
474 set_bit(lba >> zone_shift, seq_zones_bitmap);
475 next_lba = lba + get_unaligned_be64(&rec[8]);
476 rec += 64;
477 }
478
479 return next_lba;
480}
481
482/**
483 * sd_zbc_setup_seq_zones_bitmap - Initialize a seq zone bitmap.
484 * @sdkp: target disk
485 * @zone_shift: logarithm base 2 of the number of blocks in a zone
486 * @nr_zones: number of zones to set up a seq zone bitmap for
487 *
488 * Allocate a zone bitmap and initialize it by identifying sequential zones.
489 */
490static unsigned long *
491sd_zbc_setup_seq_zones_bitmap(struct scsi_disk *sdkp, u32 zone_shift,
492 u32 nr_zones)
493{
494 struct request_queue *q = sdkp->disk->queue;
495 unsigned long *seq_zones_bitmap;
496 sector_t lba = 0;
497 unsigned char *buf;
498 int ret = -ENOMEM;
499
500 seq_zones_bitmap = sd_zbc_alloc_zone_bitmap(nr_zones, q->node);
501 if (!seq_zones_bitmap)
502 return ERR_PTR(-ENOMEM);
503
504 buf = kmalloc(SD_ZBC_BUF_SIZE, GFP_KERNEL);
505 if (!buf)
506 goto out;
507
508 while (lba < sdkp->capacity) {
509 ret = sd_zbc_do_report_zones(sdkp, buf, SD_ZBC_BUF_SIZE, lba,
510 true);
511 if (ret)
512 goto out;
513 lba = sd_zbc_get_seq_zones(sdkp, buf, SD_ZBC_BUF_SIZE,
514 zone_shift, seq_zones_bitmap);
515 }
516
517 if (lba != sdkp->capacity) {
518 /* Something went wrong */
519 ret = -EIO;
520 }
521
522out:
523 kfree(buf);
524 if (ret) {
525 kfree(seq_zones_bitmap);
526 return ERR_PTR(ret);
527 }
528 return seq_zones_bitmap;
529}
530
531static void sd_zbc_cleanup(struct scsi_disk *sdkp)
532{
533 struct request_queue *q = sdkp->disk->queue;
534
535 kfree(q->seq_zones_bitmap);
536 q->seq_zones_bitmap = NULL;
537
538 kfree(q->seq_zones_wlock);
539 q->seq_zones_wlock = NULL;
540
541 q->nr_zones = 0;
542}
543
544static int sd_zbc_setup(struct scsi_disk *sdkp, u32 zone_blocks)
545{
546 struct request_queue *q = sdkp->disk->queue;
547 u32 zone_shift = ilog2(zone_blocks);
548 u32 nr_zones;
549 int ret;
550
551 /* chunk_sectors indicates the zone size */
552 blk_queue_chunk_sectors(q,
553 logical_to_sectors(sdkp->device, zone_blocks));
554 nr_zones = round_up(sdkp->capacity, zone_blocks) >> zone_shift;
555
556 /*
557 * Initialize the device request queue information if the number
558 * of zones changed.
559 */
560 if (nr_zones != sdkp->nr_zones || nr_zones != q->nr_zones) {
561 unsigned long *seq_zones_wlock = NULL, *seq_zones_bitmap = NULL;
562 size_t zone_bitmap_size;
563
564 if (nr_zones) {
565 seq_zones_wlock = sd_zbc_alloc_zone_bitmap(nr_zones,
566 q->node);
567 if (!seq_zones_wlock) {
568 ret = -ENOMEM;
569 goto err;
570 }
571
572 seq_zones_bitmap = sd_zbc_setup_seq_zones_bitmap(sdkp,
573 zone_shift, nr_zones);
574 if (IS_ERR(seq_zones_bitmap)) {
575 ret = PTR_ERR(seq_zones_bitmap);
576 kfree(seq_zones_wlock);
577 goto err;
578 }
579 }
580 zone_bitmap_size = BITS_TO_LONGS(nr_zones) *
581 sizeof(unsigned long);
582 blk_mq_freeze_queue(q);
583 if (q->nr_zones != nr_zones) {
584 /* READ16/WRITE16 is mandatory for ZBC disks */
585 sdkp->device->use_16_for_rw = 1;
586 sdkp->device->use_10_for_rw = 0;
587
588 sdkp->zone_blocks = zone_blocks;
589 sdkp->zone_shift = zone_shift;
590 sdkp->nr_zones = nr_zones;
591 q->nr_zones = nr_zones;
592 swap(q->seq_zones_wlock, seq_zones_wlock);
593 swap(q->seq_zones_bitmap, seq_zones_bitmap);
594 } else if (memcmp(q->seq_zones_bitmap, seq_zones_bitmap,
595 zone_bitmap_size) != 0) {
596 memcpy(q->seq_zones_bitmap, seq_zones_bitmap,
597 zone_bitmap_size);
598 }
599 blk_mq_unfreeze_queue(q);
600 kfree(seq_zones_wlock);
601 kfree(seq_zones_bitmap);
602 }
603
604 return 0;
605
606err:
607 sd_zbc_cleanup(sdkp);
608 return ret;
609}
610
611int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf) 428int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf)
612{ 429{
430 struct gendisk *disk = sdkp->disk;
431 unsigned int nr_zones;
613 u32 zone_blocks; 432 u32 zone_blocks;
614 int ret; 433 int ret;
615 434
@@ -634,24 +453,39 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf)
634 goto err; 453 goto err;
635 454
636 /* The drive satisfies the kernel restrictions: set it up */ 455 /* The drive satisfies the kernel restrictions: set it up */
637 ret = sd_zbc_setup(sdkp, zone_blocks); 456 blk_queue_chunk_sectors(sdkp->disk->queue,
638 if (ret) 457 logical_to_sectors(sdkp->device, zone_blocks));
639 goto err; 458 nr_zones = round_up(sdkp->capacity, zone_blocks) >> ilog2(zone_blocks);
459
460 /* READ16/WRITE16 is mandatory for ZBC disks */
461 sdkp->device->use_16_for_rw = 1;
462 sdkp->device->use_10_for_rw = 0;
463
464 /*
465 * If something changed, revalidate the disk zone bitmaps once we have
466 * the capacity, that is on the second revalidate execution during disk
467 * scan and always during normal revalidate.
468 */
469 if (sdkp->first_scan)
470 return 0;
471 if (sdkp->zone_blocks != zone_blocks ||
472 sdkp->nr_zones != nr_zones ||
473 disk->queue->nr_zones != nr_zones) {
474 ret = blk_revalidate_disk_zones(disk);
475 if (ret != 0)
476 goto err;
477 sdkp->zone_blocks = zone_blocks;
478 sdkp->nr_zones = nr_zones;
479 }
640 480
641 return 0; 481 return 0;
642 482
643err: 483err:
644 sdkp->capacity = 0; 484 sdkp->capacity = 0;
645 sd_zbc_cleanup(sdkp);
646 485
647 return ret; 486 return ret;
648} 487}
649 488
650void sd_zbc_remove(struct scsi_disk *sdkp)
651{
652 sd_zbc_cleanup(sdkp);
653}
654
655void sd_zbc_print_zones(struct scsi_disk *sdkp) 489void sd_zbc_print_zones(struct scsi_disk *sdkp)
656{ 490{
657 if (!sd_is_zoned(sdkp) || !sdkp->capacity) 491 if (!sd_is_zoned(sdkp) || !sdkp->capacity)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 51fe6472ce02..4293dc1cd160 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -402,6 +402,7 @@ extern int blkdev_report_zones(struct block_device *bdev,
402 unsigned int *nr_zones, gfp_t gfp_mask); 402 unsigned int *nr_zones, gfp_t gfp_mask);
403extern int blkdev_reset_zones(struct block_device *bdev, sector_t sectors, 403extern int blkdev_reset_zones(struct block_device *bdev, sector_t sectors,
404 sector_t nr_sectors, gfp_t gfp_mask); 404 sector_t nr_sectors, gfp_t gfp_mask);
405extern int blk_revalidate_disk_zones(struct gendisk *disk);
405 406
406extern int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode, 407extern int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode,
407 unsigned int cmd, unsigned long arg); 408 unsigned int cmd, unsigned long arg);
@@ -414,6 +415,12 @@ static inline unsigned int blkdev_nr_zones(struct block_device *bdev)
414{ 415{
415 return 0; 416 return 0;
416} 417}
418
419static inline int blk_revalidate_disk_zones(struct gendisk *disk)
420{
421 return 0;
422}
423
417static inline int blkdev_report_zones_ioctl(struct block_device *bdev, 424static inline int blkdev_report_zones_ioctl(struct block_device *bdev,
418 fmode_t mode, unsigned int cmd, 425 fmode_t mode, unsigned int cmd,
419 unsigned long arg) 426 unsigned long arg)