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 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel