All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs: send: two tiny unused parameter cleanups
@ 2021-11-05  0:00 Omar Sandoval
  2021-11-05  0:00 ` [PATCH 1/2] btrfs: send: remove unused found_type parameter to lookup_dir_item_inode() Omar Sandoval
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Omar Sandoval @ 2021-11-05  0:00 UTC (permalink / raw)
  To: linux-btrfs; +Cc: kernel-team

From: Omar Sandoval <osandov@fb.com>

I encountered some places where we pass around btrfs_dir_type()
unnecessarily while I was working on fscrypt support. I might need to
stuff a flag in btrfs_dir_type() for fscrypt, so using dir_type in less
places makes it easier to audit that change. Either way, these are
unused parameters so we should just drop them as a cleanup.

Omar Sandoval (2):
  btrfs: send: remove unused found_type parameter to
    lookup_dir_item_inode()
  btrfs: send: remove unused type parameter to iterate_inode_ref_t

 fs/btrfs/send.c | 43 +++++++++++++++++--------------------------
 1 file changed, 17 insertions(+), 26 deletions(-)

-- 
2.33.1


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

* [PATCH 1/2] btrfs: send: remove unused found_type parameter to lookup_dir_item_inode()
  2021-11-05  0:00 [PATCH 0/2] btrfs: send: two tiny unused parameter cleanups Omar Sandoval
@ 2021-11-05  0:00 ` Omar Sandoval
  2021-11-05  0:00 ` [PATCH 2/2] btrfs: send: remove unused type parameter to iterate_inode_ref_t Omar Sandoval
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Omar Sandoval @ 2021-11-05  0:00 UTC (permalink / raw)
  To: linux-btrfs; +Cc: kernel-team

From: Omar Sandoval <osandov@fb.com>

As far as I can tell, this was never used. No functional change.

Signed-off-by: Omar Sandoval <osandov@fb.com>
---
 fs/btrfs/send.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 040324d71118..9df4203edb19 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1692,8 +1692,7 @@ static int is_inode_existent(struct send_ctx *sctx, u64 ino, u64 gen)
  */
 static int lookup_dir_item_inode(struct btrfs_root *root,
 				 u64 dir, const char *name, int name_len,
-				 u64 *found_inode,
-				 u8 *found_type)
+				 u64 *found_inode)
 {
 	int ret = 0;
 	struct btrfs_dir_item *di;
@@ -1716,7 +1715,6 @@ static int lookup_dir_item_inode(struct btrfs_root *root,
 		goto out;
 	}
 	*found_inode = key.objectid;
-	*found_type = btrfs_dir_type(path->nodes[0], di);
 
 out:
 	btrfs_free_path(path);
@@ -1839,7 +1837,6 @@ static int will_overwrite_ref(struct send_ctx *sctx, u64 dir, u64 dir_gen,
 	int ret = 0;
 	u64 gen;
 	u64 other_inode = 0;
-	u8 other_type = 0;
 
 	if (!sctx->parent_root)
 		goto out;
@@ -1867,7 +1864,7 @@ static int will_overwrite_ref(struct send_ctx *sctx, u64 dir, u64 dir_gen,
 	}
 
 	ret = lookup_dir_item_inode(sctx->parent_root, dir, name, name_len,
-			&other_inode, &other_type);
+				    &other_inode);
 	if (ret < 0 && ret != -ENOENT)
 		goto out;
 	if (ret) {
@@ -1912,7 +1909,6 @@ static int did_overwrite_ref(struct send_ctx *sctx,
 	int ret = 0;
 	u64 gen;
 	u64 ow_inode;
-	u8 other_type;
 
 	if (!sctx->parent_root)
 		goto out;
@@ -1936,7 +1932,7 @@ static int did_overwrite_ref(struct send_ctx *sctx,
 
 	/* check if the ref was overwritten by another ref */
 	ret = lookup_dir_item_inode(sctx->send_root, dir, name, name_len,
-			&ow_inode, &other_type);
+				    &ow_inode);
 	if (ret < 0 && ret != -ENOENT)
 		goto out;
 	if (ret) {
-- 
2.33.1


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

* [PATCH 2/2] btrfs: send: remove unused type parameter to iterate_inode_ref_t
  2021-11-05  0:00 [PATCH 0/2] btrfs: send: two tiny unused parameter cleanups Omar Sandoval
  2021-11-05  0:00 ` [PATCH 1/2] btrfs: send: remove unused found_type parameter to lookup_dir_item_inode() Omar Sandoval
@ 2021-11-05  0:00 ` Omar Sandoval
  2021-11-05 10:07 ` [PATCH 0/2] btrfs: send: two tiny unused parameter cleanups Josef Bacik
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Omar Sandoval @ 2021-11-05  0:00 UTC (permalink / raw)
  To: linux-btrfs; +Cc: kernel-team

From: Omar Sandoval <osandov@fb.com>

Again, I don't think this was ever used since iterate_dir_item() is only
used for xattrs. No functional change.

Signed-off-by: Omar Sandoval <osandov@fb.com>
---
 fs/btrfs/send.c | 33 ++++++++++++++-------------------
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 9df4203edb19..9221f6189084 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -1004,7 +1004,7 @@ static int iterate_inode_ref(struct btrfs_root *root, struct btrfs_path *path,
 typedef int (*iterate_dir_item_t)(int num, struct btrfs_key *di_key,
 				  const char *name, int name_len,
 				  const char *data, int data_len,
-				  u8 type, void *ctx);
+				  void *ctx);
 
 /*
  * Helper function to iterate the entries in ONE btrfs_dir_item.
@@ -1030,7 +1030,6 @@ static int iterate_dir_item(struct btrfs_root *root, struct btrfs_path *path,
 	u32 total;
 	int slot;
 	int num;
-	u8 type;
 
 	/*
 	 * Start with a small buffer (1 page). If later we end up needing more
@@ -1057,10 +1056,9 @@ static int iterate_dir_item(struct btrfs_root *root, struct btrfs_path *path,
 	while (cur < total) {
 		name_len = btrfs_dir_name_len(eb, di);
 		data_len = btrfs_dir_data_len(eb, di);
-		type = btrfs_dir_type(eb, di);
 		btrfs_dir_item_key_to_cpu(eb, di, &di_key);
 
-		if (type == BTRFS_FT_XATTR) {
+		if (btrfs_dir_type(eb, di) == BTRFS_FT_XATTR) {
 			if (name_len > XATTR_NAME_MAX) {
 				ret = -ENAMETOOLONG;
 				goto out;
@@ -1110,7 +1108,7 @@ static int iterate_dir_item(struct btrfs_root *root, struct btrfs_path *path,
 		cur += len;
 
 		ret = iterate(num, &di_key, buf, name_len, buf + name_len,
-				data_len, type, ctx);
+			      data_len, ctx);
 		if (ret < 0)
 			goto out;
 		if (ret) {
@@ -4647,9 +4645,8 @@ static int send_remove_xattr(struct send_ctx *sctx,
 }
 
 static int __process_new_xattr(int num, struct btrfs_key *di_key,
-			       const char *name, int name_len,
-			       const char *data, int data_len,
-			       u8 type, void *ctx)
+			       const char *name, int name_len, const char *data,
+			       int data_len, void *ctx)
 {
 	int ret;
 	struct send_ctx *sctx = ctx;
@@ -4693,8 +4690,7 @@ static int __process_new_xattr(int num, struct btrfs_key *di_key,
 
 static int __process_deleted_xattr(int num, struct btrfs_key *di_key,
 				   const char *name, int name_len,
-				   const char *data, int data_len,
-				   u8 type, void *ctx)
+				   const char *data, int data_len, void *ctx)
 {
 	int ret;
 	struct send_ctx *sctx = ctx;
@@ -4739,10 +4735,9 @@ struct find_xattr_ctx {
 	int found_data_len;
 };
 
-static int __find_xattr(int num, struct btrfs_key *di_key,
-			const char *name, int name_len,
-			const char *data, int data_len,
-			u8 type, void *vctx)
+static int __find_xattr(int num, struct btrfs_key *di_key, const char *name,
+			int name_len, const char *data, int data_len,
+			void *vctx)
 {
 	struct find_xattr_ctx *ctx = vctx;
 
@@ -4792,7 +4787,7 @@ static int find_xattr(struct btrfs_root *root,
 static int __process_changed_new_xattr(int num, struct btrfs_key *di_key,
 				       const char *name, int name_len,
 				       const char *data, int data_len,
-				       u8 type, void *ctx)
+				       void *ctx)
 {
 	int ret;
 	struct send_ctx *sctx = ctx;
@@ -4804,12 +4799,12 @@ static int __process_changed_new_xattr(int num, struct btrfs_key *di_key,
 			 &found_data_len);
 	if (ret == -ENOENT) {
 		ret = __process_new_xattr(num, di_key, name, name_len, data,
-				data_len, type, ctx);
+					  data_len, ctx);
 	} else if (ret >= 0) {
 		if (data_len != found_data_len ||
 		    memcmp(data, found_data, data_len)) {
 			ret = __process_new_xattr(num, di_key, name, name_len,
-					data, data_len, type, ctx);
+						  data, data_len, ctx);
 		} else {
 			ret = 0;
 		}
@@ -4822,7 +4817,7 @@ static int __process_changed_new_xattr(int num, struct btrfs_key *di_key,
 static int __process_changed_deleted_xattr(int num, struct btrfs_key *di_key,
 					   const char *name, int name_len,
 					   const char *data, int data_len,
-					   u8 type, void *ctx)
+					   void *ctx)
 {
 	int ret;
 	struct send_ctx *sctx = ctx;
@@ -4831,7 +4826,7 @@ static int __process_changed_deleted_xattr(int num, struct btrfs_key *di_key,
 			 name, name_len, NULL, NULL);
 	if (ret == -ENOENT)
 		ret = __process_deleted_xattr(num, di_key, name, name_len, data,
-				data_len, type, ctx);
+					      data_len, ctx);
 	else if (ret >= 0)
 		ret = 0;
 
-- 
2.33.1


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

* Re: [PATCH 0/2] btrfs: send: two tiny unused parameter cleanups
  2021-11-05  0:00 [PATCH 0/2] btrfs: send: two tiny unused parameter cleanups Omar Sandoval
  2021-11-05  0:00 ` [PATCH 1/2] btrfs: send: remove unused found_type parameter to lookup_dir_item_inode() Omar Sandoval
  2021-11-05  0:00 ` [PATCH 2/2] btrfs: send: remove unused type parameter to iterate_inode_ref_t Omar Sandoval
@ 2021-11-05 10:07 ` Josef Bacik
  2021-11-05 10:13 ` Nikolay Borisov
  2021-11-08 19:40 ` David Sterba
  4 siblings, 0 replies; 6+ messages in thread
From: Josef Bacik @ 2021-11-05 10:07 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: linux-btrfs, kernel-team

On Thu, Nov 04, 2021 at 05:00:11PM -0700, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
> 
> I encountered some places where we pass around btrfs_dir_type()
> unnecessarily while I was working on fscrypt support. I might need to
> stuff a flag in btrfs_dir_type() for fscrypt, so using dir_type in less
> places makes it easier to audit that change. Either way, these are
> unused parameters so we should just drop them as a cleanup.
> 
> Omar Sandoval (2):
>   btrfs: send: remove unused found_type parameter to
>     lookup_dir_item_inode()
>   btrfs: send: remove unused type parameter to iterate_inode_ref_t
> 
>  fs/btrfs/send.c | 43 +++++++++++++++++--------------------------
>  1 file changed, 17 insertions(+), 26 deletions(-)
> 

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef

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

* Re: [PATCH 0/2] btrfs: send: two tiny unused parameter cleanups
  2021-11-05  0:00 [PATCH 0/2] btrfs: send: two tiny unused parameter cleanups Omar Sandoval
                   ` (2 preceding siblings ...)
  2021-11-05 10:07 ` [PATCH 0/2] btrfs: send: two tiny unused parameter cleanups Josef Bacik
@ 2021-11-05 10:13 ` Nikolay Borisov
  2021-11-08 19:40 ` David Sterba
  4 siblings, 0 replies; 6+ messages in thread
From: Nikolay Borisov @ 2021-11-05 10:13 UTC (permalink / raw)
  To: Omar Sandoval, linux-btrfs; +Cc: kernel-team



On 5.11.21 г. 2:00, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
> 
> I encountered some places where we pass around btrfs_dir_type()
> unnecessarily while I was working on fscrypt support. I might need to
> stuff a flag in btrfs_dir_type() for fscrypt, so using dir_type in less
> places makes it easier to audit that change. Either way, these are
> unused parameters so we should just drop them as a cleanup.
> 
> Omar Sandoval (2):
>   btrfs: send: remove unused found_type parameter to
>     lookup_dir_item_inode()
>   btrfs: send: remove unused type parameter to iterate_inode_ref_t
> 
>  fs/btrfs/send.c | 43 +++++++++++++++++--------------------------
>  1 file changed, 17 insertions(+), 26 deletions(-)
> 


Reviewed-by: Nikolay Borisov <nborisov@suse.com>

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

* Re: [PATCH 0/2] btrfs: send: two tiny unused parameter cleanups
  2021-11-05  0:00 [PATCH 0/2] btrfs: send: two tiny unused parameter cleanups Omar Sandoval
                   ` (3 preceding siblings ...)
  2021-11-05 10:13 ` Nikolay Borisov
@ 2021-11-08 19:40 ` David Sterba
  4 siblings, 0 replies; 6+ messages in thread
From: David Sterba @ 2021-11-08 19:40 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: linux-btrfs, kernel-team

On Thu, Nov 04, 2021 at 05:00:11PM -0700, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@fb.com>
> 
> I encountered some places where we pass around btrfs_dir_type()
> unnecessarily while I was working on fscrypt support. I might need to
> stuff a flag in btrfs_dir_type() for fscrypt, so using dir_type in less
> places makes it easier to audit that change. Either way, these are
> unused parameters so we should just drop them as a cleanup.
> 
> Omar Sandoval (2):
>   btrfs: send: remove unused found_type parameter to
>     lookup_dir_item_inode()
>   btrfs: send: remove unused type parameter to iterate_inode_ref_t

Added to misc-next, thanks.

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

end of thread, other threads:[~2021-11-08 19:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05  0:00 [PATCH 0/2] btrfs: send: two tiny unused parameter cleanups Omar Sandoval
2021-11-05  0:00 ` [PATCH 1/2] btrfs: send: remove unused found_type parameter to lookup_dir_item_inode() Omar Sandoval
2021-11-05  0:00 ` [PATCH 2/2] btrfs: send: remove unused type parameter to iterate_inode_ref_t Omar Sandoval
2021-11-05 10:07 ` [PATCH 0/2] btrfs: send: two tiny unused parameter cleanups Josef Bacik
2021-11-05 10:13 ` Nikolay Borisov
2021-11-08 19:40 ` David Sterba

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.