Commit 310c097c authored by Ritesh Harjani's avatar Ritesh Harjani Committed by Theodore Ts'o

ext4: remove duplicate definition of ext4_xattr_ibody_inline_set()

ext4_xattr_ibody_inline_set() & ext4_xattr_ibody_set() have the exact
same definition.  Hence remove ext4_xattr_ibody_inline_set() and all
its call references. Convert the callers of it to call
ext4_xattr_ibody_set() instead.

[ Modified to preserve ext4_xattr_ibody_set() and remove
  ext4_xattr_ibody_inline_set() instead. -- TYT ]
Signed-off-by: default avatarRitesh Harjani <riteshh@linux.ibm.com>
Link: https://lore.kernel.org/r/fd566b799bbbbe9b668eb5eecde5b5e319e3694f.1622685482.git.riteshh@linux.ibm.comSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent ee00d6b3
...@@ -204,7 +204,7 @@ static int ext4_read_inline_data(struct inode *inode, void *buffer, ...@@ -204,7 +204,7 @@ static int ext4_read_inline_data(struct inode *inode, void *buffer,
/* /*
* write the buffer to the inline inode. * write the buffer to the inline inode.
* If 'create' is set, we don't need to do the extra copy in the xattr * If 'create' is set, we don't need to do the extra copy in the xattr
* value since it is already handled by ext4_xattr_ibody_inline_set. * value since it is already handled by ext4_xattr_ibody_set.
* That saves us one memcpy. * That saves us one memcpy.
*/ */
static void ext4_write_inline_data(struct inode *inode, struct ext4_iloc *iloc, static void ext4_write_inline_data(struct inode *inode, struct ext4_iloc *iloc,
...@@ -286,7 +286,7 @@ static int ext4_create_inline_data(handle_t *handle, ...@@ -286,7 +286,7 @@ static int ext4_create_inline_data(handle_t *handle,
BUG_ON(!is.s.not_found); BUG_ON(!is.s.not_found);
error = ext4_xattr_ibody_inline_set(handle, inode, &i, &is); error = ext4_xattr_ibody_set(handle, inode, &i, &is);
if (error) { if (error) {
if (error == -ENOSPC) if (error == -ENOSPC)
ext4_clear_inode_state(inode, ext4_clear_inode_state(inode,
...@@ -358,7 +358,7 @@ static int ext4_update_inline_data(handle_t *handle, struct inode *inode, ...@@ -358,7 +358,7 @@ static int ext4_update_inline_data(handle_t *handle, struct inode *inode,
i.value = value; i.value = value;
i.value_len = len; i.value_len = len;
error = ext4_xattr_ibody_inline_set(handle, inode, &i, &is); error = ext4_xattr_ibody_set(handle, inode, &i, &is);
if (error) if (error)
goto out; goto out;
...@@ -431,7 +431,7 @@ static int ext4_destroy_inline_data_nolock(handle_t *handle, ...@@ -431,7 +431,7 @@ static int ext4_destroy_inline_data_nolock(handle_t *handle,
if (error) if (error)
goto out; goto out;
error = ext4_xattr_ibody_inline_set(handle, inode, &i, &is); error = ext4_xattr_ibody_set(handle, inode, &i, &is);
if (error) if (error)
goto out; goto out;
...@@ -1925,8 +1925,7 @@ int ext4_inline_data_truncate(struct inode *inode, int *has_inline) ...@@ -1925,8 +1925,7 @@ int ext4_inline_data_truncate(struct inode *inode, int *has_inline)
i.value = value; i.value = value;
i.value_len = i_size > EXT4_MIN_INLINE_DATA_SIZE ? i.value_len = i_size > EXT4_MIN_INLINE_DATA_SIZE ?
i_size - EXT4_MIN_INLINE_DATA_SIZE : 0; i_size - EXT4_MIN_INLINE_DATA_SIZE : 0;
err = ext4_xattr_ibody_inline_set(handle, inode, err = ext4_xattr_ibody_set(handle, inode, &i, &is);
&i, &is);
if (err) if (err)
goto out_error; goto out_error;
} }
......
...@@ -2190,31 +2190,7 @@ int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i, ...@@ -2190,31 +2190,7 @@ int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
return 0; return 0;
} }
int ext4_xattr_ibody_inline_set(handle_t *handle, struct inode *inode, int ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
struct ext4_xattr_info *i,
struct ext4_xattr_ibody_find *is)
{
struct ext4_xattr_ibody_header *header;
struct ext4_xattr_search *s = &is->s;
int error;
if (EXT4_I(inode)->i_extra_isize == 0)
return -ENOSPC;
error = ext4_xattr_set_entry(i, s, handle, inode, false /* is_block */);
if (error)
return error;
header = IHDR(inode, ext4_raw_inode(&is->iloc));
if (!IS_LAST_ENTRY(s->first)) {
header->h_magic = cpu_to_le32(EXT4_XATTR_MAGIC);
ext4_set_inode_state(inode, EXT4_STATE_XATTR);
} else {
header->h_magic = cpu_to_le32(0);
ext4_clear_inode_state(inode, EXT4_STATE_XATTR);
}
return 0;
}
static int ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
struct ext4_xattr_info *i, struct ext4_xattr_info *i,
struct ext4_xattr_ibody_find *is) struct ext4_xattr_ibody_find *is)
{ {
......
...@@ -186,9 +186,9 @@ extern int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i, ...@@ -186,9 +186,9 @@ extern int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
extern int ext4_xattr_ibody_get(struct inode *inode, int name_index, extern int ext4_xattr_ibody_get(struct inode *inode, int name_index,
const char *name, const char *name,
void *buffer, size_t buffer_size); void *buffer, size_t buffer_size);
extern int ext4_xattr_ibody_inline_set(handle_t *handle, struct inode *inode, extern int ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
struct ext4_xattr_info *i, struct ext4_xattr_info *i,
struct ext4_xattr_ibody_find *is); struct ext4_xattr_ibody_find *is);
extern struct mb_cache *ext4_xattr_create_cache(void); extern struct mb_cache *ext4_xattr_create_cache(void);
extern void ext4_xattr_destroy_cache(struct mb_cache *); extern void ext4_xattr_destroy_cache(struct mb_cache *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment