summaryrefslogtreecommitdiff
path: root/drivers/target/target_core_iblock.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-06-19 15:10:59 +0200
committerNicholas Bellinger <nab@linux-iscsi.org>2015-06-23 00:43:44 -0700
commit62e4694256dd3cbe301ebc0da799df8779b97014 (patch)
tree4d0900d5d8d2dcb5acd2f1e2d390c9d18e1e0629 /drivers/target/target_core_iblock.c
parent7a971b1b3055f0e76ff09b8fd0dd809ea3b48279 (diff)
target: simplify UNMAP handling
Move a little more processing into the core code, and lift the previous do_unmap callback into the sbc_ops structure. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_iblock.c')
-rw-r--r--drivers/target/target_core_iblock.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index ae8ad2da6632..0a2308891c81 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -416,10 +416,9 @@ iblock_execute_sync_cache(struct se_cmd *cmd)
}
static sense_reason_t
-iblock_do_unmap(struct se_cmd *cmd, void *priv,
- sector_t lba, sector_t nolb)
+iblock_execute_unmap(struct se_cmd *cmd, sector_t lba, sector_t nolb)
{
- struct block_device *bdev = priv;
+ struct block_device *bdev = IBLOCK_DEV(cmd->se_dev)->ibd_bd;
int ret;
ret = blkdev_issue_discard(bdev, lba, nolb, GFP_KERNEL, 0);
@@ -432,22 +431,13 @@ iblock_do_unmap(struct se_cmd *cmd, void *priv,
}
static sense_reason_t
-iblock_execute_unmap(struct se_cmd *cmd)
-{
- struct block_device *bdev = IBLOCK_DEV(cmd->se_dev)->ibd_bd;
-
- return sbc_execute_unmap(cmd, iblock_do_unmap, bdev);
-}
-
-static sense_reason_t
iblock_execute_write_same_unmap(struct se_cmd *cmd)
{
- struct block_device *bdev = IBLOCK_DEV(cmd->se_dev)->ibd_bd;
sector_t lba = cmd->t_task_lba;
sector_t nolb = sbc_get_write_same_sectors(cmd);
sense_reason_t ret;
- ret = iblock_do_unmap(cmd, bdev, lba, nolb);
+ ret = iblock_execute_unmap(cmd, lba, nolb);
if (ret)
return ret;