mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 16:56:26 +00:00
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: Mike Christie <michael.christie@oracle.com> Link: https://lore.kernel.org/r/20230407200551.12660-15-michael.christie@oracle.com Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
28c97ba38f
commit
0217da08c1
@ -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 = {
|
||||
|
@ -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)
|
||||
|
@ -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 = {
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -62,7 +62,7 @@ struct target_backend_ops {
|
||||
struct configfs_attribute **tb_dev_action_attrs;
|
||||
};
|
||||
|
||||
struct sbc_ops {
|
||||
struct exec_cmd_ops {
|
||||
sense_reason_t (*execute_rw)(struct se_cmd *cmd, struct scatterlist *,
|
||||
u32, enum dma_data_direction);
|
||||
sense_reason_t (*execute_sync_cache)(struct se_cmd *cmd);
|
||||
@ -86,7 +86,7 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd *cmd);
|
||||
sense_reason_t spc_emulate_inquiry_std(struct se_cmd *, unsigned char *);
|
||||
sense_reason_t spc_emulate_evpd_83(struct se_cmd *, unsigned char *);
|
||||
|
||||
sense_reason_t sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops);
|
||||
sense_reason_t sbc_parse_cdb(struct se_cmd *cmd, struct exec_cmd_ops *ops);
|
||||
u32 sbc_get_device_rev(struct se_device *dev);
|
||||
u32 sbc_get_device_type(struct se_device *dev);
|
||||
sector_t sbc_get_write_same_sectors(struct se_cmd *cmd);
|
||||
|
Loading…
Reference in New Issue
Block a user