Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Mike Christie and committed by
Martin K. Petersen
0217da08 28c97ba3

+17 -16
+2 -2
drivers/target/target_core_file.c
··· 896 896 fd_dev->fd_prot_file = NULL; 897 897 } 898 898 899 - static struct sbc_ops fd_sbc_ops = { 899 + static struct exec_cmd_ops fd_exec_cmd_ops = { 900 900 .execute_rw = fd_execute_rw, 901 901 .execute_sync_cache = fd_execute_sync_cache, 902 902 .execute_write_same = fd_execute_write_same, ··· 906 906 static sense_reason_t 907 907 fd_parse_cdb(struct se_cmd *cmd) 908 908 { 909 - return sbc_parse_cdb(cmd, &fd_sbc_ops); 909 + return sbc_parse_cdb(cmd, &fd_exec_cmd_ops); 910 910 } 911 911 912 912 static const struct target_backend_ops fileio_ops = {
+2 -2
drivers/target/target_core_iblock.c
··· 869 869 return bdev_io_opt(bd); 870 870 } 871 871 872 - static struct sbc_ops iblock_sbc_ops = { 872 + static struct exec_cmd_ops iblock_exec_cmd_ops = { 873 873 .execute_rw = iblock_execute_rw, 874 874 .execute_sync_cache = iblock_execute_sync_cache, 875 875 .execute_write_same = iblock_execute_write_same, ··· 879 879 static sense_reason_t 880 880 iblock_parse_cdb(struct se_cmd *cmd) 881 881 { 882 - return sbc_parse_cdb(cmd, &iblock_sbc_ops); 882 + return sbc_parse_cdb(cmd, &iblock_exec_cmd_ops); 883 883 } 884 884 885 885 static bool iblock_get_write_cache(struct se_device *dev)
+2 -2
drivers/target/target_core_rd.c
··· 643 643 rd_release_prot_space(rd_dev); 644 644 } 645 645 646 - static struct sbc_ops rd_sbc_ops = { 646 + static struct exec_cmd_ops rd_exec_cmd_ops = { 647 647 .execute_rw = rd_execute_rw, 648 648 }; 649 649 650 650 static sense_reason_t 651 651 rd_parse_cdb(struct se_cmd *cmd) 652 652 { 653 - return sbc_parse_cdb(cmd, &rd_sbc_ops); 653 + return sbc_parse_cdb(cmd, &rd_exec_cmd_ops); 654 654 } 655 655 656 656 static const struct target_backend_ops rd_mcp_ops = {
+7 -6
drivers/target/target_core_sbc.c
··· 192 192 static sense_reason_t 193 193 sbc_execute_write_same_unmap(struct se_cmd *cmd) 194 194 { 195 - struct sbc_ops *ops = cmd->protocol_data; 195 + struct exec_cmd_ops *ops = cmd->protocol_data; 196 196 sector_t nolb = sbc_get_write_same_sectors(cmd); 197 197 sense_reason_t ret; 198 198 ··· 271 271 } 272 272 273 273 static sense_reason_t 274 - sbc_setup_write_same(struct se_cmd *cmd, unsigned char flags, struct sbc_ops *ops) 274 + sbc_setup_write_same(struct se_cmd *cmd, unsigned char flags, 275 + struct exec_cmd_ops *ops) 275 276 { 276 277 struct se_device *dev = cmd->se_dev; 277 278 sector_t end_lba = dev->transport->get_blocks(dev) + 1; ··· 341 340 static sense_reason_t 342 341 sbc_execute_rw(struct se_cmd *cmd) 343 342 { 344 - struct sbc_ops *ops = cmd->protocol_data; 343 + struct exec_cmd_ops *ops = cmd->protocol_data; 345 344 346 345 return ops->execute_rw(cmd, cmd->t_data_sg, cmd->t_data_nents, 347 346 cmd->data_direction); ··· 567 566 static sense_reason_t 568 567 sbc_compare_and_write(struct se_cmd *cmd) 569 568 { 570 - struct sbc_ops *ops = cmd->protocol_data; 569 + struct exec_cmd_ops *ops = cmd->protocol_data; 571 570 struct se_device *dev = cmd->se_dev; 572 571 sense_reason_t ret; 573 572 int rc; ··· 765 764 } 766 765 767 766 sense_reason_t 768 - sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops) 767 + sbc_parse_cdb(struct se_cmd *cmd, struct exec_cmd_ops *ops) 769 768 { 770 769 struct se_device *dev = cmd->se_dev; 771 770 unsigned char *cdb = cmd->t_task_cdb; ··· 1077 1076 static sense_reason_t 1078 1077 sbc_execute_unmap(struct se_cmd *cmd) 1079 1078 { 1080 - struct sbc_ops *ops = cmd->protocol_data; 1079 + struct exec_cmd_ops *ops = cmd->protocol_data; 1081 1080 struct se_device *dev = cmd->se_dev; 1082 1081 unsigned char *buf, *ptr = NULL; 1083 1082 sector_t lba;
+2 -2
drivers/target/target_core_spc.c
··· 1431 1431 1432 1432 static bool tcm_is_ws_enabled(struct se_cmd *cmd) 1433 1433 { 1434 - struct sbc_ops *ops = cmd->protocol_data; 1434 + struct exec_cmd_ops *ops = cmd->protocol_data; 1435 1435 struct se_device *dev = cmd->se_dev; 1436 1436 1437 1437 return (dev->dev_attrib.emulate_tpws && !!ops->execute_unmap) || ··· 1544 1544 1545 1545 static bool tcm_is_unmap_enabled(struct se_cmd *cmd) 1546 1546 { 1547 - struct sbc_ops *ops = cmd->protocol_data; 1547 + struct exec_cmd_ops *ops = cmd->protocol_data; 1548 1548 struct se_device *dev = cmd->se_dev; 1549 1549 1550 1550 return ops->execute_unmap && dev->dev_attrib.emulate_tpu;
+2 -2
include/target/target_core_backend.h
··· 62 62 struct configfs_attribute **tb_dev_action_attrs; 63 63 }; 64 64 65 - struct sbc_ops { 65 + struct exec_cmd_ops { 66 66 sense_reason_t (*execute_rw)(struct se_cmd *cmd, struct scatterlist *, 67 67 u32, enum dma_data_direction); 68 68 sense_reason_t (*execute_sync_cache)(struct se_cmd *cmd); ··· 86 86 sense_reason_t spc_emulate_inquiry_std(struct se_cmd *, unsigned char *); 87 87 sense_reason_t spc_emulate_evpd_83(struct se_cmd *, unsigned char *); 88 88 89 - sense_reason_t sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops); 89 + sense_reason_t sbc_parse_cdb(struct se_cmd *cmd, struct exec_cmd_ops *ops); 90 90 u32 sbc_get_device_rev(struct se_device *dev); 91 91 u32 sbc_get_device_type(struct se_device *dev); 92 92 sector_t sbc_get_write_same_sectors(struct se_cmd *cmd);