From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: [PATCH 3/3] block: implement (some of) fallocate for block devices Date: Fri, 4 Mar 2016 19:13:25 -0800 Message-ID: References: <20160305005556.29738.66782.stgit@birch.djwong.org> <20160305005617.29738.85316.stgit@birch.djwong.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: <20160305005617.29738.85316.stgit-PTl6brltDGh4DFYR7WNSRA@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: "Darrick J. Wong" Cc: Jens Axboe , Christoph Hellwig , Theodore Ts'o , "Martin K. Petersen" , Linux API , Dave Chinner , Linux Kernel Mailing List , shane.seymour-ZPxbGqLxI0U@public.gmane.org, Bruce Fields , linux-fsdevel , Jeff Layton , Andrew Morton List-Id: linux-api@vger.kernel.org On Fri, Mar 4, 2016 at 4:56 PM, Darrick J. Wong wrote: > + > + /* We can't change the bdev size from here */ > + if (!(mode & FALLOC_FL_KEEP_SIZE)) > + return -EOPNOTSUPP; Oh, and this I think is wrong. The thing is, FALLOC_FL_KEEP_SIZE is only supposed to matter if the region is outside the existing length. So if y ou punch a hole in the middle of a file, you don't need FALLOC_FL_KEEP_SIZE. I would suggest removing this check entirely, since you already check that people don't try to punch holes past the end of the device. So FALLOC_FL_KEEP_SIZE is simply a non-issue, and shouldn't even be checked. Linus