On Wed, 26 Oct 2016, Christoph Hellwig wrote: > On Wed, Oct 26, 2016 at 05:46:11PM -0400, Mikulas Patocka wrote: > > I think the proper thing would be to move "discard_zeroes_data" flag into > > the bio itself - there would be REQ_OP_DISCARD and REQ_OP_DISCARD_ZERO - > > and if the device doesn't support REQ_OP_DISCARD_ZERO, it rejects the bio > > and the caller is supposed to do zeroing manually. > > Yes, Martin and I have come to a similar conclusion recently. An > additional aspect is that NVMe has a Write Zeroes command which is more > limited than what REQ_OP_WRITE_SAME does. > > So I think the right way is to add a REQ_OP_WRITE_ZEROES (or > REQ_OP_ZERO) and have modifies if it may discard or not. 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. Or maybe we could add a new command REQ_OP_WRITE_ZEROES - I'm not sure which of these two possibilities is better. Mikulas -- To unsubscribe from this list: send the line "unsubscribe linux-block" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html