diff options
author | Christoph Hellwig <hch@infradead.org> | 2012-06-17 18:40:52 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-07-16 17:29:12 -0700 |
commit | 0c2ad7d1132d8b089b1d37875917858e03610019 (patch) | |
tree | e86cc118497605026a15c0e97630c57aeb625793 /drivers/target/target_core_iblock.c | |
parent | e1306bdab3af8bef620990a99e613f99eb30065c (diff) | |
download | talos-obmc-linux-0c2ad7d1132d8b089b1d37875917858e03610019.tar.gz talos-obmc-linux-0c2ad7d1132d8b089b1d37875917858e03610019.zip |
target: add struct spc_ops + initial ->execute_rw pointer usage
Remove the execute_cmd method in struct se_subsystem_api, and always use the
one directly in struct se_cmd. To make life simpler for SBC virtual backends
a struct spc_ops that is passed to sbc_parse_cmd is added. For now it
only contains an execute_rw member, but more will follow with the subsequent
commits.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_iblock.c')
-rw-r--r-- | drivers/target/target_core_iblock.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index c2d4ccbb7133..eb94367380c1 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -514,9 +514,11 @@ static void iblock_submit_bios(struct bio_list *list, int rw) blk_finish_plug(&plug); } -static int iblock_execute_cmd(struct se_cmd *cmd, struct scatterlist *sgl, - u32 sgl_nents, enum dma_data_direction data_direction) +static int iblock_execute_rw(struct se_cmd *cmd) { + struct scatterlist *sgl = cmd->t_data_sg; + u32 sgl_nents = cmd->t_data_nents; + enum dma_data_direction data_direction = cmd->data_direction; struct se_device *dev = cmd->se_dev; struct iblock_req *ibr; struct bio *bio; @@ -663,6 +665,15 @@ static void iblock_bio_done(struct bio *bio, int err) iblock_complete_cmd(cmd); } +static struct spc_ops iblock_spc_ops = { + .execute_rw = iblock_execute_rw, +}; + +static int iblock_parse_cdb(struct se_cmd *cmd) +{ + return sbc_parse_cdb(cmd, &iblock_spc_ops); +} + static struct se_subsystem_api iblock_template = { .name = "iblock", .owner = THIS_MODULE, @@ -674,8 +685,7 @@ static struct se_subsystem_api iblock_template = { .allocate_virtdevice = iblock_allocate_virtdevice, .create_virtdevice = iblock_create_virtdevice, .free_device = iblock_free_device, - .parse_cdb = sbc_parse_cdb, - .execute_cmd = iblock_execute_cmd, + .parse_cdb = iblock_parse_cdb, .do_discard = iblock_do_discard, .do_sync_cache = iblock_emulate_sync_cache, .check_configfs_dev_params = iblock_check_configfs_dev_params, |