[dm-devel] Discard support for dm-snap
Hannes Reinecke
hare at suse.de
Fri Sep 3 05:45:58 UTC 2010
On Thu, Sep 02, 2010 at 01:21:05PM -0500, Douglas McClendon wrote:
> On 09/02/2010 03:05 AM, Hannes Reinecke wrote:
>> Hi all,
>>
>> now that we've got discard support in the block layer, are there plans
>> to update dm-snap to actually implement discard?
>> Looks like a valid addendum here; we could be freeing up unused blocks
>> thus freeing up space.
>> Especially helpful when using dm-snap to create a sparse device;
>> cf
>> http://www.mjmwired.net/kernel/Documentation/device-mapper/zero.txt
>>
>> Thoughts?
>
> Here was my similar suggestion and the discussion with Mike that followed-
>
> http://www.spinics.net/lists/dm-devel/msg11632.html
>
> I still feel like there is a disconnect between my thinking and Mike's, as
> I think I have the same fundamental interest as you do Hannes.
>
Yes and no. Snapshotting is similar but not identical to a sparse device.
> I.e. a perfect example is a simple dm-snapshot used for a livecd root
> filesystem. In that case, after boot, the user creates a new file in the
> rootfs, and that causes exception chunks (terminology?) to be created in
> the cow device of the dm-snapshot. Then, at a later point, the user
> deletes that file. It then seems 100% reasonable for the discard request
> to result in freeing the used resources in the cow device. I see no
> semantic reason why that data need be kept around any more than it need be
> kept around on an SSD after a file is deleted.
>
It has to be for snapshotting. The main idea of snapshotting is the
possibility to do a rollback, ie that you can mount an earlier snapshot
instead of the current one and re-start from there.
This ability is lost if a later snapshot deletes blocks permanently;
these blocks would have to be removed from _all_ snapshots to really
free up space. But this would make rollback impossible.
Tempting as it may sound, I fear it's not going to work in general.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare at suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
More information about the dm-devel
mailing list