Thread (33 messages) 33 messages, 4 authors, 2021-11-29

Re: [PATCH 05/21] btrfs: zoned: move compatible fs flags check to zoned code

From: David Sterba <hidden>
Date: 2021-11-24 17:36:57

On Wed, Nov 24, 2021 at 01:30:31AM -0800, Johannes Thumshirn wrote:
check_fsflags_compatible() is only used in zoned filesystems, so move it
to zoned code.
The function logically belongs to the ioctl, it is supposed to verify
that the flags requested by user are compatible with current filesystem
state.
quoted hunk ↗ jump to hunk
Signed-off-by: Johannes Thumshirn <redacted>
---
 fs/btrfs/ioctl.c | 12 ++----------
 fs/btrfs/zoned.h |  9 +++++++++
 2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 05c77a1979a9f..d7f710e57890e 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -49,6 +49,7 @@
 #include "delalloc-space.h"
 #include "block-group.h"
 #include "subpage.h"
+#include "zoned.h"
 
 #ifdef CONFIG_64BIT
 /* If we have a 32-bit userspace and 64-bit kernel, then the UAPI
@@ -192,15 +193,6 @@ static int check_fsflags(unsigned int old_flags, unsigned int flags)
 	return 0;
 }
 
-static int check_fsflags_compatible(struct btrfs_fs_info *fs_info,
-				    unsigned int flags)
-{
-	if (btrfs_is_zoned(fs_info) && (flags & FS_NOCOW_FL))
-		return -EPERM;
The intention of the function is "verify anything that's relevant", so
checking the zoned condition here is IMHO appropriate and expected as
there can be more such checks in the future. Although we don't have any
yet moving the helper to zoned.c disconnects it from the ioctl.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help