From patchwork Thu Mar 6 17:55:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 14005080 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C5A926A0D4 for ; Thu, 6 Mar 2025 17:56:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741283763; cv=none; b=h0fcIDbF4xhgUrAD6Tb7Bj8RqjJDlk4phu7sqpqEwZ9mqIe5p7/PG+jRzmW0pmlQKWlnaDoFvbFnG1pp68Kp+sHeVlPXBuACnJJRPZcMCP9NuxclMxzh9bdv/j5DUTMcp40D9HCjKnNGn7gYOCF4+sQKPDRA5rMoHEAv1TAKtQw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741283763; c=relaxed/simple; bh=NKcxbm23zJKcZRmQlFkev2gDy+1DKtRpz0aW9/2yx3w=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=trXt07CjFud8eaK3xy5j69v7NC0tV6ZuhrE6Nzq/AUXXa514M0L+sE0Oay9q0K5PE9zj6K7WJ0GdNIZMsBf9TyfWKbGFwOsfwydu3Ku0w2BdZHGSKT/AFFv6vSQHbqKASrgN0fee5gFEfSy1bjI8FHms8yU583X7BWBzP2wrb54= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dMtmVUfG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dMtmVUfG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E402C4CEE8 for ; Thu, 6 Mar 2025 17:56:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741283762; bh=NKcxbm23zJKcZRmQlFkev2gDy+1DKtRpz0aW9/2yx3w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=dMtmVUfG64QaRP7OPByKh2Sx+AhSOzYNujgubtijnbAdJYplor33ON5ozt+s2CJFP x8Eu0K0/vVaxBGKVLe7Qs0DJSPXg9Eh/J3Q6c39kS4m+lLD3q1hakEwFpckPQelH4e hwkowWPkaoGpJj/OQl2pNaDA8EQm9bjk7Iwvd508KY04g1Zb6KaN5mdCX1GSX9Q+Pn Iz4/4e/UTSB8s3e1plbynk1oGK8FrHhkWMrITb+BAN/vQua/HTgSUa12u4qHAq7W+8 ytji2BKn+8SSXX2GvAVvxphYS58DVt5c04V8Gq/8X58hTnGh9pfPIALbLUfATsuYVi ge4o4NR6GVhOA== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 1/2] btrfs: send: remove unnecessary inode lookup at send_encoded_inline_extent() Date: Thu, 6 Mar 2025 17:55:53 +0000 Message-Id: <89867e61f94b9a9f3711f66c141e4d483a9cc6bd.1741283556.git.fdmanana@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Filipe Manana 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 --- 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; } From patchwork Thu Mar 6 17:55:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 14005081 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D231C26A1BE for ; Thu, 6 Mar 2025 17:56:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741283763; cv=none; b=qxaKzvTMJ/SFDrjRDKSe0m8TDepZZllXKLQzeu6oFUFfZD06ony0DLl6eU7iJg8q5KLof1TDMvE81BJPprgzT1fwabaYhN6f25tDlCz9HqwGizjCi/H6MDR3+rgCmr6V+TFr9bJk1zYDAxLeD4FuZ1S3z3D7W+IQZzXwf276on0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741283763; c=relaxed/simple; bh=mtjN1JVjvQuafxMFfIGM8MGXz+2owKhsFy3n4P6zDL8=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kxq3jCt1S2A1T7ozKvarYES/jV9ExwO284XSS/pNOmQljJ7bZON97e0PqVZ1Zy9HGH9st/BO4AOtw4sDuuKaWjJxlgF/hubJN66VpIcYFU63FOkZ/eUNO07YynCdD+49lpM5Feg/0Up+3KP6pVGKqyZ1Nh8wi8aZAqmDAuO8pkQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XBGFIDLk; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XBGFIDLk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FC39C4CEE4 for ; Thu, 6 Mar 2025 17:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741283763; bh=mtjN1JVjvQuafxMFfIGM8MGXz+2owKhsFy3n4P6zDL8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=XBGFIDLkYCgk1u2I+qxqVu6ktnThsZJ9Ffe6Kka4qwmHeiZIjWiWl9Nb8ov81M9rE eeNzRld3gZdANC0VxbklNI6lZD4iioooYgqlhBnJ3/8Obi+jZLnLyLrHtHixaGo3jd tBSmvttRrLJMBtXIhYHwv5wl27b1bV98IUkvAz0x2m8/xAciO7vb3LeEIAi1jkKL3p BPUvnq/FW1XS+nVfoChfNQnT2B0xbsw1oOX7mRKjDKqs72vvYIMOUzUem8vwSrBphg HQrR9vWaxhOleRpdCzjVRqC+aDk5mFtqpusX0kJ6LXccCN2ZlRcZNMsO971YM64SCL 3NBOosfURCw1w== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 2/2] btrfs: send: simplify return logic from send_encoded_extent() Date: Thu, 6 Mar 2025 17:55:54 +0000 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Filipe Manana 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 --- 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; }