Patchwork [64/74] Subject: [PATCH] fuse2fs: support allocating uninit blocks in fallocate

login
register
mail settings
Submitter Darrick J. Wong
Date Dec. 11, 2013, 1:25 a.m.
Message ID <20131211012525.30655.65703.stgit@birch.djwong.org>
Download mbox | patch
Permalink /patch/299733/
State Superseded
Headers show

Comments

Darrick J. Wong - Dec. 11, 2013, 1:25 a.m.
Use the new ext2fs_bmap2 flag to allocate uninitialized extents
when doing fallocate.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 misc/fuse2fs.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 317032c..105c54f 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -2798,8 +2798,8 @@  static int fallocate_helper(struct fuse_file_info *fp, int mode, off_t offset,
 	/* Allocate a bunch of blocks */
 	end = (offset + len - 1) / fs->blocksize;
 	for (blk = offset / fs->blocksize; blk <= end; blk++) {
-		err = ext2fs_bmap2(fs, fh->ino, NULL, NULL, BMAP_ALLOC, blk,
-				   0, &x);
+		err = ext2fs_bmap2(fs, fh->ino, NULL, NULL,
+				   BMAP_ALLOC | BMAP_UNINIT, blk, 0, &x);
 		if (err)
 			return translate_error(fs, fh->ino, err);
 	}
@@ -3164,6 +3164,9 @@  static int __translate_error(ext2_filsys fs, errcode_t err, ext2_ino_t ino,
 	case EXT2_ET_EA_KEY_NOT_FOUND:
 		ret = -ENODATA;
 		break;
+	case EXT2_ET_UNIMPLEMENTED:
+		ret = -EOPNOTSUPP;
+		break;
 	default:
 		is_err = 1;
 		ret = -EIO;