ext4: merge ext4_xattr_list() into ext4_listxattr()

Message ID 20170315043325.6764-1-ebiggers3@gmail.com
State Awaiting Upstream
Headers show

Commit Message

Eric Biggers March 15, 2017, 4:33 a.m.
From: Eric Biggers <ebiggers@google.com>

There's no difference between ext4_xattr_list() and ext4_listxattr(), so
merge them together and just have ext4_listxattr().  Some years ago they
took different arguments, but that's no longer the case.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 fs/ext4/xattr.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

Comments

Jan Kara March 21, 2017, 3:24 p.m. | #1
On Tue 14-03-17 21:33:25, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> There's no difference between ext4_xattr_list() and ext4_listxattr(), so
> merge them together and just have ext4_listxattr().  Some years ago they
> took different arguments, but that's no longer the case.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Looks good. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza
> ---
>  fs/ext4/xattr.c | 21 +++++----------------
>  1 file changed, 5 insertions(+), 16 deletions(-)
> 
> diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
> index 67636acf7624..1d59895a91ee 100644
> --- a/fs/ext4/xattr.c
> +++ b/fs/ext4/xattr.c
> @@ -78,8 +78,6 @@ static struct buffer_head *ext4_xattr_cache_find(struct inode *,
>  						 struct mb_cache_entry **);
>  static void ext4_xattr_rehash(struct ext4_xattr_header *,
>  			      struct ext4_xattr_entry *);
> -static int ext4_xattr_list(struct dentry *dentry, char *buffer,
> -			   size_t buffer_size);
>  
>  static const struct xattr_handler *ext4_xattr_handler_map[] = {
>  	[EXT4_XATTR_INDEX_USER]		     = &ext4_xattr_user_handler,
> @@ -168,17 +166,6 @@ ext4_xattr_handler(int name_index)
>  	return handler;
>  }
>  
> -/*
> - * Inode operation listxattr()
> - *
> - * d_inode(dentry)->i_mutex: don't care
> - */
> -ssize_t
> -ext4_listxattr(struct dentry *dentry, char *buffer, size_t size)
> -{
> -	return ext4_xattr_list(dentry, buffer, size);
> -}
> -
>  static int
>  ext4_xattr_check_names(struct ext4_xattr_entry *entry, void *end,
>  		       void *value_start)
> @@ -524,7 +511,9 @@ ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size)
>  }
>  
>  /*
> - * ext4_xattr_list()
> + * Inode operation listxattr()
> + *
> + * d_inode(dentry)->i_rwsem: don't care
>   *
>   * Copy a list of attribute names into the buffer
>   * provided, or compute the buffer size required.
> @@ -533,8 +522,8 @@ ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size)
>   * Returns a negative error number on failure, or the number of bytes
>   * used / required on success.
>   */
> -static int
> -ext4_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
> +ssize_t
> +ext4_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
>  {
>  	int ret, ret2;
>  
> -- 
> 2.12.0
>
Theodore Ts'o April 30, 2017, 3:53 a.m. | #2
On Tue, Mar 14, 2017 at 09:33:25PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
> 
> There's no difference between ext4_xattr_list() and ext4_listxattr(), so
> merge them together and just have ext4_listxattr().  Some years ago they
> took different arguments, but that's no longer the case.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Thanks, applied.

					- Ted

Patch

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 67636acf7624..1d59895a91ee 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -78,8 +78,6 @@  static struct buffer_head *ext4_xattr_cache_find(struct inode *,
 						 struct mb_cache_entry **);
 static void ext4_xattr_rehash(struct ext4_xattr_header *,
 			      struct ext4_xattr_entry *);
-static int ext4_xattr_list(struct dentry *dentry, char *buffer,
-			   size_t buffer_size);
 
 static const struct xattr_handler *ext4_xattr_handler_map[] = {
 	[EXT4_XATTR_INDEX_USER]		     = &ext4_xattr_user_handler,
@@ -168,17 +166,6 @@  ext4_xattr_handler(int name_index)
 	return handler;
 }
 
-/*
- * Inode operation listxattr()
- *
- * d_inode(dentry)->i_mutex: don't care
- */
-ssize_t
-ext4_listxattr(struct dentry *dentry, char *buffer, size_t size)
-{
-	return ext4_xattr_list(dentry, buffer, size);
-}
-
 static int
 ext4_xattr_check_names(struct ext4_xattr_entry *entry, void *end,
 		       void *value_start)
@@ -524,7 +511,9 @@  ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size)
 }
 
 /*
- * ext4_xattr_list()
+ * Inode operation listxattr()
+ *
+ * d_inode(dentry)->i_rwsem: don't care
  *
  * Copy a list of attribute names into the buffer
  * provided, or compute the buffer size required.
@@ -533,8 +522,8 @@  ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size)
  * Returns a negative error number on failure, or the number of bytes
  * used / required on success.
  */
-static int
-ext4_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
+ssize_t
+ext4_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
 {
 	int ret, ret2;