]> git.baikalelectronics.ru Git - kernel.git/commitdiff
scsi: target: Add callout to configure UNMAP settings
authorMike Christie <michael.christie@oracle.com>
Tue, 28 Jun 2022 20:02:27 +0000 (15:02 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 7 Jul 2022 20:53:52 +0000 (16:53 -0400)
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>
drivers/target/target_core_device.c
include/target/target_core_backend.h

index 25f33eb25337c685c6b19461c98c83702b8b6ee9..086ac9c9343c4bbab7952fe9bb33c0a94aab662b 100644 (file)
@@ -960,6 +960,12 @@ int target_configure_device(struct se_device *dev)
        ret = dev->transport->configure_device(dev);
        if (ret)
                goto out_free_index;
+
+       if (dev->transport->configure_unmap &&
+           dev->transport->configure_unmap(dev)) {
+               pr_debug("Discard support available, but disabled by default.\n");
+       }
+
        /*
         * XXX: there is not much point to have two different values here..
         */
index 773963a1e0b5362d4e5b4423f8534c23dc6d7957..a3c193df25b329cfd3edc579711c461cbb499be0 100644 (file)
@@ -37,6 +37,7 @@ struct target_backend_ops {
        struct se_dev_plug *(*plug_device)(struct se_device *se_dev);
        void (*unplug_device)(struct se_dev_plug *se_plug);
 
+       bool (*configure_unmap)(struct se_device *se_dev);
        ssize_t (*set_configfs_dev_params)(struct se_device *,
                                           const char *, ssize_t);
        ssize_t (*show_configfs_dev_params)(struct se_device *, char *);