From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 31 Oct 2016 12:36:16 -0400 (EDT) From: Mikulas Patocka To: Christoph Hellwig cc: Bart Van Assche , Jens Axboe , linux-block@vger.kernel.org, dm-devel@redhat.com, "Alasdair G. Kergon" , Mike Snitzer , "Martin K. Petersen" , Chaitanya Kulkarni Subject: Re: REQ_OP for zeroing, was Re: [dm-devel] [PATCH 1/4] brd: handle misaligned discard In-Reply-To: <20161028131457.GA15656@infradead.org> Message-ID: References: <20161024155756.GA48306@redhat.com> <20161025130712.GA12717@infradead.org> <20161025143719.GA51266@redhat.com> <710b07a3-9091-6935-37c4-ea1dcedcab4f@kernel.dk> <338b76f0-40d1-904f-66e0-f6455c5287e7@sandisk.com> <20161026215052.GA11679@infradead.org> <20161028131457.GA15656@infradead.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII List-ID: On Fri, 28 Oct 2016, Christoph Hellwig wrote: > [adding Chaitanya to Cc] > > On Fri, Oct 28, 2016 at 07:43:41AM -0400, Mikulas Patocka wrote: > > We could detect if the REQ_OP_WRITE_SAME command contains all zeroes and > > if it does, turn it into "Write Zeroes" or TRIM command (if the device > > guarantees zeroing on trim). If it doesn't contain all zeroes and the > > device doesn't support non-zero WRITE SAME, then reject it. > > I don't like this because it's very inefficient - we have to allocate > a payload first and then compare the whole payload for very operation. > > > Or maybe we could add a new command REQ_OP_WRITE_ZEROES - I'm not sure > > which of these two possibilities is better. > > Chaitanya actually did an initial prototype implementation of this for > NVMe that he shared with me. I liked it a lot and I think he'll be > ready to post it in a few days. Now that we have the REQ_OP* values > instead of mapping different command types to flags it's actually > surprisingly easy to add new block layer operations. OK - when it is in the kernel, let me know, so that I can write device mapper support for that. We should remove the flag "discard_zeroes_data" afterwards, because it is unreliable and impossible to support correctly in the device mapper. Mikulas