[dm-devel] dm thin pool discarding

Martin Wilck mwilck at suse.de
Thu Jan 10 16:12:17 UTC 2019


On Thu, 2019-01-10 at 16:55 +0100, Zdenek Kabelac wrote:
> Dne 10. 01. 19 v 16:23 Martin Wilck napsal(a):
> > On Thu, 2019-01-10 at 16:08 +0100, Zdenek Kabelac wrote:
> > > Dne 10. 01. 19 v 14:41 Martin Wilck napsal(a):
> > > > I for one would find it very attractive if dm-thin had a mode
> > > > supporting fast zeroout.
> > > 
> > > I believe '/sys/block/*/queue/discard_zeroes_data  is now always
> > > returning
> > > false for any device as it's been considered as unreliable logic.
> > > 
> > > So using 'discard' for zeroing is not really an option here.
> > 
> > True. But we have "write_zeroes_max_bytes" instead. In device
> > mapper
> > terms, it's "num_write_zeroes_bios", which isn't set for dm-thin.
> > With
> > the logic outlined above, it could be set, AFAICT.
> 
> I assume this is valid request for enhancement of thin-pool target.
> However  this  'WRITE_SAME'  or whatever scsi low-level command is
> that is 
> basically targeted for thinLV user.
> 
> So in this case the most effective 'zeroing' of thinLV areas is its
> discard.

That's what I have in mind. Basically, one could implement a
"write_zeroes" operation in a similar manner as discard is implemented
now. We'd just need to be careful with the case where a write_zeroes
request isn't aligned to chunk size (aka discard_granularity), and
instead of a noop, either return an error, or fall back to "slow"
zeroing for the unaligned pieces. I believe that wouldn't be a big
problem in practice - prudent users would respect the granularity
anyway.

Regards
Martin





More information about the dm-devel mailing list