[PATCH 0/4][RFC] remove duplicated check from ext4, xfs, btrfs, and ocfs2

STALE5039d

7 messages, 2 authors, 2012-11-20 · open the first message on its own page

[PATCH 0/4][RFC] remove duplicated check from ext4, xfs, btrfs, and ocfs2

From: Zheng Liu <hidden>
Date: 2012-11-20 09:17:14

Hi all,

This patch series tries to remove a sanity check in fallocate from specific
filesystems because vfs has already checked it.

I am not very familiar with why we need to do this duplicated check.  Please let
me know if I miss something.

Regards,
						- Zheng

---
Zheng Liu(4):
      ext4: remove dupoicated check from ext4_fallocate
      xfs: remove duplicated check from xfs_file_fallocate
      btrfs: remove duplicated check from btrfs_fallocate
      ocfs2: remove duplicated check from ocfs2_fallocate

 fs/btrfs/file.c   | 4 ----
 fs/ext4/extents.c | 4 ----
 fs/ocfs2/file.c   | 2 --
 fs/xfs/xfs_file.c | 3 ---
 4 files changed, 13 deletions(-)

[PATCH 3/4][RFC] btrfs: remove duplicated check from btrfs_fallocate

From: Zheng Liu <hidden>
Date: 2012-11-20 09:17:22

From: Zheng Liu <redacted>

Remove a sanity check from btrfs_fallocate because vfs has already checked it.

Reported-by: Guo Chao <redacted>
Signed-off-by: Zheng Liu <redacted>
---
 fs/btrfs/file.c | 4 ----
 1 file changed, 4 deletions(-)
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 9ab1bed..fd260a0 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1999,10 +1999,6 @@ static long btrfs_fallocate(struct file *file, int mode,
 	alloc_start = offset & ~mask;
 	alloc_end =  (offset + len + mask) & ~mask;
 
-	/* Make sure we aren't being give some crap mode */
-	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
-		return -EOPNOTSUPP;
-
 	if (mode & FALLOC_FL_PUNCH_HOLE)
 		return btrfs_punch_hole(inode, offset, len);
 
-- 
1.7.12.rc2.18.g61b472e

[PATCH 4/4][RFC] ocfs2: remove duplicated check from ocfs2_fallocate

From: Zheng Liu <hidden>
Date: 2012-11-20 09:17:25

From: Zheng Liu <redacted>

Remove a sanity check from ocfs2_fallocate because vfs has already checked it.

Reported-by: Guo Chao <redacted>
Signed-off-by: Zheng Liu <redacted>
---
 fs/ocfs2/file.c | 2 --
 1 file changed, 2 deletions(-)
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 5a4ee77..2446efa 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2001,8 +2001,6 @@ static long ocfs2_fallocate(struct file *file, int mode, loff_t offset,
 	int change_size = 1;
 	int cmd = OCFS2_IOC_RESVSP64;
 
-	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
-		return -EOPNOTSUPP;
 	if (!ocfs2_writes_unwritten_extents(osb))
 		return -EOPNOTSUPP;
 
-- 
1.7.12.rc2.18.g61b472e

[PATCH 1/4][RFC] ext4: remove duplicated check from ext4_fallocate

From: Zheng Liu <hidden>
Date: 2012-11-20 09:29:42

From: Zheng Liu <redacted>

Remove a sanity check from ext4_fallocate because vfs has already checked it.

Reported-by: Guo Chao <redacted>
Signed-off-by: Zheng Liu <redacted>
---
 fs/ext4/extents.c | 4 ----
 1 file changed, 4 deletions(-)
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 7011ac9..c2eb409 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4427,10 +4427,6 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 	if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
 		return -EOPNOTSUPP;
 
-	/* Return error if mode is not supported */
-	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
-		return -EOPNOTSUPP;
-
 	if (mode & FALLOC_FL_PUNCH_HOLE)
 		return ext4_punch_hole(file, offset, len);
 
-- 
1.7.12.rc2.18.g61b472e

[PATCH 2/4][RFC] xfs: remove duplicated check from xfs_file_fallocate

From: Zheng Liu <hidden>
Date: 2012-11-20 09:29:43

From: Zheng Liu <redacted>

Remove a sanity check from xfs_file_fallocate because vfs has already checked
it.

Reported-by: Guo Chao <redacted>
Signed-off-by: Zheng Liu <redacted>
---
 fs/xfs/xfs_file.c | 3 ---
 1 file changed, 3 deletions(-)
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index aa473fa..7b50d12 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -815,9 +815,6 @@ xfs_file_fallocate(
 	int		cmd = XFS_IOC_RESVSP;
 	int		attr_flags = XFS_ATTR_NOLOCK;
 
-	if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
-		return -EOPNOTSUPP;
-
 	bf.l_whence = 0;
 	bf.l_start = offset;
 	bf.l_len = len;
-- 
1.7.12.rc2.18.g61b472e

Re: [PATCH 0/4][RFC] remove duplicated check from ext4, xfs, btrfs, and ocfs2

From: Christoph Hellwig <hch@infradead.org>
Date: 2012-11-20 10:14:53

On Tue, Nov 20, 2012 at 05:29:41PM +0800, Zheng Liu wrote:
Hi all,

This patch series tries to remove a sanity check in fallocate from specific
filesystems because vfs has already checked it.

I am not very familiar with why we need to do this duplicated check.  Please let
me know if I miss something.
Each filesystem driver checks to see if a flag that it doesn't support
gets passed down.  This was done with the intention that we can add new
flags to the VFS without having to update every filesystem.

Re: [PATCH 0/4][RFC] remove duplicated check from ext4, xfs, btrfs, and ocfs2

From: Zheng Liu <hidden>
Date: 2012-11-20 10:46:46

On Tue, Nov 20, 2012 at 05:14:53AM -0500, Christoph Hellwig wrote:
On Tue, Nov 20, 2012 at 05:29:41PM +0800, Zheng Liu wrote:
quoted
Hi all,

This patch series tries to remove a sanity check in fallocate from specific
filesystems because vfs has already checked it.

I am not very familiar with why we need to do this duplicated check.  Please let
me know if I miss something.
Each filesystem driver checks to see if a flag that it doesn't support
gets passed down.  This was done with the intention that we can add new
flags to the VFS without having to update every filesystem.
Thanks for your explanation.

Regards,
                                                - Zheng
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help