[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160321153827.GA27230@infradead.org>
Date: Mon, 21 Mar 2016 08:38:27 -0700
From: Christoph Hellwig <hch@...radead.org>
To: "Darrick J. Wong" <darrick.wong@...cle.com>
Cc: axboe@...nel.dk, torvalds@...ux-foundation.org,
bfields@...ldses.org, tytso@....edu, martin.petersen@...cle.com,
linux-api@...r.kernel.org, david@...morbit.com,
linux-kernel@...r.kernel.org, shane.seymour@....com,
hch@...radead.org, linux-fsdevel@...r.kernel.org,
jlayton@...chiereds.net, akpm@...ux-foundation.org
Subject: Re: [PATCH 3/3] block: implement (some of) fallocate for block
devices
On Tue, Mar 15, 2016 at 12:42:44PM -0700, Darrick J. Wong wrote:
> #include <linux/cleancache.h>
> #include <linux/dax.h>
> #include <asm/uaccess.h>
> +#include <linux/falloc.h>
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..
Powered by blists - more mailing lists