aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_spc.c
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2013-11-11 11:59:17 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2013-11-12 16:44:54 -0500
commit7f7caf6aa74a4f4ad21ebe08bf23b594fce45ca7 (patch)
tree058c55e859712486b9f6a8a20f3ea46add3a30eb /drivers/target/target_core_spc.c
parentf01b9f73392b48c6cda7c2c66594c73137c776da (diff)
target: Pass through I/O topology for block backstores
In addition to block size (already implemented), passing through alignment offset, logical-to-phys block exponent, I/O granularity and optimal I/O length will allow initiators to properly handle layout on LUNs with 4K block sizes. Tested with various weird values via scsi_debug module. One thing to look at with this patch is the new block limits values -- instead of granularity 1 optimal 8192, Lio will now be returning whatever the block device says, which may affect performance. Signed-off-by: Andy Grover <agrover@redhat.com> Acked-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_spc.c')
-rw-r--r--drivers/target/target_core_spc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
index 074539558a54..f89a86f29ee3 100644
--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -452,6 +452,7 @@ spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf)
452 struct se_device *dev = cmd->se_dev; 452 struct se_device *dev = cmd->se_dev;
453 u32 max_sectors; 453 u32 max_sectors;
454 int have_tp = 0; 454 int have_tp = 0;
455 int opt, min;
455 456
456 /* 457 /*
457 * Following spc3r22 section 6.5.3 Block Limits VPD page, when 458 * Following spc3r22 section 6.5.3 Block Limits VPD page, when
@@ -475,7 +476,10 @@ spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf)
475 /* 476 /*
476 * Set OPTIMAL TRANSFER LENGTH GRANULARITY 477 * Set OPTIMAL TRANSFER LENGTH GRANULARITY
477 */ 478 */
478 put_unaligned_be16(1, &buf[6]); 479 if (dev->transport->get_io_min && (min = dev->transport->get_io_min(dev)))
480 put_unaligned_be16(min / dev->dev_attrib.block_size, &buf[6]);
481 else
482 put_unaligned_be16(1, &buf[6]);
479 483
480 /* 484 /*
481 * Set MAXIMUM TRANSFER LENGTH 485 * Set MAXIMUM TRANSFER LENGTH
@@ -487,7 +491,10 @@ spc_emulate_evpd_b0(struct se_cmd *cmd, unsigned char *buf)
487 /* 491 /*
488 * Set OPTIMAL TRANSFER LENGTH 492 * Set OPTIMAL TRANSFER LENGTH
489 */ 493 */
490 put_unaligned_be32(dev->dev_attrib.optimal_sectors, &buf[12]); 494 if (dev->transport->get_io_opt && (opt = dev->transport->get_io_opt(dev)))
495 put_unaligned_be32(opt / dev->dev_attrib.block_size, &buf[12]);
496 else
497 put_unaligned_be32(dev->dev_attrib.optimal_sectors, &buf[12]);
491 498
492 /* 499 /*
493 * Exit now if we don't support TP. 500 * Exit now if we don't support TP.