Skip to content

Commit 6b206a5

Browse files
mikechristiemartinkpetersen
authored andcommitted
scsi: target: Add callout to configure UNMAP settings
Add a callout to configure a backend's UNMAP settings. This will be used to allow userspace to configure UNMAP after the initial device setup, similar to how we can set up the other attributes post device configuration. Link: https://lore.kernel.org/r/20220628200230.15052-3-michael.christie@oracle.com Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 036d890 commit 6b206a5

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

drivers/target/target_core_device.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,12 @@ int target_configure_device(struct se_device *dev)
960960
ret = dev->transport->configure_device(dev);
961961
if (ret)
962962
goto out_free_index;
963+
964+
if (dev->transport->configure_unmap &&
965+
dev->transport->configure_unmap(dev)) {
966+
pr_debug("Discard support available, but disabled by default.\n");
967+
}
968+
963969
/*
964970
* XXX: there is not much point to have two different values here..
965971
*/

include/target/target_core_backend.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ struct target_backend_ops {
3737
struct se_dev_plug *(*plug_device)(struct se_device *se_dev);
3838
void (*unplug_device)(struct se_dev_plug *se_plug);
3939

40+
bool (*configure_unmap)(struct se_device *se_dev);
4041
ssize_t (*set_configfs_dev_params)(struct se_device *,
4142
const char *, ssize_t);
4243
ssize_t (*show_configfs_dev_params)(struct se_device *, char *);

0 commit comments

Comments
 (0)