From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Darrick J. Wong" Subject: Re: [PATCH 2/2] block: create ioctl to discard-or-zeroout a range of blocks Date: Thu, 3 Mar 2016 10:12:40 -0800 Message-ID: <20160303181240.GB8782@birch.djwong.org> References: <20160302040932.16685.62789.stgit@birch.djwong.org> <20160302040947.16685.42926.stgit@birch.djwong.org> <20160302225601.GB21890@birch.djwong.org> <20160303180924.GA4116@infradead.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20160303180924.GA4116-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Christoph Hellwig Cc: "Martin K. Petersen" , Linus Torvalds , Jens Axboe , Andrew Morton , Linux API , Linux Kernel Mailing List , shane.seymour-ZPxbGqLxI0U@public.gmane.org, Bruce Fields , linux-fsdevel , Jeff Layton List-Id: linux-api@vger.kernel.org On Thu, Mar 03, 2016 at 10:09:24AM -0800, Christoph Hellwig wrote: > On Thu, Mar 03, 2016 at 01:01:11PM -0500, Martin K. Petersen wrote: > > That's not entirely true. Writing the blocks may cause them to be > > allocated on the storage device (depending on which flags we feed it in > > WRITE SAME). > > > > The filesystems people were wanted the following semantics: > > > > - deallocate, don't care about contents for future reads (discard) > > - deallocate, guarantee zeroes on future reads (zeroout) > > - (re)allocate, guarantee zeroes on future reads (zeroout) > > > > Maybe we just need a better naming scheme... > > In filesystem terms we have two and three: > > - FALLOC_FL_PUNCH_HOLE assures zeroes are returned, but space is > deallocated as much as possible > - FALLOC_FL_ZERO_RANGE assures zeroes are returned, AND blocks are > actually allocated > > Returning stale blocks in a file system is a nasty security risk, so > we don't do that, and so shouldn't storage that offers any kind > of multi tenancy, and if it's just VMs using multiple partitions on it. Any particular reason why we can't just implement those two fallocate flags for block devices? --D