]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm-shmem-support-fs_ioc_etflags-in-tmpfs-fix
authorAndrew Morton <akpm@linux-foundation.org>
Mon, 18 Jul 2022 22:51:33 +0000 (15:51 -0700)
committerakpm <akpm@linux-foundation.org>
Wed, 20 Jul 2022 21:41:53 +0000 (14:41 -0700)
fix CONFIG_TMPFS_XATTR=n warnings

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Hugh Dickins <hughd@google.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/shmem.c

index b3de94b266fe29ed40135db7e3f095c5fccc4871..966de37a79e53ad034eebeb17458cf2ef75dbd3c 100644 (file)
@@ -2837,39 +2837,6 @@ out:
        return error;
 }
 
-static int shmem_fileattr_get(struct dentry *dentry, struct fileattr *fa)
-{
-       struct shmem_inode_info *info = SHMEM_I(d_inode(dentry));
-
-       fileattr_fill_flags(fa, info->fsflags & SHMEM_FL_USER_VISIBLE);
-
-       return 0;
-}
-
-static int shmem_fileattr_set(struct user_namespace *mnt_userns,
-                             struct dentry *dentry, struct fileattr *fa)
-{
-       struct inode *inode = d_inode(dentry);
-       struct shmem_inode_info *info = SHMEM_I(inode);
-
-       if (fileattr_has_fsx(fa))
-               return -EOPNOTSUPP;
-
-       info->fsflags = (info->fsflags & ~SHMEM_FL_USER_MODIFIABLE) |
-               (fa->flags & SHMEM_FL_USER_MODIFIABLE);
-
-       inode->i_flags &= ~(S_APPEND | S_IMMUTABLE | S_NOATIME);
-       if (info->fsflags & FS_APPEND_FL)
-               inode->i_flags |= S_APPEND;
-       if (info->fsflags & FS_IMMUTABLE_FL)
-               inode->i_flags |= S_IMMUTABLE;
-       if (info->fsflags & FS_NOATIME_FL)
-               inode->i_flags |= S_NOATIME;
-
-       inode->i_ctime = current_time(inode);
-       return 0;
-}
-
 static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf)
 {
        struct shmem_sb_info *sbinfo = SHMEM_SB(dentry->d_sb);
@@ -3195,6 +3162,40 @@ static const char *shmem_get_link(struct dentry *dentry,
 }
 
 #ifdef CONFIG_TMPFS_XATTR
+
+static int shmem_fileattr_get(struct dentry *dentry, struct fileattr *fa)
+{
+       struct shmem_inode_info *info = SHMEM_I(d_inode(dentry));
+
+       fileattr_fill_flags(fa, info->fsflags & SHMEM_FL_USER_VISIBLE);
+
+       return 0;
+}
+
+static int shmem_fileattr_set(struct user_namespace *mnt_userns,
+                             struct dentry *dentry, struct fileattr *fa)
+{
+       struct inode *inode = d_inode(dentry);
+       struct shmem_inode_info *info = SHMEM_I(inode);
+
+       if (fileattr_has_fsx(fa))
+               return -EOPNOTSUPP;
+
+       info->fsflags = (info->fsflags & ~SHMEM_FL_USER_MODIFIABLE) |
+               (fa->flags & SHMEM_FL_USER_MODIFIABLE);
+
+       inode->i_flags &= ~(S_APPEND | S_IMMUTABLE | S_NOATIME);
+       if (info->fsflags & FS_APPEND_FL)
+               inode->i_flags |= S_APPEND;
+       if (info->fsflags & FS_IMMUTABLE_FL)
+               inode->i_flags |= S_IMMUTABLE;
+       if (info->fsflags & FS_NOATIME_FL)
+               inode->i_flags |= S_NOATIME;
+
+       inode->i_ctime = current_time(inode);
+       return 0;
+}
+
 /*
  * Superblocks without xattr inode operations may get some security.* xattr
  * support from the LSM "for free". As soon as we have any other xattrs