diff options
author | Martin Svec <martin.svec@zoner.cz> | 2013-01-15 12:43:35 -0800 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-02-13 11:27:31 -0800 |
commit | 8f67835f1e389978bb0809d5e528961986aa2a69 (patch) | |
tree | 4bee48a706dec1da02e927309b6851f57730337c /drivers/target | |
parent | d09816ae8fc05322b4e37a589537b4ecdca28a0d (diff) | |
download | linux-3.10-8f67835f1e389978bb0809d5e528961986aa2a69.tar.gz linux-3.10-8f67835f1e389978bb0809d5e528961986aa2a69.tar.bz2 linux-3.10-8f67835f1e389978bb0809d5e528961986aa2a69.zip |
target/rd: improve sg_table lookup scalability
Sequential scan of rd_dev->sg_table_array in rd_get_sg_table is
a serious I/O performance bottleneck for large rd LUNs. Fix this
by computing the sg_table index directly from page offset because
all sg_tables (except the last one) have the same number of pages.
Tested with 90 GiB rd_mcp LUN, where the patch improved maximal
random R/W IOPS by more than 100-150%, depending on actual
hardware and SAN setup.
Signed-off-by: Martin Svec<martin.svec@zoner.cz>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_rd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c index 0457de362e6..b0fff52c990 100644 --- a/drivers/target/target_core_rd.c +++ b/drivers/target/target_core_rd.c @@ -256,10 +256,12 @@ static void rd_free_device(struct se_device *dev) static struct rd_dev_sg_table *rd_get_sg_table(struct rd_dev *rd_dev, u32 page) { - u32 i; struct rd_dev_sg_table *sg_table; + u32 i, sg_per_table = (RD_MAX_ALLOCATION_SIZE / + sizeof(struct scatterlist)); - for (i = 0; i < rd_dev->sg_table_count; i++) { + i = page / sg_per_table; + if (i < rd_dev->sg_table_count) { sg_table = &rd_dev->sg_table_array[i]; if ((sg_table->page_start_offset <= page) && (sg_table->page_end_offset >= page)) |