[Devel] [PATCH RHEL7 COMMIT] ext4: rename fallocate(FALLOC_FL_CONVERT_AND_EXTEND)

Konstantin Khorenko khorenko at virtuozzo.com
Wed Mar 16 02:23:59 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.10.1.vz7.12.2
------>
commit b0c729774ea13fa8d84bb9b56b5ef35a75eed392
Author: Maxim Patlasov <mpatlasov at virtuozzo.com>
Date:   Wed Mar 16 13:23:59 2016 +0400

    ext4: rename fallocate(FALLOC_FL_CONVERT_AND_EXTEND)
    
    Patchset description:
    
    The patch reworks the feature and renames it to FALLOC_FL_CONVERT_UNWRITTEN.
    
    Intended use:
    
    0) pos := i_size_read(inode); len := 1MB; prealloc := 100MB
    
    1) fallocate(file, 0, pos, prealloc)
    2) fiemap(inode, &fieinfo, pos, 1)
    3) dio pwrite(block_device, data, len, fi_extent.fe_physical)
    4) fallocate(file, FALLOC_FL_CONVERT_UNWRITTEN, pos, len)
    
    ===
    This patch description:
    
    The feature doesn't extend i_size anymore. Let's rename it properly:
    
    s/convert_and_extend/convert_unwritten
    s/CONVERT_AND_EXTEND/CONVERT_UNWRITTEN
    
    https://jira.sw.ru/browse/PSBM-22381
    
    Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
    Acked-by: Dmitry Monakhov <dmonakhov at virtuozzo.com>
---
 fs/ext4/extents.c           | 10 +++++-----
 fs/open.c                   |  6 +++---
 include/uapi/linux/falloc.h |  3 +--
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index cf248ce..71b4b620 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4666,8 +4666,8 @@ retry:
 	ext4_std_error(inode->i_sb, err);
 }
 
-static int ext4_convert_and_extend(struct inode *inode, loff_t offset,
-				   loff_t len)
+static int ext4_convert_unwritten(struct inode *inode, loff_t offset,
+				  loff_t len)
 {
 	int err;
 
@@ -4938,7 +4938,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 	/* Return error if mode is not supported */
 	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
 		     FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE |
-		     FALLOC_FL_CONVERT_AND_EXTEND))
+		     FALLOC_FL_CONVERT_UNWRITTEN))
 		return -EOPNOTSUPP;
 
 	/* If data is about to change we must drop csum */
@@ -4949,8 +4949,8 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 	if (mode & FALLOC_FL_PUNCH_HOLE)
 		return ext4_punch_hole(inode, offset, len);
 
-	if (mode & FALLOC_FL_CONVERT_AND_EXTEND)
-		return ext4_convert_and_extend(inode, offset, len);
+	if (mode & FALLOC_FL_CONVERT_UNWRITTEN)
+		return ext4_convert_unwritten(inode, offset, len);
 
 	ret = ext4_convert_inline_data(inode);
 	if (ret)
diff --git a/fs/open.c b/fs/open.c
index 22b9699..bc60c05 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -233,7 +233,7 @@ int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 	/* Return error if mode is not supported */
 	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
 		     FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE |
-		     FALLOC_FL_CONVERT_AND_EXTEND))
+		     FALLOC_FL_CONVERT_UNWRITTEN))
 		return -EOPNOTSUPP;
 
 	/* Punch hole and zero range are mutually exclusive */
@@ -252,8 +252,8 @@ int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 		return -EINVAL;
 
 	/* Convert-and-extend should only be used exclusively. */
-	if ((mode & FALLOC_FL_CONVERT_AND_EXTEND) &&
-	    (mode & ~FALLOC_FL_CONVERT_AND_EXTEND))
+	if ((mode & FALLOC_FL_CONVERT_UNWRITTEN) &&
+	    (mode & ~FALLOC_FL_CONVERT_UNWRITTEN))
 		return -EINVAL;
 
 	if (!(file->f_mode & FMODE_WRITE))
diff --git a/include/uapi/linux/falloc.h b/include/uapi/linux/falloc.h
index 9461043..10cccca 100644
--- a/include/uapi/linux/falloc.h
+++ b/include/uapi/linux/falloc.h
@@ -4,8 +4,7 @@
 #define FALLOC_FL_KEEP_SIZE	0x01 /* default is extend size */
 #define FALLOC_FL_PUNCH_HOLE	0x02 /* de-allocates range */
 #define FALLOC_FL_NO_HIDE_STALE	0x04 /* reserved codepoint */
-#define FALLOC_FL_CONVERT_AND_EXTEND 0x100 /* mark extents as initialized
-					    * and extend i_size */
+#define FALLOC_FL_CONVERT_UNWRITTEN 0x100 /* mark extents as initialized */
 
 
 /*


More information about the Devel mailing list