2021-10-01 16:09:52

by Konstantin Komarov

[permalink] [raw]
Subject: [PATCH 0/2] Removing of old code

Some code became unused after commits.

Konstantin Komarov (2):
fs/ntfs3: Remove unnecessary functions
fs/ntfs3: Remove unnecessary includes

fs/ntfs3/attrib.c | 2 -
fs/ntfs3/attrlist.c | 2 -
fs/ntfs3/dir.c | 2 -
fs/ntfs3/file.c | 2 -
fs/ntfs3/frecord.c | 2 -
fs/ntfs3/fslog.c | 2 -
fs/ntfs3/fsntfs.c | 2 -
fs/ntfs3/index.c | 3 --
fs/ntfs3/inode.c | 2 -
fs/ntfs3/lznt.c | 1 -
fs/ntfs3/namei.c | 2 -
fs/ntfs3/ntfs_fs.h | 1 -
fs/ntfs3/record.c | 2 -
fs/ntfs3/run.c | 2 -
fs/ntfs3/super.c | 4 +-
fs/ntfs3/xattr.c | 96 ---------------------------------------------
16 files changed, 1 insertion(+), 126 deletions(-)

--
2.33.0


2021-10-01 18:43:56

by Konstantin Komarov

[permalink] [raw]
Subject: [PATCH 2/2] fs/ntfs3: Remove unnecessary includes

All removed includes already included from other headers.

Signed-off-by: Konstantin Komarov <[email protected]>
---
fs/ntfs3/attrib.c | 2 --
fs/ntfs3/attrlist.c | 2 --
fs/ntfs3/dir.c | 2 --
fs/ntfs3/file.c | 2 --
fs/ntfs3/frecord.c | 2 --
fs/ntfs3/fslog.c | 2 --
fs/ntfs3/fsntfs.c | 2 --
fs/ntfs3/index.c | 3 ---
fs/ntfs3/inode.c | 2 --
fs/ntfs3/lznt.c | 1 -
fs/ntfs3/namei.c | 2 --
fs/ntfs3/ntfs_fs.h | 1 -
fs/ntfs3/record.c | 2 --
fs/ntfs3/run.c | 2 --
fs/ntfs3/super.c | 4 +---
fs/ntfs3/xattr.c | 2 --
16 files changed, 1 insertion(+), 32 deletions(-)

diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
index 8a00fa978f5f..dd4f1613081d 100644
--- a/fs/ntfs3/attrib.c
+++ b/fs/ntfs3/attrib.c
@@ -10,8 +10,6 @@
#include <linux/slab.h>
#include <linux/kernel.h>

-#include "debug.h"
-#include "ntfs.h"
#include "ntfs_fs.h"

/*
diff --git a/fs/ntfs3/attrlist.c b/fs/ntfs3/attrlist.c
index bad6d8a849a2..c3934a2a28a9 100644
--- a/fs/ntfs3/attrlist.c
+++ b/fs/ntfs3/attrlist.c
@@ -7,8 +7,6 @@

#include <linux/fs.h>

-#include "debug.h"
-#include "ntfs.h"
#include "ntfs_fs.h"

/*
diff --git a/fs/ntfs3/dir.c b/fs/ntfs3/dir.c
index 785e72d4392e..293303f00b66 100644
--- a/fs/ntfs3/dir.c
+++ b/fs/ntfs3/dir.c
@@ -10,8 +10,6 @@
#include <linux/fs.h>
#include <linux/nls.h>

-#include "debug.h"
-#include "ntfs.h"
#include "ntfs_fs.h"

/* Convert little endian UTF-16 to NLS string. */
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index 5fb3508e5422..13789543a0fb 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -13,8 +13,6 @@
#include <linux/falloc.h>
#include <linux/fiemap.h>

-#include "debug.h"
-#include "ntfs.h"
#include "ntfs_fs.h"

static int ntfs_ioctl_fitrim(struct ntfs_sb_info *sbi, unsigned long arg)
diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index 007602badd90..b27f3ca2704b 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -9,8 +9,6 @@
#include <linux/fs.h>
#include <linux/vmalloc.h>

-#include "debug.h"
-#include "ntfs.h"
#include "ntfs_fs.h"
#ifdef CONFIG_NTFS3_LZX_XPRESS
#include "lib/lib.h"
diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
index 06492f088d60..4bf340babb32 100644
--- a/fs/ntfs3/fslog.c
+++ b/fs/ntfs3/fslog.c
@@ -10,8 +10,6 @@
#include <linux/random.h>
#include <linux/slab.h>

-#include "debug.h"
-#include "ntfs.h"
#include "ntfs_fs.h"

/*
diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
index 4de9acb16968..85cbbb8f41ea 100644
--- a/fs/ntfs3/fsntfs.c
+++ b/fs/ntfs3/fsntfs.c
@@ -10,8 +10,6 @@
#include <linux/fs.h>
#include <linux/kernel.h>

-#include "debug.h"
-#include "ntfs.h"
#include "ntfs_fs.h"

// clang-format off
diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
index 6f81e3a49abf..a25f04dcb85b 100644
--- a/fs/ntfs3/index.c
+++ b/fs/ntfs3/index.c
@@ -8,10 +8,7 @@
#include <linux/blkdev.h>
#include <linux/buffer_head.h>
#include <linux/fs.h>
-#include <linux/kernel.h>

-#include "debug.h"
-#include "ntfs.h"
#include "ntfs_fs.h"

static const struct INDEX_NAMES {
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index 7dd162f6a7e2..06113610c529 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -13,8 +13,6 @@
#include <linux/uio.h>
#include <linux/writeback.h>

-#include "debug.h"
-#include "ntfs.h"
#include "ntfs_fs.h"

/*
diff --git a/fs/ntfs3/lznt.c b/fs/ntfs3/lznt.c
index 28f654561f27..d9614b8e1b4e 100644
--- a/fs/ntfs3/lznt.c
+++ b/fs/ntfs3/lznt.c
@@ -11,7 +11,6 @@
#include <linux/string.h>
#include <linux/types.h>

-#include "debug.h"
#include "ntfs_fs.h"

// clang-format off
diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c
index bc741213ad84..ed29cd3e98f4 100644
--- a/fs/ntfs3/namei.c
+++ b/fs/ntfs3/namei.c
@@ -8,8 +8,6 @@
#include <linux/fs.h>
#include <linux/nls.h>

-#include "debug.h"
-#include "ntfs.h"
#include "ntfs_fs.h"

/*
diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
index 38b7c1a9dc52..e6f37f9993a0 100644
--- a/fs/ntfs3/ntfs_fs.h
+++ b/fs/ntfs3/ntfs_fs.h
@@ -29,7 +29,6 @@
#include <asm/div64.h>
#include <asm/page.h>

-#include "debug.h"
#include "ntfs.h"

struct dentry;
diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c
index 861e35791506..3dd7b960ac8d 100644
--- a/fs/ntfs3/record.c
+++ b/fs/ntfs3/record.c
@@ -7,8 +7,6 @@

#include <linux/fs.h>

-#include "debug.h"
-#include "ntfs.h"
#include "ntfs_fs.h"

static inline int compare_attr(const struct ATTRIB *left, enum ATTR_TYPE type,
diff --git a/fs/ntfs3/run.c b/fs/ntfs3/run.c
index a8fec651f973..f5a5ce7aa206 100644
--- a/fs/ntfs3/run.c
+++ b/fs/ntfs3/run.c
@@ -10,8 +10,6 @@
#include <linux/fs.h>
#include <linux/log2.h>

-#include "debug.h"
-#include "ntfs.h"
#include "ntfs_fs.h"

/* runs_tree is a continues memory. Try to avoid big size. */
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 705d8b4f4894..bd8d39992b35 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -35,8 +35,6 @@
#include <linux/seq_file.h>
#include <linux/statfs.h>

-#include "debug.h"
-#include "ntfs.h"
#include "ntfs_fs.h"
#ifdef CONFIG_NTFS3_LZX_XPRESS
#include "lib/lib.h"
@@ -772,7 +770,7 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,
/* No way to use ntfs_get_block in this case. */
ntfs_err(
sb,
- "Failed to mount 'cause NTFS's cluster size (%u) is less than media sector size (%u)",
+ "Failed to mount 'cause NTFS's cluster size (%u) is less than media's sector size (%u)",
sbi->cluster_size, sector_size);
goto out;
}
diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
index 111355692163..0673ba5e8c43 100644
--- a/fs/ntfs3/xattr.c
+++ b/fs/ntfs3/xattr.c
@@ -10,8 +10,6 @@
#include <linux/posix_acl_xattr.h>
#include <linux/xattr.h>

-#include "debug.h"
-#include "ntfs.h"
#include "ntfs_fs.h"

// clang-format off
--
2.33.0

2021-10-01 19:52:05

by Konstantin Komarov

[permalink] [raw]
Subject: [PATCH 1/2] fs/ntfs3: Remove unnecessary functions

We don't need ntfs_xattr_get_acl and ntfs_xattr_set_acl.
There are ntfs_get_acl_ex and ntfs_set_acl_ex.

Signed-off-by: Konstantin Komarov <[email protected]>
---
fs/ntfs3/xattr.c | 94 ------------------------------------------------
1 file changed, 94 deletions(-)

diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
index 83bbee277e12..111355692163 100644
--- a/fs/ntfs3/xattr.c
+++ b/fs/ntfs3/xattr.c
@@ -621,67 +621,6 @@ int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
return ntfs_set_acl_ex(mnt_userns, inode, acl, type, 0);
}

-static int ntfs_xattr_get_acl(struct user_namespace *mnt_userns,
- struct inode *inode, int type, void *buffer,
- size_t size)
-{
- struct posix_acl *acl;
- int err;
-
- if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
- ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
- return -EOPNOTSUPP;
- }
-
- acl = ntfs_get_acl(inode, type);
- if (IS_ERR(acl))
- return PTR_ERR(acl);
-
- if (!acl)
- return -ENODATA;
-
- err = posix_acl_to_xattr(mnt_userns, acl, buffer, size);
- ntfs_posix_acl_release(acl);
-
- return err;
-}
-
-static int ntfs_xattr_set_acl(struct user_namespace *mnt_userns,
- struct inode *inode, int type, const void *value,
- size_t size)
-{
- struct posix_acl *acl;
- int err;
-
- if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
- ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
- return -EOPNOTSUPP;
- }
-
- if (!inode_owner_or_capable(mnt_userns, inode))
- return -EPERM;
-
- if (!value) {
- acl = NULL;
- } else {
- acl = posix_acl_from_xattr(mnt_userns, value, size);
- if (IS_ERR(acl))
- return PTR_ERR(acl);
-
- if (acl) {
- err = posix_acl_valid(mnt_userns, acl);
- if (err)
- goto release_and_out;
- }
- }
-
- err = ntfs_set_acl(mnt_userns, inode, acl, type);
-
-release_and_out:
- ntfs_posix_acl_release(acl);
- return err;
-}
-
/*
* ntfs_init_acl - Initialize the ACLs of a new inode.
*
@@ -848,23 +787,6 @@ static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de,
goto out;
}

-#ifdef CONFIG_NTFS3_FS_POSIX_ACL
- if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
- !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
- sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
- (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
- !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
- sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
- /* TODO: init_user_ns? */
- err = ntfs_xattr_get_acl(
- &init_user_ns, inode,
- name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
- ? ACL_TYPE_ACCESS
- : ACL_TYPE_DEFAULT,
- buffer, size);
- goto out;
- }
-#endif
/* Deal with NTFS extended attribute. */
err = ntfs_get_ea(inode, name, name_len, buffer, size, NULL);

@@ -977,22 +899,6 @@ static noinline int ntfs_setxattr(const struct xattr_handler *handler,
goto out;
}

-#ifdef CONFIG_NTFS3_FS_POSIX_ACL
- if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
- !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
- sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
- (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
- !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
- sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
- err = ntfs_xattr_set_acl(
- mnt_userns, inode,
- name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
- ? ACL_TYPE_ACCESS
- : ACL_TYPE_DEFAULT,
- value, size);
- goto out;
- }
-#endif
/* Deal with NTFS extended attribute. */
err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0);

--
2.33.0

2021-10-03 17:58:03

by Kari Argillander

[permalink] [raw]
Subject: Re: [PATCH 2/2] fs/ntfs3: Remove unnecessary includes

On Fri, Oct 01, 2021 at 07:02:51PM +0300, Konstantin Komarov wrote:
> All removed includes already included from other headers.

Nack from me. Usually in kernel both header and source file should make
they own includes even when they both include same header file.

> Signed-off-by: Konstantin Komarov <[email protected]>
> ---
> fs/ntfs3/attrib.c | 2 --
> fs/ntfs3/attrlist.c | 2 --
> fs/ntfs3/dir.c | 2 --
> fs/ntfs3/file.c | 2 --
> fs/ntfs3/frecord.c | 2 --
> fs/ntfs3/fslog.c | 2 --
> fs/ntfs3/fsntfs.c | 2 --
> fs/ntfs3/index.c | 3 ---
> fs/ntfs3/inode.c | 2 --
> fs/ntfs3/lznt.c | 1 -
> fs/ntfs3/namei.c | 2 --
> fs/ntfs3/ntfs_fs.h | 1 -
> fs/ntfs3/record.c | 2 --
> fs/ntfs3/run.c | 2 --
> fs/ntfs3/super.c | 4 +---
> fs/ntfs3/xattr.c | 2 --
> 16 files changed, 1 insertion(+), 32 deletions(-)
>
> diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
> index 8a00fa978f5f..dd4f1613081d 100644
> --- a/fs/ntfs3/attrib.c
> +++ b/fs/ntfs3/attrib.c
> @@ -10,8 +10,6 @@
> #include <linux/slab.h>
> #include <linux/kernel.h>
>
> -#include "debug.h"
> -#include "ntfs.h"
> #include "ntfs_fs.h"
>
> /*
> diff --git a/fs/ntfs3/attrlist.c b/fs/ntfs3/attrlist.c
> index bad6d8a849a2..c3934a2a28a9 100644
> --- a/fs/ntfs3/attrlist.c
> +++ b/fs/ntfs3/attrlist.c
> @@ -7,8 +7,6 @@
>
> #include <linux/fs.h>
>
> -#include "debug.h"
> -#include "ntfs.h"
> #include "ntfs_fs.h"
>
> /*
> diff --git a/fs/ntfs3/dir.c b/fs/ntfs3/dir.c
> index 785e72d4392e..293303f00b66 100644
> --- a/fs/ntfs3/dir.c
> +++ b/fs/ntfs3/dir.c
> @@ -10,8 +10,6 @@
> #include <linux/fs.h>
> #include <linux/nls.h>
>
> -#include "debug.h"
> -#include "ntfs.h"
> #include "ntfs_fs.h"
>
> /* Convert little endian UTF-16 to NLS string. */
> diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
> index 5fb3508e5422..13789543a0fb 100644
> --- a/fs/ntfs3/file.c
> +++ b/fs/ntfs3/file.c
> @@ -13,8 +13,6 @@
> #include <linux/falloc.h>
> #include <linux/fiemap.h>
>
> -#include "debug.h"
> -#include "ntfs.h"
> #include "ntfs_fs.h"
>
> static int ntfs_ioctl_fitrim(struct ntfs_sb_info *sbi, unsigned long arg)
> diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
> index 007602badd90..b27f3ca2704b 100644
> --- a/fs/ntfs3/frecord.c
> +++ b/fs/ntfs3/frecord.c
> @@ -9,8 +9,6 @@
> #include <linux/fs.h>
> #include <linux/vmalloc.h>
>
> -#include "debug.h"
> -#include "ntfs.h"
> #include "ntfs_fs.h"
> #ifdef CONFIG_NTFS3_LZX_XPRESS
> #include "lib/lib.h"
> diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
> index 06492f088d60..4bf340babb32 100644
> --- a/fs/ntfs3/fslog.c
> +++ b/fs/ntfs3/fslog.c
> @@ -10,8 +10,6 @@
> #include <linux/random.h>
> #include <linux/slab.h>
>
> -#include "debug.h"
> -#include "ntfs.h"
> #include "ntfs_fs.h"
>
> /*
> diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
> index 4de9acb16968..85cbbb8f41ea 100644
> --- a/fs/ntfs3/fsntfs.c
> +++ b/fs/ntfs3/fsntfs.c
> @@ -10,8 +10,6 @@
> #include <linux/fs.h>
> #include <linux/kernel.h>
>
> -#include "debug.h"
> -#include "ntfs.h"
> #include "ntfs_fs.h"
>
> // clang-format off
> diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
> index 6f81e3a49abf..a25f04dcb85b 100644
> --- a/fs/ntfs3/index.c
> +++ b/fs/ntfs3/index.c
> @@ -8,10 +8,7 @@
> #include <linux/blkdev.h>
> #include <linux/buffer_head.h>
> #include <linux/fs.h>
> -#include <linux/kernel.h>
>
> -#include "debug.h"
> -#include "ntfs.h"
> #include "ntfs_fs.h"
>
> static const struct INDEX_NAMES {
> diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
> index 7dd162f6a7e2..06113610c529 100644
> --- a/fs/ntfs3/inode.c
> +++ b/fs/ntfs3/inode.c
> @@ -13,8 +13,6 @@
> #include <linux/uio.h>
> #include <linux/writeback.h>
>
> -#include "debug.h"
> -#include "ntfs.h"
> #include "ntfs_fs.h"
>
> /*
> diff --git a/fs/ntfs3/lznt.c b/fs/ntfs3/lznt.c
> index 28f654561f27..d9614b8e1b4e 100644
> --- a/fs/ntfs3/lznt.c
> +++ b/fs/ntfs3/lznt.c
> @@ -11,7 +11,6 @@
> #include <linux/string.h>
> #include <linux/types.h>
>
> -#include "debug.h"
> #include "ntfs_fs.h"
>
> // clang-format off
> diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c
> index bc741213ad84..ed29cd3e98f4 100644
> --- a/fs/ntfs3/namei.c
> +++ b/fs/ntfs3/namei.c
> @@ -8,8 +8,6 @@
> #include <linux/fs.h>
> #include <linux/nls.h>
>
> -#include "debug.h"
> -#include "ntfs.h"
> #include "ntfs_fs.h"
>
> /*
> diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
> index 38b7c1a9dc52..e6f37f9993a0 100644
> --- a/fs/ntfs3/ntfs_fs.h
> +++ b/fs/ntfs3/ntfs_fs.h
> @@ -29,7 +29,6 @@
> #include <asm/div64.h>
> #include <asm/page.h>
>
> -#include "debug.h"
> #include "ntfs.h"
>
> struct dentry;
> diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c
> index 861e35791506..3dd7b960ac8d 100644
> --- a/fs/ntfs3/record.c
> +++ b/fs/ntfs3/record.c
> @@ -7,8 +7,6 @@
>
> #include <linux/fs.h>
>
> -#include "debug.h"
> -#include "ntfs.h"
> #include "ntfs_fs.h"
>
> static inline int compare_attr(const struct ATTRIB *left, enum ATTR_TYPE type,
> diff --git a/fs/ntfs3/run.c b/fs/ntfs3/run.c
> index a8fec651f973..f5a5ce7aa206 100644
> --- a/fs/ntfs3/run.c
> +++ b/fs/ntfs3/run.c
> @@ -10,8 +10,6 @@
> #include <linux/fs.h>
> #include <linux/log2.h>
>
> -#include "debug.h"
> -#include "ntfs.h"
> #include "ntfs_fs.h"
>
> /* runs_tree is a continues memory. Try to avoid big size. */
> diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
> index 705d8b4f4894..bd8d39992b35 100644
> --- a/fs/ntfs3/super.c
> +++ b/fs/ntfs3/super.c
> @@ -35,8 +35,6 @@
> #include <linux/seq_file.h>
> #include <linux/statfs.h>
>
> -#include "debug.h"
> -#include "ntfs.h"
> #include "ntfs_fs.h"
> #ifdef CONFIG_NTFS3_LZX_XPRESS
> #include "lib/lib.h"
> @@ -772,7 +770,7 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size,
> /* No way to use ntfs_get_block in this case. */
> ntfs_err(
> sb,
> - "Failed to mount 'cause NTFS's cluster size (%u) is less than media sector size (%u)",
> + "Failed to mount 'cause NTFS's cluster size (%u) is less than media's sector size (%u)",
> sbi->cluster_size, sector_size);
> goto out;
> }
> diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
> index 111355692163..0673ba5e8c43 100644
> --- a/fs/ntfs3/xattr.c
> +++ b/fs/ntfs3/xattr.c
> @@ -10,8 +10,6 @@
> #include <linux/posix_acl_xattr.h>
> #include <linux/xattr.h>
>
> -#include "debug.h"
> -#include "ntfs.h"
> #include "ntfs_fs.h"
>
> // clang-format off
> --
> 2.33.0
>

2021-10-18 03:35:16

by Kari Argillander

[permalink] [raw]
Subject: Re: [PATCH 1/2] fs/ntfs3: Remove unnecessary functions

On Fri, Oct 01, 2021 at 07:02:12PM +0300, Konstantin Komarov wrote:
> We don't need ntfs_xattr_get_acl and ntfs_xattr_set_acl.
> There are ntfs_get_acl_ex and ntfs_set_acl_ex.

I just bisect this commit after tests

"generic/099,generic/105,generic/307,generic/318,generic/319,generic/375,generic/444"

fails for me. Fails happends because mount option acl was not defined.
Before they where skipped, but now fail occurs. Also generic/099 was
passing if acl mount option was defined, but after this patch it also
fail. Every other test fail for me as well, but that is not related to
this patch.

So should we revert or do you make new patch to fix the issue or do you
think we won't have any issue here?

Argillander

> Signed-off-by: Konstantin Komarov <[email protected]>
> ---
> fs/ntfs3/xattr.c | 94 ------------------------------------------------
> 1 file changed, 94 deletions(-)
>
> diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
> index 83bbee277e12..111355692163 100644
> --- a/fs/ntfs3/xattr.c
> +++ b/fs/ntfs3/xattr.c
> @@ -621,67 +621,6 @@ int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
> return ntfs_set_acl_ex(mnt_userns, inode, acl, type, 0);
> }
>
> -static int ntfs_xattr_get_acl(struct user_namespace *mnt_userns,
> - struct inode *inode, int type, void *buffer,
> - size_t size)
> -{
> - struct posix_acl *acl;
> - int err;
> -
> - if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
> - ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
> - return -EOPNOTSUPP;
> - }
> -
> - acl = ntfs_get_acl(inode, type);
> - if (IS_ERR(acl))
> - return PTR_ERR(acl);
> -
> - if (!acl)
> - return -ENODATA;
> -
> - err = posix_acl_to_xattr(mnt_userns, acl, buffer, size);
> - ntfs_posix_acl_release(acl);
> -
> - return err;
> -}
> -
> -static int ntfs_xattr_set_acl(struct user_namespace *mnt_userns,
> - struct inode *inode, int type, const void *value,
> - size_t size)
> -{
> - struct posix_acl *acl;
> - int err;
> -
> - if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
> - ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
> - return -EOPNOTSUPP;
> - }
> -
> - if (!inode_owner_or_capable(mnt_userns, inode))
> - return -EPERM;
> -
> - if (!value) {
> - acl = NULL;
> - } else {
> - acl = posix_acl_from_xattr(mnt_userns, value, size);
> - if (IS_ERR(acl))
> - return PTR_ERR(acl);
> -
> - if (acl) {
> - err = posix_acl_valid(mnt_userns, acl);
> - if (err)
> - goto release_and_out;
> - }
> - }
> -
> - err = ntfs_set_acl(mnt_userns, inode, acl, type);
> -
> -release_and_out:
> - ntfs_posix_acl_release(acl);
> - return err;
> -}
> -
> /*
> * ntfs_init_acl - Initialize the ACLs of a new inode.
> *
> @@ -848,23 +787,6 @@ static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de,
> goto out;
> }
>
> -#ifdef CONFIG_NTFS3_FS_POSIX_ACL
> - if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
> - !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
> - sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
> - (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
> - !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
> - sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
> - /* TODO: init_user_ns? */
> - err = ntfs_xattr_get_acl(
> - &init_user_ns, inode,
> - name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
> - ? ACL_TYPE_ACCESS
> - : ACL_TYPE_DEFAULT,
> - buffer, size);
> - goto out;
> - }
> -#endif
> /* Deal with NTFS extended attribute. */
> err = ntfs_get_ea(inode, name, name_len, buffer, size, NULL);
>
> @@ -977,22 +899,6 @@ static noinline int ntfs_setxattr(const struct xattr_handler *handler,
> goto out;
> }
>
> -#ifdef CONFIG_NTFS3_FS_POSIX_ACL
> - if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
> - !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
> - sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
> - (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
> - !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
> - sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
> - err = ntfs_xattr_set_acl(
> - mnt_userns, inode,
> - name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
> - ? ACL_TYPE_ACCESS
> - : ACL_TYPE_DEFAULT,
> - value, size);
> - goto out;
> - }
> -#endif
> /* Deal with NTFS extended attribute. */
> err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0);
>
> --
> 2.33.0
>

2021-10-19 17:14:29

by Konstantin Komarov

[permalink] [raw]
Subject: Re: [PATCH 1/2] fs/ntfs3: Remove unnecessary functions



On 16.10.2021 13:42, Kari Argillander wrote:
> On Fri, Oct 01, 2021 at 07:02:12PM +0300, Konstantin Komarov wrote:
>> We don't need ntfs_xattr_get_acl and ntfs_xattr_set_acl.
>> There are ntfs_get_acl_ex and ntfs_set_acl_ex.
>
> I just bisect this commit after tests
>
> "generic/099,generic/105,generic/307,generic/318,generic/319,generic/375,generic/444"
>
> fails for me. Fails happends because mount option acl was not defined.
> Before they where skipped, but now fail occurs. Also generic/099 was
> passing if acl mount option was defined, but after this patch it also
> fail. Every other test fail for me as well, but that is not related to
> this patch.
>
> So should we revert or do you make new patch to fix the issue or do you
> think we won't have any issue here?
>
> Argillander
>

We skipped these tests(muted them in beginning and forgot to unmute).
Thanks for pointing this out. There will be patch to fix them.

>> Signed-off-by: Konstantin Komarov <[email protected]>
>> ---
>> fs/ntfs3/xattr.c | 94 ------------------------------------------------
>> 1 file changed, 94 deletions(-)
>>
>> diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
>> index 83bbee277e12..111355692163 100644
>> --- a/fs/ntfs3/xattr.c
>> +++ b/fs/ntfs3/xattr.c
>> @@ -621,67 +621,6 @@ int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
>> return ntfs_set_acl_ex(mnt_userns, inode, acl, type, 0);
>> }
>>
>> -static int ntfs_xattr_get_acl(struct user_namespace *mnt_userns,
>> - struct inode *inode, int type, void *buffer,
>> - size_t size)
>> -{
>> - struct posix_acl *acl;
>> - int err;
>> -
>> - if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
>> - ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
>> - return -EOPNOTSUPP;
>> - }
>> -
>> - acl = ntfs_get_acl(inode, type);
>> - if (IS_ERR(acl))
>> - return PTR_ERR(acl);
>> -
>> - if (!acl)
>> - return -ENODATA;
>> -
>> - err = posix_acl_to_xattr(mnt_userns, acl, buffer, size);
>> - ntfs_posix_acl_release(acl);
>> -
>> - return err;
>> -}
>> -
>> -static int ntfs_xattr_set_acl(struct user_namespace *mnt_userns,
>> - struct inode *inode, int type, const void *value,
>> - size_t size)
>> -{
>> - struct posix_acl *acl;
>> - int err;
>> -
>> - if (!(inode->i_sb->s_flags & SB_POSIXACL)) {
>> - ntfs_inode_warn(inode, "add mount option \"acl\" to use acl");
>> - return -EOPNOTSUPP;
>> - }
>> -
>> - if (!inode_owner_or_capable(mnt_userns, inode))
>> - return -EPERM;
>> -
>> - if (!value) {
>> - acl = NULL;
>> - } else {
>> - acl = posix_acl_from_xattr(mnt_userns, value, size);
>> - if (IS_ERR(acl))
>> - return PTR_ERR(acl);
>> -
>> - if (acl) {
>> - err = posix_acl_valid(mnt_userns, acl);
>> - if (err)
>> - goto release_and_out;
>> - }
>> - }
>> -
>> - err = ntfs_set_acl(mnt_userns, inode, acl, type);
>> -
>> -release_and_out:
>> - ntfs_posix_acl_release(acl);
>> - return err;
>> -}
>> -
>> /*
>> * ntfs_init_acl - Initialize the ACLs of a new inode.
>> *
>> @@ -848,23 +787,6 @@ static int ntfs_getxattr(const struct xattr_handler *handler, struct dentry *de,
>> goto out;
>> }
>>
>> -#ifdef CONFIG_NTFS3_FS_POSIX_ACL
>> - if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
>> - !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
>> - sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
>> - (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
>> - !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
>> - sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
>> - /* TODO: init_user_ns? */
>> - err = ntfs_xattr_get_acl(
>> - &init_user_ns, inode,
>> - name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
>> - ? ACL_TYPE_ACCESS
>> - : ACL_TYPE_DEFAULT,
>> - buffer, size);
>> - goto out;
>> - }
>> -#endif
>> /* Deal with NTFS extended attribute. */
>> err = ntfs_get_ea(inode, name, name_len, buffer, size, NULL);
>>
>> @@ -977,22 +899,6 @@ static noinline int ntfs_setxattr(const struct xattr_handler *handler,
>> goto out;
>> }
>>
>> -#ifdef CONFIG_NTFS3_FS_POSIX_ACL
>> - if ((name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1 &&
>> - !memcmp(name, XATTR_NAME_POSIX_ACL_ACCESS,
>> - sizeof(XATTR_NAME_POSIX_ACL_ACCESS))) ||
>> - (name_len == sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1 &&
>> - !memcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT,
>> - sizeof(XATTR_NAME_POSIX_ACL_DEFAULT)))) {
>> - err = ntfs_xattr_set_acl(
>> - mnt_userns, inode,
>> - name_len == sizeof(XATTR_NAME_POSIX_ACL_ACCESS) - 1
>> - ? ACL_TYPE_ACCESS
>> - : ACL_TYPE_DEFAULT,
>> - value, size);
>> - goto out;
>> - }
>> -#endif
>> /* Deal with NTFS extended attribute. */
>> err = ntfs_set_ea(inode, name, name_len, value, size, flags, 0);
>>
>> --
>> 2.33.0
>>