Commit 0217da08 authored by Mike Christie's avatar Mike Christie Committed by Martin K. Petersen
Browse files

scsi: target: Rename sbc_ops to exec_cmd_ops



The next patches allow us to call the block layer's pr_ops from the
backends. This will require allowing the backends to hook into the cmd
processing for SPC commands, so this renames sbc_ops to a more generic
exec_cmd_ops.

Signed-off-by: default avatarMike Christie <michael.christie@oracle.com>
Link: https://lore.kernel.org/r/20230407200551.12660-15-michael.christie@oracle.com


Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 28c97ba3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -896,7 +896,7 @@ static void fd_free_prot(struct se_device *dev)
	fd_dev->fd_prot_file = NULL;
}

static struct sbc_ops fd_sbc_ops = {
static struct exec_cmd_ops fd_exec_cmd_ops = {
	.execute_rw		= fd_execute_rw,
	.execute_sync_cache	= fd_execute_sync_cache,
	.execute_write_same	= fd_execute_write_same,
@@ -906,7 +906,7 @@ static struct sbc_ops fd_sbc_ops = {
static sense_reason_t
fd_parse_cdb(struct se_cmd *cmd)
{
	return sbc_parse_cdb(cmd, &fd_sbc_ops);
	return sbc_parse_cdb(cmd, &fd_exec_cmd_ops);
}

static const struct target_backend_ops fileio_ops = {
+2 −2
Original line number Diff line number Diff line
@@ -869,7 +869,7 @@ static unsigned int iblock_get_io_opt(struct se_device *dev)
	return bdev_io_opt(bd);
}

static struct sbc_ops iblock_sbc_ops = {
static struct exec_cmd_ops iblock_exec_cmd_ops = {
	.execute_rw		= iblock_execute_rw,
	.execute_sync_cache	= iblock_execute_sync_cache,
	.execute_write_same	= iblock_execute_write_same,
@@ -879,7 +879,7 @@ static struct sbc_ops iblock_sbc_ops = {
static sense_reason_t
iblock_parse_cdb(struct se_cmd *cmd)
{
	return sbc_parse_cdb(cmd, &iblock_sbc_ops);
	return sbc_parse_cdb(cmd, &iblock_exec_cmd_ops);
}

static bool iblock_get_write_cache(struct se_device *dev)
+2 −2
Original line number Diff line number Diff line
@@ -643,14 +643,14 @@ static void rd_free_prot(struct se_device *dev)
	rd_release_prot_space(rd_dev);
}

static struct sbc_ops rd_sbc_ops = {
static struct exec_cmd_ops rd_exec_cmd_ops = {
	.execute_rw		= rd_execute_rw,
};

static sense_reason_t
rd_parse_cdb(struct se_cmd *cmd)
{
	return sbc_parse_cdb(cmd, &rd_sbc_ops);
	return sbc_parse_cdb(cmd, &rd_exec_cmd_ops);
}

static const struct target_backend_ops rd_mcp_ops = {
+7 −6
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ EXPORT_SYMBOL(sbc_get_write_same_sectors);
static sense_reason_t
sbc_execute_write_same_unmap(struct se_cmd *cmd)
{
	struct sbc_ops *ops = cmd->protocol_data;
	struct exec_cmd_ops *ops = cmd->protocol_data;
	sector_t nolb = sbc_get_write_same_sectors(cmd);
	sense_reason_t ret;

@@ -271,7 +271,8 @@ static inline unsigned long long transport_lba_64(unsigned char *cdb)
}

static sense_reason_t
sbc_setup_write_same(struct se_cmd *cmd, unsigned char flags, struct sbc_ops *ops)
sbc_setup_write_same(struct se_cmd *cmd, unsigned char flags,
		     struct exec_cmd_ops *ops)
{
	struct se_device *dev = cmd->se_dev;
	sector_t end_lba = dev->transport->get_blocks(dev) + 1;
@@ -340,7 +341,7 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char flags, struct sbc_ops *op
static sense_reason_t
sbc_execute_rw(struct se_cmd *cmd)
{
	struct sbc_ops *ops = cmd->protocol_data;
	struct exec_cmd_ops *ops = cmd->protocol_data;

	return ops->execute_rw(cmd, cmd->t_data_sg, cmd->t_data_nents,
			       cmd->data_direction);
@@ -566,7 +567,7 @@ static sense_reason_t compare_and_write_callback(struct se_cmd *cmd, bool succes
static sense_reason_t
sbc_compare_and_write(struct se_cmd *cmd)
{
	struct sbc_ops *ops = cmd->protocol_data;
	struct exec_cmd_ops *ops = cmd->protocol_data;
	struct se_device *dev = cmd->se_dev;
	sense_reason_t ret;
	int rc;
@@ -764,7 +765,7 @@ sbc_check_dpofua(struct se_device *dev, struct se_cmd *cmd, unsigned char *cdb)
}

sense_reason_t
sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops)
sbc_parse_cdb(struct se_cmd *cmd, struct exec_cmd_ops *ops)
{
	struct se_device *dev = cmd->se_dev;
	unsigned char *cdb = cmd->t_task_cdb;
@@ -1076,7 +1077,7 @@ EXPORT_SYMBOL(sbc_get_device_type);
static sense_reason_t
sbc_execute_unmap(struct se_cmd *cmd)
{
	struct sbc_ops *ops = cmd->protocol_data;
	struct exec_cmd_ops *ops = cmd->protocol_data;
	struct se_device *dev = cmd->se_dev;
	unsigned char *buf, *ptr = NULL;
	sector_t lba;
+2 −2
Original line number Diff line number Diff line
@@ -1431,7 +1431,7 @@ static struct target_opcode_descriptor tcm_opcode_write_verify16 = {

static bool tcm_is_ws_enabled(struct se_cmd *cmd)
{
	struct sbc_ops *ops = cmd->protocol_data;
	struct exec_cmd_ops *ops = cmd->protocol_data;
	struct se_device *dev = cmd->se_dev;

	return (dev->dev_attrib.emulate_tpws && !!ops->execute_unmap) ||
@@ -1544,7 +1544,7 @@ static struct target_opcode_descriptor tcm_opcode_sync_cache16 = {

static bool tcm_is_unmap_enabled(struct se_cmd *cmd)
{
	struct sbc_ops *ops = cmd->protocol_data;
	struct exec_cmd_ops *ops = cmd->protocol_data;
	struct se_device *dev = cmd->se_dev;

	return ops->execute_unmap && dev->dev_attrib.emulate_tpu;
Loading