Skip to content

Commit

Permalink
scsi: sd: Ignore zoned field for host-managed devices
Browse files Browse the repository at this point in the history
There is no good match of the zoned field of the block device
characteristics page for host-managed devices. For these devices, the
zoning model is derived directly from the device type. So ignore the
zoned field for these drives.

[mkp: typo]

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Damien Le Moal authored and Martin K. Petersen committed Jan 17, 2017
1 parent 26f2819 commit 68af412
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions drivers/scsi/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2784,13 +2784,21 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp)
queue_flag_clear_unlocked(QUEUE_FLAG_ADD_RANDOM, q);
}

sdkp->zoned = (buffer[8] >> 4) & 3;
if (sdkp->zoned == 1)
q->limits.zoned = BLK_ZONED_HA;
else if (sdkp->device->type == TYPE_ZBC)
if (sdkp->device->type == TYPE_ZBC) {
/* Host-managed */
q->limits.zoned = BLK_ZONED_HM;
else
q->limits.zoned = BLK_ZONED_NONE;
} else {
sdkp->zoned = (buffer[8] >> 4) & 3;
if (sdkp->zoned == 1)
/* Host-aware */
q->limits.zoned = BLK_ZONED_HA;
else
/*
* Treat drive-managed devices as
* regular block devices.
*/
q->limits.zoned = BLK_ZONED_NONE;
}
if (blk_queue_is_zoned(q) && sdkp->first_scan)
sd_printk(KERN_NOTICE, sdkp, "Host-%s zoned block device\n",
q->limits.zoned == BLK_ZONED_HM ? "managed" : "aware");
Expand Down

0 comments on commit 68af412

Please sign in to comment.