All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: Remove duplicate definition of ext4_xattr_ibody_inline_set()
@ 2021-06-03  2:03 Ritesh Harjani
  2021-06-24 14:12 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Ritesh Harjani @ 2021-06-03  2:03 UTC (permalink / raw)
  To: linux-ext4; +Cc: Theodore Ts'o, Ritesh Harjani

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

Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
---
 fs/ext4/xattr.c | 32 ++++----------------------------
 1 file changed, 4 insertions(+), 28 deletions(-)

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 10ba4b24a0aa..88bb5d0fb9fc 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -2214,30 +2214,6 @@ int ext4_xattr_ibody_inline_set(handle_t *handle, struct inode *inode,
 	return 0;
 }

-static 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_value_same(struct ext4_xattr_search *s,
 				 struct ext4_xattr_info *i)
 {
@@ -2365,7 +2341,7 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,

 	if (!value) {
 		if (!is.s.not_found)
-			error = ext4_xattr_ibody_set(handle, inode, &i, &is);
+			error = ext4_xattr_ibody_inline_set(handle, inode, &i, &is);
 		else if (!bs.s.not_found)
 			error = ext4_xattr_block_set(handle, inode, &i, &bs);
 	} else {
@@ -2381,7 +2357,7 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
 			EXT4_XATTR_MIN_LARGE_EA_SIZE(inode->i_sb->s_blocksize)))
 			i.in_inode = 1;
 retry_inode:
-		error = ext4_xattr_ibody_set(handle, inode, &i, &is);
+		error = ext4_xattr_ibody_inline_set(handle, inode, &i, &is);
 		if (!error && !bs.s.not_found) {
 			i.value = NULL;
 			error = ext4_xattr_block_set(handle, inode, &i, &bs);
@@ -2396,7 +2372,7 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
 			error = ext4_xattr_block_set(handle, inode, &i, &bs);
 			if (!error && !is.s.not_found) {
 				i.value = NULL;
-				error = ext4_xattr_ibody_set(handle, inode, &i,
+				error = ext4_xattr_ibody_inline_set(handle, inode, &i,
 							     &is);
 			} else if (error == -ENOSPC) {
 				/*
@@ -2591,7 +2567,7 @@ static int ext4_xattr_move_to_block(handle_t *handle, struct inode *inode,
 		goto out;

 	/* Remove the chosen entry from the inode */
-	error = ext4_xattr_ibody_set(handle, inode, &i, is);
+	error = ext4_xattr_ibody_inline_set(handle, inode, &i, is);
 	if (error)
 		goto out;

--
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: Remove duplicate definition of ext4_xattr_ibody_inline_set()
  2021-06-03  2:03 [PATCH] ext4: Remove duplicate definition of ext4_xattr_ibody_inline_set() Ritesh Harjani
@ 2021-06-24 14:12 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2021-06-24 14:12 UTC (permalink / raw)
  To: Ritesh Harjani; +Cc: linux-ext4

On Thu, Jun 03, 2021 at 07:33:02AM +0530, Ritesh Harjani wrote:
> ext4_xattr_ibody_inline_set() & ext4_xattr_ibody_set() have the exact
> same definition. Hence remove ext4_xattr_ibody_set() and all it's call
> references. Convert the callers of it to call ext4_xattr_ibody_inline_set()
> instead.
> 
> Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>

Thanks, applied.  I modified the patch to preserve
ext4_xattr_ibody_set() and remove ext4_xattr_ibody_inline_set()
instead, to make things clearer; otherwise people would wonder why the
non-inline functions were calling ext4_xattr_ibody_inline_set().

						- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-24 14:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03  2:03 [PATCH] ext4: Remove duplicate definition of ext4_xattr_ibody_inline_set() Ritesh Harjani
2021-06-24 14:12 ` Theodore Ts'o

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.