diff options
author | Roland Dreier <roland@purestorage.com> | 2011-07-05 13:34:52 -0700 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2011-07-22 09:37:47 +0000 |
commit | e22a7f075226c51f3f71b922e9eeb4f99fac1475 (patch) | |
tree | e0a04f974153136eafe13793ee59be58c37c5ffc /drivers/target/target_core_cdb.c | |
parent | b2eb705e00a9b9a9b3122192a7ab3e9058f0c48a (diff) | |
download | linux-e22a7f075226c51f3f71b922e9eeb4f99fac1475.tar.bz2 |
target: Implement Block Device Characteristics VPD page
Implement page B1h, Block Device Characteristics, so that we can report
a medium rotation rate of 1 (non-rotating / solid state) if the
is_nonrot device attribute is set; we update the iblock backend to set
this attribute if the underlying Linux block device has its nonrot
flag set.
Signed-off-by: Roland Dreier <roland@purestorage.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_cdb.c')
-rw-r--r-- | drivers/target/target_core_cdb.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c index 1157e0c6dba6..432253034de0 100644 --- a/drivers/target/target_core_cdb.c +++ b/drivers/target/target_core_cdb.c @@ -535,6 +535,22 @@ target_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf) return 0; } +/* Block Device Characteristics VPD page */ +static int +target_emulate_evpd_b1(struct se_cmd *cmd, unsigned char *buf) +{ + struct se_device *dev = cmd->se_dev; + + buf[0] = dev->transport->get_device_type(dev); + buf[3] = 0x3c; + + if (cmd->data_length >= 5 && + dev->se_sub_dev->se_dev_attrib.is_nonrot) + buf[5] = 1; + + return 0; +} + /* Thin Provisioning VPD */ static int target_emulate_evpd_b2(struct se_cmd *cmd, unsigned char *buf) @@ -599,6 +615,7 @@ static struct { { .page = 0x83, .emulate = target_emulate_evpd_83 }, { .page = 0x86, .emulate = target_emulate_evpd_86 }, { .page = 0xb0, .emulate = target_emulate_evpd_b0 }, + { .page = 0xb1, .emulate = target_emulate_evpd_b1 }, { .page = 0xb2, .emulate = target_emulate_evpd_b2 }, }; |