Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

target: pscsi: Introduce TYPE_ZBC support

TYPE_ZBC host managed zoned block devices are also block devices
despite the non-standard device type (14h). Handle them similarly to
regular TYPE_DISK devices.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>

authored by

Damien Le Moal and committed by
Nicholas Bellinger
016a5fec e5dc9a70

+11 -6
+11 -6
drivers/target/target_core_pscsi.c
··· 382 382 spin_unlock_irq(sh->host_lock); 383 383 /* 384 384 * Claim exclusive struct block_device access to struct scsi_device 385 - * for TYPE_DISK using supplied udev_path 385 + * for TYPE_DISK and TYPE_ZBC using supplied udev_path 386 386 */ 387 387 bd = blkdev_get_by_path(dev->udev_path, 388 388 FMODE_WRITE|FMODE_READ|FMODE_EXCL, pdv); ··· 400 400 return ret; 401 401 } 402 402 403 - pr_debug("CORE_PSCSI[%d] - Added TYPE_DISK for %d:%d:%d:%llu\n", 404 - phv->phv_host_id, sh->host_no, sd->channel, sd->id, sd->lun); 403 + pr_debug("CORE_PSCSI[%d] - Added TYPE_%s for %d:%d:%d:%llu\n", 404 + phv->phv_host_id, sd->type == TYPE_DISK ? "DISK" : "ZBC", 405 + sh->host_no, sd->channel, sd->id, sd->lun); 405 406 return 0; 406 407 } 407 408 ··· 521 520 */ 522 521 switch (sd->type) { 523 522 case TYPE_DISK: 523 + case TYPE_ZBC: 524 524 ret = pscsi_create_type_disk(dev, sd); 525 525 break; 526 526 default: ··· 578 576 if (sd) { 579 577 /* 580 578 * Release exclusive pSCSI internal struct block_device claim for 581 - * struct scsi_device with TYPE_DISK from pscsi_create_type_disk() 579 + * struct scsi_device with TYPE_DISK or TYPE_ZBC 580 + * from pscsi_create_type_disk() 582 581 */ 583 - if ((sd->type == TYPE_DISK) && pdv->pdv_bd) { 582 + if ((sd->type == TYPE_DISK || sd->type == TYPE_ZBC) && 583 + pdv->pdv_bd) { 584 584 blkdev_put(pdv->pdv_bd, 585 585 FMODE_WRITE|FMODE_READ|FMODE_EXCL); 586 586 pdv->pdv_bd = NULL; ··· 1004 1000 req->end_io_data = cmd; 1005 1001 scsi_req(req)->cmd_len = scsi_command_size(pt->pscsi_cdb); 1006 1002 scsi_req(req)->cmd = &pt->pscsi_cdb[0]; 1007 - if (pdv->pdv_sd->type == TYPE_DISK) 1003 + if (pdv->pdv_sd->type == TYPE_DISK || 1004 + pdv->pdv_sd->type == TYPE_ZBC) 1008 1005 req->timeout = PS_TIMEOUT_DISK; 1009 1006 else 1010 1007 req->timeout = PS_TIMEOUT_OTHER;