aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_sbc.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2012-06-17 18:40:53 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2012-07-16 17:29:12 -0700
commitad67f0d9e63ca94661e06a145f05a9302368a826 (patch)
tree2ada5604a0f61fa1f933f29cd4674f0cb95595c6 /drivers/target/target_core_sbc.c
parent0c2ad7d1132d8b089b1d37875917858e03610019 (diff)
target: move sync_cache to struct spc_ops
Add spc_ops->execute_sync_cache() caller for ->execute_cmd() setup, and update IBLOCK + FILEIO backends to use it. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_sbc.c')
-rw-r--r--drivers/target/target_core_sbc.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index da441b2782c..377c5105e27 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -204,19 +204,6 @@ static int sbc_emulate_write_same(struct se_cmd *cmd)
return 0;
}
-static int sbc_emulate_synchronize_cache(struct se_cmd *cmd)
-{
- if (!cmd->se_dev->transport->do_sync_cache) {
- pr_err("SYNCHRONIZE_CACHE emulation not supported"
- " for: %s\n", cmd->se_dev->transport->name);
- cmd->scsi_sense_reason = TCM_UNSUPPORTED_SCSI_OPCODE;
- return -ENOSYS;
- }
-
- cmd->se_dev->transport->do_sync_cache(cmd);
- return 0;
-}
-
static int sbc_emulate_verify(struct se_cmd *cmd)
{
target_complete_cmd(cmd, GOOD);
@@ -541,6 +528,9 @@ int sbc_parse_cdb(struct se_cmd *cmd, struct spc_ops *ops)
break;
case SYNCHRONIZE_CACHE:
case SYNCHRONIZE_CACHE_16:
+ if (!ops->execute_sync_cache)
+ goto out_unsupported_cdb;
+
/*
* Extract LBA and range to be flushed for emulated SYNCHRONIZE_CACHE
*/
@@ -562,7 +552,7 @@ int sbc_parse_cdb(struct se_cmd *cmd, struct spc_ops *ops)
if (sbc_check_valid_sectors(cmd) < 0)
goto out_invalid_cdb_field;
}
- cmd->execute_cmd = sbc_emulate_synchronize_cache;
+ cmd->execute_cmd = ops->execute_sync_cache;
break;
case UNMAP:
size = get_unaligned_be16(&cdb[7]);