aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorMike Christie <michael.christie@oracle.com>2022-06-28 15:02:28 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2022-07-07 16:53:52 -0400
commitd7c382c51d0379f38eee270db575018094826c73 (patch)
treee3c80c60e50cc630884239f56bf69fd66a02f1f0 /drivers/target
parentscsi: target: Add callout to configure UNMAP settings (diff)
downloadlinux-dev-d7c382c51d0379f38eee270db575018094826c73.tar.xz
linux-dev-d7c382c51d0379f38eee270db575018094826c73.zip
scsi: target: Add iblock configure_unmap callout
Move iblock's UNMAP setup code to a configure_unmap callout. Link: https://lore.kernel.org/r/20220628200230.15052-4-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>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_iblock.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 378c80313a0f..bbf69d9a29ed 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -76,6 +76,14 @@ free_dev:
return NULL;
}
+static bool iblock_configure_unmap(struct se_device *dev)
+{
+ struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
+
+ return target_configure_unmap_from_queue(&dev->dev_attrib,
+ ib_dev->ibd_bd);
+}
+
static int iblock_configure_device(struct se_device *dev)
{
struct iblock_dev *ib_dev = IBLOCK_DEV(dev);
@@ -119,10 +127,6 @@ static int iblock_configure_device(struct se_device *dev)
dev->dev_attrib.hw_max_sectors = queue_max_hw_sectors(q);
dev->dev_attrib.hw_queue_depth = q->nr_requests;
- if (target_configure_unmap_from_queue(&dev->dev_attrib, bd))
- pr_debug("IBLOCK: BLOCK Discard support available,"
- " disabled by default\n");
-
/*
* Enable write same emulation for IBLOCK and use 0xFFFF as
* the smaller WRITE_SAME(10) only has a two-byte block count.
@@ -899,6 +903,7 @@ static const struct target_backend_ops iblock_ops = {
.configure_device = iblock_configure_device,
.destroy_device = iblock_destroy_device,
.free_device = iblock_free_device,
+ .configure_unmap = iblock_configure_unmap,
.plug_device = iblock_plug_device,
.unplug_device = iblock_unplug_device,
.parse_cdb = iblock_parse_cdb,