All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs: send: a couple trivial cleanups
@ 2025-03-06 17:55 fdmanana
  2025-03-06 17:55 ` [PATCH 1/2] btrfs: send: remove unnecessary inode lookup at send_encoded_inline_extent() fdmanana
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: fdmanana @ 2025-03-06 17:55 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

Simple cleanups, reduce code, details in the change logs.

Filipe Manana (2):
  btrfs: send: remove unnecessary inode lookup at send_encoded_inline_extent()
  btrfs: send: simplify return logic from send_encoded_extent()

 fs/btrfs/send.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

-- 
2.45.2


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

* [PATCH 1/2] btrfs: send: remove unnecessary inode lookup at send_encoded_inline_extent()
  2025-03-06 17:55 [PATCH 0/2] btrfs: send: a couple trivial cleanups fdmanana
@ 2025-03-06 17:55 ` fdmanana
  2025-03-06 17:55 ` [PATCH 2/2] btrfs: send: simplify return logic from send_encoded_extent() fdmanana
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: fdmanana @ 2025-03-06 17:55 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

We doing a lookup of the inode but we don't use it at all. So just remove
this pointless lookup.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/send.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index e225530d3ebb..41e913e01d49 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -5523,7 +5523,6 @@ static int send_encoded_inline_extent(struct send_ctx *sctx,
 {
 	struct btrfs_root *root = sctx->send_root;
 	struct btrfs_fs_info *fs_info = root->fs_info;
-	struct inode *inode;
 	struct fs_path *fspath;
 	struct extent_buffer *leaf = path->nodes[0];
 	struct btrfs_key key;
@@ -5532,10 +5531,6 @@ static int send_encoded_inline_extent(struct send_ctx *sctx,
 	size_t inline_size;
 	int ret;
 
-	inode = btrfs_iget(sctx->cur_ino, root);
-	if (IS_ERR(inode))
-		return PTR_ERR(inode);
-
 	fspath = get_cur_inode_path(sctx);
 	if (IS_ERR(fspath)) {
 		ret = PTR_ERR(fspath);
@@ -5574,7 +5569,6 @@ static int send_encoded_inline_extent(struct send_ctx *sctx,
 
 tlv_put_failure:
 out:
-	iput(inode);
 	return ret;
 }
 
-- 
2.45.2


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

* [PATCH 2/2] btrfs: send: simplify return logic from send_encoded_extent()
  2025-03-06 17:55 [PATCH 0/2] btrfs: send: a couple trivial cleanups fdmanana
  2025-03-06 17:55 ` [PATCH 1/2] btrfs: send: remove unnecessary inode lookup at send_encoded_inline_extent() fdmanana
@ 2025-03-06 17:55 ` fdmanana
  2025-03-06 18:33 ` [PATCH 0/2] btrfs: send: a couple trivial cleanups David Sterba
  2025-03-06 21:53 ` Qu Wenruo
  3 siblings, 0 replies; 5+ messages in thread
From: fdmanana @ 2025-03-06 17:55 UTC (permalink / raw)
  To: linux-btrfs

From: Filipe Manana <fdmanana@suse.com>

The 'out' label is pointless as we don't have anything to cleanup anymore
(we used to have an inode to iput), so remove it and make error paths
directly return an error.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 fs/btrfs/send.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 41e913e01d49..31f9122eaac9 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -5532,14 +5532,12 @@ static int send_encoded_inline_extent(struct send_ctx *sctx,
 	int ret;
 
 	fspath = get_cur_inode_path(sctx);
-	if (IS_ERR(fspath)) {
-		ret = PTR_ERR(fspath);
-		goto out;
-	}
+	if (IS_ERR(fspath))
+		return PTR_ERR(fspath);
 
 	ret = begin_cmd(sctx, BTRFS_SEND_C_ENCODED_WRITE);
 	if (ret < 0)
-		goto out;
+		return ret;
 
 	btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
 	ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_file_extent_item);
@@ -5555,12 +5553,12 @@ static int send_encoded_inline_extent(struct send_ctx *sctx,
 	ret = btrfs_encoded_io_compression_from_extent(fs_info,
 				btrfs_file_extent_compression(leaf, ei));
 	if (ret < 0)
-		goto out;
+		return ret;
 	TLV_PUT_U32(sctx, BTRFS_SEND_A_COMPRESSION, ret);
 
 	ret = put_data_header(sctx, inline_size);
 	if (ret < 0)
-		goto out;
+		return ret;
 	read_extent_buffer(leaf, sctx->send_buf + sctx->send_size,
 			   btrfs_file_extent_inline_start(ei), inline_size);
 	sctx->send_size += inline_size;
@@ -5568,7 +5566,6 @@ static int send_encoded_inline_extent(struct send_ctx *sctx,
 	ret = send_cmd(sctx);
 
 tlv_put_failure:
-out:
 	return ret;
 }
 
-- 
2.45.2


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

* Re: [PATCH 0/2] btrfs: send: a couple trivial cleanups
  2025-03-06 17:55 [PATCH 0/2] btrfs: send: a couple trivial cleanups fdmanana
  2025-03-06 17:55 ` [PATCH 1/2] btrfs: send: remove unnecessary inode lookup at send_encoded_inline_extent() fdmanana
  2025-03-06 17:55 ` [PATCH 2/2] btrfs: send: simplify return logic from send_encoded_extent() fdmanana
@ 2025-03-06 18:33 ` David Sterba
  2025-03-06 21:53 ` Qu Wenruo
  3 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2025-03-06 18:33 UTC (permalink / raw)
  To: fdmanana; +Cc: linux-btrfs

On Thu, Mar 06, 2025 at 05:55:52PM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Simple cleanups, reduce code, details in the change logs.
> 
> Filipe Manana (2):
>   btrfs: send: remove unnecessary inode lookup at send_encoded_inline_extent()
>   btrfs: send: simplify return logic from send_encoded_extent()

Reviewed-by: David Sterba <dsterba@suse.com>

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

* Re: [PATCH 0/2] btrfs: send: a couple trivial cleanups
  2025-03-06 17:55 [PATCH 0/2] btrfs: send: a couple trivial cleanups fdmanana
                   ` (2 preceding siblings ...)
  2025-03-06 18:33 ` [PATCH 0/2] btrfs: send: a couple trivial cleanups David Sterba
@ 2025-03-06 21:53 ` Qu Wenruo
  3 siblings, 0 replies; 5+ messages in thread
From: Qu Wenruo @ 2025-03-06 21:53 UTC (permalink / raw)
  To: fdmanana, linux-btrfs



在 2025/3/7 04:25, fdmanana@kernel.org 写道:
> From: Filipe Manana <fdmanana@suse.com>
>
> Simple cleanups, reduce code, details in the change logs.

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

>
> Filipe Manana (2):
>    btrfs: send: remove unnecessary inode lookup at send_encoded_inline_extent()
>    btrfs: send: simplify return logic from send_encoded_extent()
>
>   fs/btrfs/send.c | 19 +++++--------------
>   1 file changed, 5 insertions(+), 14 deletions(-)
>


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

end of thread, other threads:[~2025-03-06 21:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-06 17:55 [PATCH 0/2] btrfs: send: a couple trivial cleanups fdmanana
2025-03-06 17:55 ` [PATCH 1/2] btrfs: send: remove unnecessary inode lookup at send_encoded_inline_extent() fdmanana
2025-03-06 17:55 ` [PATCH 2/2] btrfs: send: simplify return logic from send_encoded_extent() fdmanana
2025-03-06 18:33 ` [PATCH 0/2] btrfs: send: a couple trivial cleanups David Sterba
2025-03-06 21:53 ` Qu Wenruo

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.