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

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

From: Johannes Thumshirn <hidden>
Date: 2021-11-24 09:31:02
Subsystem: btrfs file system, filesystems (vfs and infrastructure), the rest · Maintainers: Chris Mason, David Sterba, Alexander Viro, Christian Brauner, Linus Torvalds

check_fsflags_compatible() is only used in zoned filesystems, so move it
to zoned code.

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;
-
-	return 0;
-}
-
 /*
  * Set flags/xflags from the internal inode flags. The remaining items of
  * fsxattr are zeroed.
@@ -238,7 +230,7 @@ int btrfs_fileattr_set(struct user_namespace *mnt_userns,
 	if (ret)
 		return ret;
 
-	ret = check_fsflags_compatible(fs_info, fsflags);
+	ret = btrfs_zoned_check_fsflags_compatible(fs_info, fsflags);
 	if (ret)
 		return ret;
 
diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h
index e3eaf03a34222..8e8f36c1d28a4 100644
--- a/fs/btrfs/zoned.h
+++ b/fs/btrfs/zoned.h
@@ -371,4 +371,13 @@ static inline void btrfs_zoned_data_reloc_unlock(struct inode *inode)
 		btrfs_inode_unlock(inode, 0);
 }
 
+static inline int btrfs_zoned_check_fsflags_compatible(
+					       struct btrfs_fs_info *fs_info,
+					       unsigned int flags)
+{
+	if (btrfs_is_zoned(fs_info) && (flags & FS_NOCOW_FL))
+		return -EPERM;
+
+	return 0;
+}
 #endif
-- 
2.31.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help