From: Mike Snitzer <snitzer@redhat.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: dm-devel@redhat.com
Subject: [PATCH] dm: allow a target to relax discard restrictions
Date: Wed, 27 Apr 2011 17:55:38 -0400 [thread overview]
Message-ID: <20110427215537.GA13386@redhat.com> (raw)
In-Reply-To: <20110427151911.GF7294@redhat.com>
A target, like the upcoming thin provisioning target, may want to allow
discards even if the underlying devices do not support them natively.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
drivers/md/dm-table.c | 4 ++++
include/linux/device-mapper.h | 6 ++++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index cb8380c..75b0430 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1354,6 +1354,10 @@ bool dm_table_supports_discards(struct dm_table *t)
while (i < dm_table_get_num_targets(t)) {
ti = dm_table_get_target(t, i++);
+ /* target supports discards even if underlying devices cannot */
+ if (ti->discards_supported)
+ return 1;
+
if (ti->type->iterate_devices &&
ti->type->iterate_devices(ti, device_discard_capable, NULL))
return 1;
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h
index 32a4423..c9e7ff5 100644
--- a/include/linux/device-mapper.h
+++ b/include/linux/device-mapper.h
@@ -191,6 +191,12 @@ struct dm_target {
/* Used to provide an error string from the ctr */
char *error;
+
+ /*
+ * Enable discards even if the table's underlying devices
+ * do not have native discard support.
+ */
+ unsigned discards_supported:1;
};
/* Each target can link one of these into the table */
next prev parent reply other threads:[~2011-04-27 21:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-27 15:06 [PATCH, RFC] dm: relax discard restrictions Christoph Hellwig
2011-04-27 15:19 ` Mike Snitzer
2011-04-27 21:55 ` Mike Snitzer [this message]
2011-04-28 8:41 ` [PATCH] dm: allow a target to " Christoph Hellwig
2011-04-28 15:04 ` Mike Snitzer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110427215537.GA13386@redhat.com \
--to=snitzer@redhat.com \
--cc=dm-devel@redhat.com \
--cc=hch@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox