[zfs-discuss] windows on thin provision zvol: how to force trim?

Tim Chase tim at chase2k.com
Wed Oct 16 00:02:18 EDT 2013


On 10/15/2013 08:33 PM, Richard Laager wrote:
> On Tue, 2013-10-15 at 12:44 +0100, Gordan Bobic wrote:
>> I don't think they are expected to shrink.
> I disagree; they should shrink, though I'm not sure I've tested this on
> Linux. I'm pretty confident I've personally tested this on OpenIndiana,
> but it was a while ago.
>
ZoL handles discard properly as of 30930fb 
<https://github.com/zfsonlinux/zfs/commit/30930fba219642cb1dadf1c8ef60ff799e3dc424> 
which was committed on Feb 9, 2012 (plus a few follow-up commits to fix 
some issues).

Here's a quick test running on recent ZoL code:
> # zfs create -V 1g tank/junk
> # dd bs=128k if=/dev/urandom of=/dev/zvol/tank/junk
> dd: error writing ‘/dev/zvol/tank/junk’: No space left on device
> ...
> # zfs get referenced tank/junk
> NAME          PROPERTY    VALUE  SOURCE
> tank/junk  referenced  1.01G  -
> # blkdiscard -o 0 -l 1073741824 /dev/zvol/tank/junk
> # zfs get referenced tank/junk
> NAME          PROPERTY    VALUE  SOURCE
> tank/junk  referenced  16K    -
If the volume was thinly provisioned (refreservation unset), the discard 
will properly return the blocks to the pool for use by other volumes or 
file systems.

In other words, running for example an ext4 file system with discard 
enabled atop a zvol on ZoL should behave as expected.

     - Tim


To unsubscribe from this group and stop receiving emails from it, send an email to zfs-discuss+unsubscribe at zfsonlinux.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.zfsonlinux.org/pipermail/zfs-discuss/attachments/20131015/f2298246/attachment.html>


More information about the zfs-discuss mailing list