Re: [PATCH 3/3] block: implement (some of) fallocate for block devices
From: Darrick J. Wong <hidden>
Date: 2016-03-21 17:53:20
Also in:
linux-fsdevel, lkml
On Mon, Mar 21, 2016 at 08:38:27AM -0700, Christoph Hellwig wrote:
On Tue, Mar 15, 2016 at 12:42:44PM -0700, Darrick J. Wong wrote:quoted
#include <linux/cleancache.h> #include <linux/dax.h> #include <asm/uaccess.h> +#include <linux/falloc.h>Maybe keep this before asm/uaccess.hquoted
+long blkdev_fallocate(struct file *file, int mode, loff_t start, loff_t len)should be marked static.
Ok (to both).
quoted
+ /* 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
I don't know of a block device primitive that corresponds to the "default" mode of fallocate, as documented in the manpage (i.e. mode == 0). I agree that the whole thing could be simplified in the manner you point out below.
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; }quoted
+EXPORT_SYMBOL_GPL(blkdev_fallocate);and no need to export it either..
Ok. --D
-- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html