From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: RFC: always use REQ_OP_WRITE_ZEROES for zeroing offload Date: Wed, 29 Mar 2017 16:57:31 +0200 Message-ID: <0d2950ea-a1ab-7939-3c8e-d14038839761@redhat.com> References: <20170323143341.31549-1-hch@lst.de> <20170323155410.GD1138@soda.linbit> <20170323170221.GA20854@redhat.com> <20170323225256.GK1138@soda.linbit> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170323225256.GK1138@soda.linbit> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com To: Mike Snitzer , Christoph Hellwig , Jens Axboe , "Martin K. Petersen" , Alasdair G Kergon , "shli@kernel.org" , "philipp.reisner@linbit.com" , "linux-block@vger.kernel.org" , Linux SCSI List , "drbd-dev@lists.linbit.com" , dm , "linux-raid@vger.kernel.org" List-Id: linux-raid.ids On 23/03/2017 23:53, Lars Ellenberg wrote: > Thin does not claim to zero data on discard. which is ok, and correct, > because it only punches holes on full chunks (or whatever you call > them), and leaves the rest in the mapping tree as is. > > And that behaviour would prevent DRBD from exposing discards if > configured on top of thin. (see above) > > But thin *could* easily guarantee zeroing, by simply punching holes > where it can, and zeroing out the not fully-aligned partial start and > end of the range. That's the difference between REQ_OP_DISCARD (only punches holes on full chunks) and REQ_OP_WRITE_ZEROES with the REQ_UNMAP flag (punches holes + zeroes incomplete chunks). dm-thinp's REQ_OP_DISCARD should not do anything for unaligned parts. Instead, layers above should use REQ_OP_WRITE_ZEROES (with or without REQ_UNMAP, as required) if they need zeroes. dm-thinp would have to split off the partial chunks, and zero them in the lower-level device with REQ_OP_WRITE_ZEROES. Paolo