[linux-lvm] [PATCH] dm snapshot: add discard support to the snapshot-origin target [was: Re: Testing TRIM wi
DarkNovaNick at gmail.com
DarkNovaNick at gmail.com
Thu Apr 14 15:31:38 UTC 2011
On Apr 13, 2011 5:40pm, Mike Snitzer <snitzer at redhat.com> wrote:
> Unfortunately, the failed discard to the snapshot-origin device disables
> ext4's discards for the entire volume (even after you remove the
> snapshot).
> But the following patch fixes that:
> Subject: dm snapshot: add discard support to the snapshot-origin target
> Allow the snapshot-origin target to pass discards to the origin device
> (after any copyout of the region being discarded; but generally speaking
> that copyout won't be needed as the region will have already been copied
> to the cow).
> So for example, when you remove a file from an ext4 mounted origin
> volume it triggers copyout to the snapshot. When the DISCARD is then
> issued during the subsequent journal commit no copyout is needed.
> Signed-off-by: Mike Snitzer snitzer at redhat.com>
> ---
> drivers/md/dm-snap.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
> diff --git a/drivers/md/dm-snap.cb/drivers/md/dm-snap.c
> index a2d3309..028d216 100644
> --- a/drivers/md/dm-snap.c
> +++ b/drivers/md/dm-snap.c
> @@ -2076,6 +2076,7 @@ static int origin_ctr(struct dm_target *ti,
> unsigned int argc, char **argv)
> ti->private = dev;
> ti->num_flush_requests = 1;
> + ti->num_discard_requests = 1;
> return 0;
> }
> @@ -2153,7 +2154,7 @@ static int origin_iterate_devices(struct dm_target
> *ti,
> static struct target_type origin_target = {
> .name = "snapshot-origin",
> - .version = {1, 7, 1},
> + .version = {1, 8, 0},
> .module = THIS_MODULE,
> .ctr = origin_ctr,
> .dtr = origin_dtr,
Thanks, I will put that patch in my kernel. Do you anticipate this change
making its way into the main kernel source at some point in the future?
Thanks again,
Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/linux-lvm/attachments/20110414/a928324f/attachment.htm>
More information about the linux-lvm
mailing list