[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] [PATCH v2 03/12] dm: remove the DM_TARGET_SUPPORTS_DISCARDS feature flag



Eliminate the DM_TARGET_SUPPORTS_DISCARDS feature flag now that
dm_target's 'num_discard_requests' provides the mechanism to enable
discards on a per target basis.

Signed-off-by: Mike Snitzer <snitzer redhat com>
---
 drivers/md/dm-linear.c        |    1 -
 drivers/md/dm-table.c         |    2 +-
 drivers/md/dm.c               |    2 +-
 include/linux/device-mapper.h |    1 -
 4 files changed, 2 insertions(+), 4 deletions(-)

Index: linux-2.6-block/drivers/md/dm-linear.c
===================================================================
--- linux-2.6-block.orig/drivers/md/dm-linear.c
+++ linux-2.6-block/drivers/md/dm-linear.c
@@ -153,7 +153,6 @@ static struct target_type linear_target 
 	.ioctl  = linear_ioctl,
 	.merge  = linear_merge,
 	.iterate_devices = linear_iterate_devices,
-	.features = DM_TARGET_SUPPORTS_DISCARDS,
 };
 
 int __init dm_linear_init(void)
Index: linux-2.6-block/drivers/md/dm-table.c
===================================================================
--- linux-2.6-block.orig/drivers/md/dm-table.c
+++ linux-2.6-block/drivers/md/dm-table.c
@@ -773,7 +773,7 @@ int dm_table_add_target(struct dm_table 
 
 	t->highs[t->num_targets++] = tgt->begin + tgt->len - 1;
 
-	if (!(tgt->type->features & DM_TARGET_SUPPORTS_DISCARDS))
+	if (!tgt->num_discard_requests)
 		t->discards_supported = 0;
 
 	return 0;
Index: linux-2.6-block/drivers/md/dm.c
===================================================================
--- linux-2.6-block.orig/drivers/md/dm.c
+++ linux-2.6-block/drivers/md/dm.c
@@ -1242,7 +1242,7 @@ static int __clone_and_map_discard(struc
 	 * check was performed.
 	 */
 
-	if (!(ti->type->features & DM_TARGET_SUPPORTS_DISCARDS))
+	if (!ti->num_discard_requests)
 		return -EOPNOTSUPP;
 
 	max = max_io_len(ci->md, ci->sector, ti);
Index: linux-2.6-block/include/linux/device-mapper.h
===================================================================
--- linux-2.6-block.orig/include/linux/device-mapper.h
+++ linux-2.6-block/include/linux/device-mapper.h
@@ -130,7 +130,6 @@ void dm_put_device(struct dm_target *ti,
 /*
  * Target features
  */
-#define DM_TARGET_SUPPORTS_DISCARDS 0x00000001
 
 struct target_type {
 	uint64_t features;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]