[PATCH 0/1] ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask

chuguangqing posted 1 patch 2 months, 3 weeks ago
There is a newer version of this series
fs/ext4/extents.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH 0/1] ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask
Posted by chuguangqing 2 months, 3 weeks ago
Add FALLOC_FL_ALLOCATE_RANGE to the set of supported fallocate mode flags.
This change improves code clarity and maintains by explicitly showing 
this flag in the supported flags mask.

chuguangqing (1):
  ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask

 fs/ext4/extents.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.43.5
[PATCH 0/1] ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask
Posted by chuguangqing 2 months, 3 weeks ago
Add FALLOC_FL_ALLOCATE_RANGE to the set of supported fallocate mode flags.
This change improves code clarity and maintains by explicitly showing 
this flag in the supported flags mask.

chuguangqing (1):
  ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask

 fs/ext4/extents.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.43.5
[PATCH 1/1] ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask
Posted by chuguangqing 2 months, 3 weeks ago
Note that since FALLOC_FL_ALLOCATE_RANGE is defined as 0x00, this addition
has no functional modifications.

Signed-off-by: chuguangqing <chuguangqing@inspur.com>
---
 fs/ext4/extents.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index b43aa82c1b39..f0f9363fd9fd 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4784,9 +4784,9 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 		return -EOPNOTSUPP;
 
 	/* Return error if mode is not supported */
-	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
-		     FALLOC_FL_ZERO_RANGE | FALLOC_FL_COLLAPSE_RANGE |
-		     FALLOC_FL_INSERT_RANGE | FALLOC_FL_WRITE_ZEROES))
+	if (mode & ~(FALL_C_FL_ALLOCATE_RANGE | FALLOC_FL_KEEP_SIZE |
+		     FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE |
+		     FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE))
 		return -EOPNOTSUPP;
 
 	inode_lock(inode);
-- 
2.43.5
[PATCH 1/1] ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask
Posted by chuguangqing 2 months, 3 weeks ago
Note that since FALLOC_FL_ALLOCATE_RANGE is defined as 0x00, this addition
has no functional modifications.

Signed-off-by: chuguangqing <chuguangqing@inspur.com>
---
 fs/ext4/extents.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index b43aa82c1b39..f0f9363fd9fd 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4784,9 +4784,9 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 		return -EOPNOTSUPP;
 
 	/* Return error if mode is not supported */
-	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
-		     FALLOC_FL_ZERO_RANGE | FALLOC_FL_COLLAPSE_RANGE |
-		     FALLOC_FL_INSERT_RANGE | FALLOC_FL_WRITE_ZEROES))
+	if (mode & ~(FALLOC_FL_ALLOCATE_RANGE | FALLOC_FL_KEEP_SIZE |
+		     FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE |
+		     FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE))
 		return -EOPNOTSUPP;
 
 	inode_lock(inode);
-- 
2.43.5
Re: [PATCH 1/1] ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask
Posted by Zhang Yi 2 months, 3 weeks ago
On 2025/7/15 14:45, chuguangqing wrote:
> Note that since FALLOC_FL_ALLOCATE_RANGE is defined as 0x00, this addition
> has no functional modifications.
> 
> Signed-off-by: chuguangqing <chuguangqing@inspur.com>
> ---
>  fs/ext4/extents.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index b43aa82c1b39..f0f9363fd9fd 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -4784,9 +4784,9 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
>  		return -EOPNOTSUPP;
>  
>  	/* Return error if mode is not supported */
> -	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
> -		     FALLOC_FL_ZERO_RANGE | FALLOC_FL_COLLAPSE_RANGE |
> -		     FALLOC_FL_INSERT_RANGE | FALLOC_FL_WRITE_ZEROES))
> +	if (mode & ~(FALLOC_FL_ALLOCATE_RANGE | FALLOC_FL_KEEP_SIZE |
> +		     FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE |
> +		     FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE))
>  		return -EOPNOTSUPP;
>  
>  	inode_lock(inode);

Why did you remove the FALLOC_FL_WRITE_ZEROES support?

Regards,
Yi.
[PATCH v3 0/1] Re: Re: [PATCH 1/1] ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask
Posted by chuguangqing 2 months, 3 weeks ago
> Why did you remove the FALLOC_FL_WRITE_ZEROES support?

It's missing FALLOC_FL_WRITE_ZEROES. tks for a lot.

chuguangqing (1):
  ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask

 fs/ext4/extents.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.43.5
[PATCH v3] ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask
Posted by chuguangqing 2 months, 3 weeks ago
Add FALLOC_FL_ALLOCATE_RANGE to the set of supported fallocate mode flags.
This change improves code clarity and maintains by explicitly showing
this flag in the supported flags mask.

Note that since FALLOC_FL_ALLOCATE_RANGE is defined as 0x00, this addition
has no functional modifications.

Signed-off-by: chuguangqing <chuguangqing@inspur.com>
---
 fs/ext4/extents.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index b43aa82c1b39..46cbb8697252 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4784,9 +4784,10 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 		return -EOPNOTSUPP;
 
 	/* Return error if mode is not supported */
-	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
-		     FALLOC_FL_ZERO_RANGE | FALLOC_FL_COLLAPSE_RANGE |
-		     FALLOC_FL_INSERT_RANGE | FALLOC_FL_WRITE_ZEROES))
+	if (mode & ~(FALLOC_FL_ALLOCATE_RANGE | FALLOC_FL_KEEP_SIZE |
+		     FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE |
+		     FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE |
+		     FALLOC_FL_WRITE_ZEROES))
 		return -EOPNOTSUPP;
 
 	inode_lock(inode);
-- 
2.43.5
Re: [PATCH v3] ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask
Posted by Zhang Yi 2 months, 3 weeks ago
On 2025/7/16 11:04, chuguangqing wrote:
> Add FALLOC_FL_ALLOCATE_RANGE to the set of supported fallocate mode flags.
> This change improves code clarity and maintains by explicitly showing
> this flag in the supported flags mask.
> 
> Note that since FALLOC_FL_ALLOCATE_RANGE is defined as 0x00, this addition
> has no functional modifications.
> 
> Signed-off-by: chuguangqing <chuguangqing@inspur.com>

OK, now it looks good to me. Feel free to add:

Reviewed-by: Zhang Yi <yi.zhang@huawei.com>

> ---
>  fs/ext4/extents.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index b43aa82c1b39..46cbb8697252 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -4784,9 +4784,10 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
>  		return -EOPNOTSUPP;
>  
>  	/* Return error if mode is not supported */
> -	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
> -		     FALLOC_FL_ZERO_RANGE | FALLOC_FL_COLLAPSE_RANGE |
> -		     FALLOC_FL_INSERT_RANGE | FALLOC_FL_WRITE_ZEROES))
> +	if (mode & ~(FALLOC_FL_ALLOCATE_RANGE | FALLOC_FL_KEEP_SIZE |
> +		     FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE |
> +		     FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE |
> +		     FALLOC_FL_WRITE_ZEROES))
>  		return -EOPNOTSUPP;
>  
>  	inode_lock(inode);
Re: [PATCH 1/1] ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask
Posted by Theodore Ts'o 2 months, 3 weeks ago
On Tue, Jul 15, 2025 at 02:45:18PM +0800, chuguangqing wrote:
> Note that since FALLOC_FL_ALLOCATE_RANGE is defined as 0x00, this addition
> has no functional modifications.
> 
> Signed-off-by: chuguangqing <chuguangqing@inspur.com>

I'll note that this isn't something which any of the other file
systems (btrfs, xfs, etc.) is doing.

				- Ted
[PATCH v2 0/1] ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask
Posted by chuguangqing 2 months, 3 weeks ago
The original patch had a spelling mistake. I re-sent a new version (V2) earlier, but perhaps you missed it. 
I encountered a compilation error today.
[auto build test ERROR on next-20250714] [cannot apply to tytso-ext4/dev v6.16-rc6 v6.16-rc5 v6.16-rc4 linus/master v6.16-rc6]
Here's the updated patch marked as V2 for clarity.

chuguangqing (1):
  ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask

 fs/ext4/extents.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
2.43.5
[PATCH v2 1/1] ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask
Posted by chuguangqing 2 months, 3 weeks ago
Add FALLOC_FL_ALLOCATE_RANGE to the set of supported fallocate mode flags.
This change improves code clarity and maintains by explicitly showing
this flag in the supported flags mask.

Note that since FALLOC_FL_ALLOCATE_RANGE is defined as 0x00, this addition
has no functional modifications.

Signed-off-by: chuguangqing <chuguangqing@inspur.com>
---
 fs/ext4/extents.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index b43aa82c1b39..411223c10553 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4784,9 +4784,9 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 		return -EOPNOTSUPP;
 
 	/* Return error if mode is not supported */
-	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
-		     FALLOC_FL_ZERO_RANGE | FALLOC_FL_COLLAPSE_RANGE |
-		     FALLOC_FL_INSERT_RANGE | FALLOC_FL_WRITE_ZEROES))
+	if (mode & ~(FALLOC_FL_ALLOCATE_RANGE | FALLOC_FL_KEEP_SIZE |
+		     FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE |
+		     FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE))
 		return -EOPNOTSUPP;
 
 	inode_lock(inode);
-- 
2.43.5
Re: Re: [PATCH 1/1] ext4: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask
Posted by chuguangqing 2 months, 3 weeks ago
The patch for XFS is here: https://lore.kernel.org/linux-xfs/aGIxIx6XZM-qu0iY@infradead.org/T/#t

Applied to for-next, thanks!

[1/1] xfs: add FALLOC_FL_ALLOCATE_RANGE to supported flags mask
      commit: 9e9b46672b1daac814b384286c21fb8332a87392