提交 52c07423 编写于 作者: N Nicholas Bellinger

target/rd: Add ramdisk bit for NULLIO operation

This patch adds a rd_nullio parameter that allows RAMDISK_MCP backends
to function in NULLIO mode, where all se_cmd I/O is immediately completed
in rd_execute_rw() without actually performing the SGL memory copy.

This is useful for performance testing when the ramdisk SGL memory copy
begins to eat lots of cycles during heavy small block workloads, so allow
this bit to be enabled when necessary on a per rd_dev basis.
Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
上级 3eccfdb0
...@@ -291,6 +291,11 @@ rd_execute_rw(struct se_cmd *cmd) ...@@ -291,6 +291,11 @@ rd_execute_rw(struct se_cmd *cmd)
u32 src_len; u32 src_len;
u64 tmp; u64 tmp;
if (dev->rd_flags & RDF_NULLIO) {
target_complete_cmd(cmd, SAM_STAT_GOOD);
return 0;
}
tmp = cmd->t_task_lba * se_dev->dev_attrib.block_size; tmp = cmd->t_task_lba * se_dev->dev_attrib.block_size;
rd_offset = do_div(tmp, PAGE_SIZE); rd_offset = do_div(tmp, PAGE_SIZE);
rd_page = tmp; rd_page = tmp;
...@@ -373,11 +378,12 @@ rd_execute_rw(struct se_cmd *cmd) ...@@ -373,11 +378,12 @@ rd_execute_rw(struct se_cmd *cmd)
} }
enum { enum {
Opt_rd_pages, Opt_err Opt_rd_pages, Opt_rd_nullio, Opt_err
}; };
static match_table_t tokens = { static match_table_t tokens = {
{Opt_rd_pages, "rd_pages=%d"}, {Opt_rd_pages, "rd_pages=%d"},
{Opt_rd_nullio, "rd_nullio=%d"},
{Opt_err, NULL} {Opt_err, NULL}
}; };
...@@ -408,6 +414,14 @@ static ssize_t rd_set_configfs_dev_params(struct se_device *dev, ...@@ -408,6 +414,14 @@ static ssize_t rd_set_configfs_dev_params(struct se_device *dev,
" Count: %u\n", rd_dev->rd_page_count); " Count: %u\n", rd_dev->rd_page_count);
rd_dev->rd_flags |= RDF_HAS_PAGE_COUNT; rd_dev->rd_flags |= RDF_HAS_PAGE_COUNT;
break; break;
case Opt_rd_nullio:
match_int(args, &arg);
if (arg != 1)
break;
pr_debug("RAMDISK: Setting NULLIO flag: %d\n", arg);
rd_dev->rd_flags |= RDF_NULLIO;
break;
default: default:
break; break;
} }
...@@ -424,8 +438,9 @@ static ssize_t rd_show_configfs_dev_params(struct se_device *dev, char *b) ...@@ -424,8 +438,9 @@ static ssize_t rd_show_configfs_dev_params(struct se_device *dev, char *b)
ssize_t bl = sprintf(b, "TCM RamDisk ID: %u RamDisk Makeup: rd_mcp\n", ssize_t bl = sprintf(b, "TCM RamDisk ID: %u RamDisk Makeup: rd_mcp\n",
rd_dev->rd_dev_id); rd_dev->rd_dev_id);
bl += sprintf(b + bl, " PAGES/PAGE_SIZE: %u*%lu" bl += sprintf(b + bl, " PAGES/PAGE_SIZE: %u*%lu"
" SG_table_count: %u\n", rd_dev->rd_page_count, " SG_table_count: %u nullio: %d\n", rd_dev->rd_page_count,
PAGE_SIZE, rd_dev->sg_table_count); PAGE_SIZE, rd_dev->sg_table_count,
!!(rd_dev->rd_flags & RDF_NULLIO));
return bl; return bl;
} }
......
...@@ -22,6 +22,7 @@ struct rd_dev_sg_table { ...@@ -22,6 +22,7 @@ struct rd_dev_sg_table {
} ____cacheline_aligned; } ____cacheline_aligned;
#define RDF_HAS_PAGE_COUNT 0x01 #define RDF_HAS_PAGE_COUNT 0x01
#define RDF_NULLIO 0x02
struct rd_dev { struct rd_dev {
struct se_device dev; struct se_device dev;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册