Skip to contentSkip to conversation

dm: discard support for the linear target

PATCH Edward Thornber 1 participant 1 message Jun 28, 2010 1 message not in the archive Device mapper

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1022306007.323911277741886883.JavaMail.root@zmail05.collab.prod.int.phx2.redhat.com

Edward Thornber

author Reviewed-by
#1 lore raw

----- Original Message -----
From: "Mike Snitzer" <[email protected]>
To: [email protected]
Cc: [email protected], "Christoph Hellwig" <[email protected]>, "martin petersen" <[email protected]>
Sent: Saturday, 26 June, 2010 21:31:24 GMT +00:00 GMT Britain, Ireland, Portugal
Subject: [dm-devel] [PATCH 1/2 v2] dm: discard support for the linear target

Allow discards to be passed through to a single device linear mapping. Introduce DM_TARGET_SUPPORTS_DISCARDS target features flag that each target must set once discard support is added.

Verify table's underlying devices support discards prior to setting the associated DM device as capable of discards (via QUEUE_FLAG_DISCARD).

---
 drivers/md/dm-linear.c        |    1 +
 drivers/md/dm-table.c         |   51 ++++++++++++++++++++++++++++++++++
 drivers/md/dm.c               |   60 ++++++++++++++++++++++++++++++++--------
 drivers/md/dm.h               |    1 +
 include/linux/device-mapper.h |    1 +
 5 files changed, 102 insertions(+), 12 deletions(-)
drivers/md/dm-linear.c +1 -0
index 9200dbf..7071f17 100644
@@ -152,6 +152,7 @@ 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)
drivers/md/dm-table.c +51 -0

87 lines not on this page · raw message

drivers/md/dm.c +48 -12

99 lines not on this page · raw message

drivers/md/dm.h +1 -0
index 664a5ae..032ce2f 100644
@@ -62,6 +62,7 @@ int dm_table_any_busy_target(struct dm_table *t);
 int dm_table_set_type(struct dm_table *t);
 unsigned dm_table_get_type(struct dm_table *t);
 bool dm_table_request_based(struct dm_table *t);
+bool dm_table_supports_discards(struct dm_table *t);
 int dm_table_alloc_md_mempools(struct dm_table *t);
 void dm_table_free_md_mempools(struct dm_table *t);
 struct dm_md_mempools *dm_table_get_md_mempools(struct dm_table *t);
include/linux/device-mapper.h +1 -0
index 1381cd9..e44cbcb 100644
@@ -130,6 +130,7 @@ void dm_put_device(struct dm_target *ti, struct dm_dev *d);
 /*
  * Target features
  */
+#define DM_TARGET_SUPPORTS_DISCARDS 0x00000001
 
 struct target_type {
 	uint64_t features;
Signature · 6 lines
1.6.5.rc2

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel