Skip to content

Commit

Permalink
target/rd: Add ramdisk bit for NULLIO operation
Browse files Browse the repository at this point in the history
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: Nicholas Bellinger <nab@linux-iscsi.org>
  • Loading branch information
Nicholas Bellinger committed May 11, 2013
1 parent 3eccfdb commit 52c0742
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
21 changes: 18 additions & 3 deletions drivers/target/target_core_rd.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,11 @@ rd_execute_rw(struct se_cmd *cmd)
u32 src_len;
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;
rd_offset = do_div(tmp, PAGE_SIZE);
rd_page = tmp;
Expand Down Expand Up @@ -373,11 +378,12 @@ rd_execute_rw(struct se_cmd *cmd)
}

enum {
Opt_rd_pages, Opt_err
Opt_rd_pages, Opt_rd_nullio, Opt_err
};

static match_table_t tokens = {
{Opt_rd_pages, "rd_pages=%d"},
{Opt_rd_nullio, "rd_nullio=%d"},
{Opt_err, NULL}
};

Expand Down Expand Up @@ -408,6 +414,14 @@ static ssize_t rd_set_configfs_dev_params(struct se_device *dev,
" Count: %u\n", rd_dev->rd_page_count);
rd_dev->rd_flags |= RDF_HAS_PAGE_COUNT;
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:
break;
}
Expand All @@ -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",
rd_dev->rd_dev_id);
bl += sprintf(b + bl, " PAGES/PAGE_SIZE: %u*%lu"
" SG_table_count: %u\n", rd_dev->rd_page_count,
PAGE_SIZE, rd_dev->sg_table_count);
" SG_table_count: %u nullio: %d\n", rd_dev->rd_page_count,
PAGE_SIZE, rd_dev->sg_table_count,
!!(rd_dev->rd_flags & RDF_NULLIO));
return bl;
}

Expand Down
1 change: 1 addition & 0 deletions drivers/target/target_core_rd.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct rd_dev_sg_table {
} ____cacheline_aligned;

#define RDF_HAS_PAGE_COUNT 0x01
#define RDF_NULLIO 0x02

struct rd_dev {
struct se_device dev;
Expand Down

0 comments on commit 52c0742

Please sign in to comment.