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

Re: [linux-lvm] [PATCH] dm snapshot: add discard support to the snapshot-origin target [was: Re: Testing TRIM wi



On Apr 13, 2011 5:40pm, Mike Snitzer <snitzer 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 redhat com>
>
> ---
>
>  drivers/md/dm-snap.c |    3 ++-
>
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
>
>
> diff --git a/drivers/md/dm-snap.c b/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
[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]