Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932374AbcCCSAJ (ORCPT ); Thu, 3 Mar 2016 13:00:09 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:39668 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754693AbcCCSAH (ORCPT ); Thu, 3 Mar 2016 13:00:07 -0500 Date: Thu, 3 Mar 2016 10:00:03 -0800 From: Christoph Hellwig To: Linus Torvalds Cc: "Theodore Ts'o" , "Darrick J. Wong" , Jens Axboe , Christoph Hellwig , Andrew Morton , "Martin K. Petersen" , Linux API , Linux Kernel Mailing List , shane.seymour@hpe.com, Bruce Fields , linux-fsdevel , Jeff Layton Subject: Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of blocks Message-ID: <20160303180003.GA6969@infradead.org> References: <20160302040932.16685.62789.stgit@birch.djwong.org> <20160302040947.16685.42926.stgit@birch.djwong.org> <20160302225601.GB21890@birch.djwong.org> <20160303170205.GD24012@thunk.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 929 Lines: 19 On Thu, Mar 03, 2016 at 09:55:38AM -0800, Linus Torvalds wrote: > Ugh. > > But that essentially says that we shouldn't expose this interface at > all (unless we trust our white-lists - I'm sure they are getting > better, but if nobody has ever really _relied_ on the zeroing behavior > of trim, then I guess there could be tons of bugs lurking). Fortunately what Ted said is close to the truth, but a little off. The mess about ATA is all real, and we work around it by never claiming discard zeroes data for any ATA device except those specificly whitelisted because the vendors gave guarantees for it (see the ATA_HORKAGE_ZERO_AFTER_TRIM flag and the commit introducing it). The reason why we don't use it unconditionally is simply because there are users that want blocks zeroed without deallocating the physical blocks. Now if you want to opt into the trim/unmap behavior is one question, but we clearly need the split.