Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756594AbcCUPid (ORCPT ); Mon, 21 Mar 2016 11:38:33 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:32973 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755984AbcCUPia (ORCPT ); Mon, 21 Mar 2016 11:38:30 -0400 Date: Mon, 21 Mar 2016 08:38:27 -0700 From: Christoph Hellwig To: "Darrick J. Wong" Cc: axboe@kernel.dk, torvalds@linux-foundation.org, bfields@fieldses.org, tytso@mit.edu, martin.petersen@oracle.com, linux-api@vger.kernel.org, david@fromorbit.com, linux-kernel@vger.kernel.org, shane.seymour@hpe.com, hch@infradead.org, linux-fsdevel@vger.kernel.org, jlayton@poochiereds.net, akpm@linux-foundation.org Subject: Re: [PATCH 3/3] block: implement (some of) fallocate for block devices Message-ID: <20160321153827.GA27230@infradead.org> References: <20160315194221.30093.70506.stgit@birch.djwong.org> <20160315194244.30093.6483.stgit@birch.djwong.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160315194244.30093.6483.stgit@birch.djwong.org> 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: 930 Lines: 32 On Tue, Mar 15, 2016 at 12:42:44PM -0700, Darrick J. Wong wrote: > #include > #include > #include > +#include Maybe keep this before asm/uaccess.h > +long blkdev_fallocate(struct file *file, int mode, loff_t start, loff_t len) should be marked static. > + /* We haven't a primitive for "ensure space exists" right now. */ > + if (!(mode & ~FALLOC_FL_KEEP_SIZE)) > + return -EOPNOTSUPP; I don't really understand the comment. But I think you'd be much better off with having blkdev_fallocate as just a tiny wrapper that has a switch for the supported modes, e.g. switch (mode) { case FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE: return blkdev_punch_hole(); case FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE:: return blkdev_zero_range(); default: return -EOPNOTSUPP; } > +EXPORT_SYMBOL_GPL(blkdev_fallocate); and no need to export it either..