From patchwork Wed Dec 18 17:06:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913965 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 BB2711F8918 for ; Wed, 18 Dec 2024 17:06:52 +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=1734541612; cv=none; b=kt2rmVdHtwNby1wI4ifb65RTT0Z8qt0nZvGCvRQigIfQTPvJuuEb98EKPPTAWbpZCBYIYCON5rZ2zyCef81AWLNNPvjNkSRQ9+bxMmwNvvPJxW0BzVH2HwRzMjLq9hp7/tem3AnkPF+Ud9i+gCU4KtD6Uy0nUQDPdcoXkMBuckc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541612; c=relaxed/simple; bh=pLEY2zhDOE2z8aq9wzl+/YcRQyIznjqVH+rfhB1bEOc=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YHIE8Lh+8vuq14EjwTTkIbmQ4pg7TTI9WcDHLNKUdFMT71I8ehwGHY+yxxnfPm+rAHyCjzqiXAmebCmZbiR0Gzpq+zSIBBT3EVnoyMcOpfniUpPiH6qbtujVzppUsx7PwOpRJ7uxY0NAGdTlg6O7Q/74GtR9nrJro07m2gNdy30= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QPqLLlwR; 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="QPqLLlwR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18521C4CED7 for ; Wed, 18 Dec 2024 17:06:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541612; bh=pLEY2zhDOE2z8aq9wzl+/YcRQyIznjqVH+rfhB1bEOc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QPqLLlwRZbj0Bg+KYQXJKWM1orkfx0KYE5DFVHDsBeJSuxE2y4K0LK8kRYGTpg6vq JSLMtsO4Sf7AS9a9TBHhxBJR2DaMKX6IA2bHJ2YwjYhkyvMpvW03jfBnpr67xaWTR0 +Kl9huA9glOGtSFPQk5ULkn8gs8eGkySCpvPbMzgEWz2WKbpB/RBFDXOCKFnDCDQ7Q JVAExJv/+vtncM6ZOZMa40D66UilKsc7kNdxUxNZrsfNhtymrtmJwZodTIlldyuxUI 0EGoIGjX0WYw7y3YtS52g4QFa47IFN8XghiixXhUPrPLNavOVVdRcaMjMjh74qqeM6 7bAEuU1pkILIw== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 01/20] btrfs: tree-log: remove unnecessary calls to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:28 +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 We have several places explicitly calling btrfs_mark_buffer_dirty() but that is not necessarily since the target leaf came from a path that was obtained for a btree search function that modifies the btree, something like btrfs_insert_empty_item() or anything else that ends up calling btrfs_search_slot() with a value of 1 for its 'cow' argument. These just make the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove them. Signed-off-by: Filipe Manana --- fs/btrfs/tree-log.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index c8d6587688b3..955d1677e865 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -590,7 +590,6 @@ static int overwrite_item(struct btrfs_trans_handle *trans, } } no_copy: - btrfs_mark_buffer_dirty(trans, path->nodes[0]); btrfs_release_path(path); return 0; } @@ -3588,7 +3587,6 @@ static noinline int insert_dir_log_key(struct btrfs_trans_handle *trans, last_offset = max(last_offset, curr_end); } btrfs_set_dir_log_end(path->nodes[0], item, last_offset); - btrfs_mark_buffer_dirty(trans, path->nodes[0]); btrfs_release_path(path); return 0; } @@ -4566,7 +4564,6 @@ static noinline int copy_items(struct btrfs_trans_handle *trans, dst_index++; } - btrfs_mark_buffer_dirty(trans, dst_path->nodes[0]); btrfs_release_path(dst_path); out: kfree(ins_data); @@ -4776,7 +4773,6 @@ static int log_one_extent(struct btrfs_trans_handle *trans, write_extent_buffer(leaf, &fi, btrfs_item_ptr_offset(leaf, path->slots[0]), sizeof(fi)); - btrfs_mark_buffer_dirty(trans, leaf); btrfs_release_path(path); From patchwork Wed Dec 18 17:06:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913966 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 1F26A1F8918 for ; Wed, 18 Dec 2024 17:06:53 +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=1734541614; cv=none; b=Pbqit6y091DPxKHR4Jx2BGheqLAgjJBqKks+AgUQrFIW7BD0mnmIDMEIkslK80IfDBa1WLxA01AYv3ISS52FVYZnmQCPc89d6KV0yyXv7zsqoAOT7ku5zHrzBeKicUZbJwkNSyhoMR6OP8oGEIIt9dw0isw5vpu1otkyZIULfDs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541614; c=relaxed/simple; bh=BwUAXHhOA7D9Kal0sVDx/HFoLX29NSdBRrKZ0XfCpLY=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cBb7UHKrIqufTT8AWBK0J9XCo00kTlbT2+ErC77nv8OyyB98otKoEXJjyMG52YR2WUEV7K2DPoXFncYQaKLQKpoCHbVLKBWLOKLl1gsZPFTIo1tYnXaIS6kJN+neFEK1ohdYnHJG6X9gO1rtNilHznQRGKXam37p7qSfe6kmHZk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=o43hnF/E; 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="o43hnF/E" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BCC7C4CEDC for ; Wed, 18 Dec 2024 17:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541613; bh=BwUAXHhOA7D9Kal0sVDx/HFoLX29NSdBRrKZ0XfCpLY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=o43hnF/EI+jzTJ+RS17HNtL2ROJzNka4Bb5AubqFZKnbrYEaRE5hxlWnDIO/EkTc4 rHTlsEgdjpzTECOI0gOaYLUAoBCcMgGdY39MDYlTLmsA1F8RQeEcg9mSARLNzCE/Vo uvMV7gJTL4n3+J9qT6x20PCPJKQZ+rybmUZ2m9oxKs7IB4NtFp4s7j/7YDyd9dJZAb Hbw+eLAQqb24aykrlIpB+Ii6DnnLQE4d8I8AhaLz0Yjc8evdsf9G0vx3DhFBBUYsje q3Rrxh2dHgi3cjADYNCK8/Z4GxTFBmcpmpZa1DNhKXaJzcNyK4k//i/uqSmO82oMDJ LhO9ZM8smyjWw== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 02/20] btrfs: free-space-tree: remove unnecessary calls to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:29 +0000 Message-Id: <40d7047ff0a3a423e2b6cc371895a4b4ff9708d3.1734527445.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 have several places explicitly calling btrfs_mark_buffer_dirty() but that is not necessarily since the target leaf came from a path that was obtained for a btree search function that modifies the btree, something ike btrfs_insert_empty_item() or anything else that ends up calling btrfs_search_slot() with a value of 1 for its 'cow' argument. These just make the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove them. Signed-off-by: Filipe Manana --- fs/btrfs/free-space-tree.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fs/btrfs/free-space-tree.c b/fs/btrfs/free-space-tree.c index 7ba50e133921..710205799409 100644 --- a/fs/btrfs/free-space-tree.c +++ b/fs/btrfs/free-space-tree.c @@ -89,7 +89,6 @@ static int add_new_free_space_info(struct btrfs_trans_handle *trans, struct btrfs_free_space_info); btrfs_set_free_space_extent_count(leaf, info, 0); btrfs_set_free_space_flags(leaf, info, 0); - btrfs_mark_buffer_dirty(trans, leaf); ret = 0; out: @@ -287,7 +286,6 @@ int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans, flags |= BTRFS_FREE_SPACE_USING_BITMAPS; btrfs_set_free_space_flags(leaf, info, flags); expected_extent_count = btrfs_free_space_extent_count(leaf, info); - btrfs_mark_buffer_dirty(trans, leaf); btrfs_release_path(path); if (extent_count != expected_extent_count) { @@ -324,7 +322,6 @@ int convert_free_space_to_bitmaps(struct btrfs_trans_handle *trans, ptr = btrfs_item_ptr_offset(leaf, path->slots[0]); write_extent_buffer(leaf, bitmap_cursor, ptr, data_size); - btrfs_mark_buffer_dirty(trans, leaf); btrfs_release_path(path); i += extent_size; @@ -430,7 +427,6 @@ int convert_free_space_to_extents(struct btrfs_trans_handle *trans, flags &= ~BTRFS_FREE_SPACE_USING_BITMAPS; btrfs_set_free_space_flags(leaf, info, flags); expected_extent_count = btrfs_free_space_extent_count(leaf, info); - btrfs_mark_buffer_dirty(trans, leaf); btrfs_release_path(path); nrbits = block_group->length >> block_group->fs_info->sectorsize_bits; @@ -495,7 +491,6 @@ static int update_free_space_extent_count(struct btrfs_trans_handle *trans, extent_count += new_extents; btrfs_set_free_space_extent_count(path->nodes[0], info, extent_count); - btrfs_mark_buffer_dirty(trans, path->nodes[0]); btrfs_release_path(path); if (!(flags & BTRFS_FREE_SPACE_USING_BITMAPS) && From patchwork Wed Dec 18 17:06:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913967 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 126B51F9431 for ; Wed, 18 Dec 2024 17:06:54 +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=1734541615; cv=none; b=J2oTDm49HY6Q6A3wil4uxQAKr95TMwWpfvDxyTv+Gt4xbEnHM/On4lvMNAeA+6VJJBQpRxrJX8PzC2stUWbCD5Pqt9FVcoAOiNRtYyiR6BDHjRysS0+d0phbXgAd0K8xFIkZzOBPKUyUcObcWjDZyjfXWkPrHKlyLfNy8Zd+FOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541615; c=relaxed/simple; bh=Rukjv3M03rmzKqL8fNWdJ3XVf4IjTqjdDemasCPtgjs=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=M5sRUemYp289Y9sQd7ZyHn6RnKzRWAOJBGawZxbZZldfg6yDSDbFYAhYP23v/cHfXRgHjUNTznQiSODAfQ1Cqq0VZYFm88S9KzfVSx5IaG5hFcU4NYh5emhtGzhznDCt0RMxOVXnR3IPbrgWVqsD+M/ElKigakXRZnyKTsiHfxI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=l9ybb2M+; 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="l9ybb2M+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EA7BC4CEDD for ; Wed, 18 Dec 2024 17:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541614; bh=Rukjv3M03rmzKqL8fNWdJ3XVf4IjTqjdDemasCPtgjs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=l9ybb2M+pIFQ2/BGg+r/Ixw7XwYfLACbrIHOSSSxsC+b/Zjc3+CIMiNbCVIdUz8qZ wI8McWLWQS2Q76MA9Q4jMeU+RuoePxctTb5WDXoaSb2I8JDbSTuqqkEMvXap5w5SjG lWc0jEBnTsUHLaVY5TGeMFIZW4W/x8Y2WuDuz6Cq/oLk0Ln9Aeh2BWyeim0VEElXWc 4IHqQ7sO068tJuGm95//eKj/zONGS0IUWB29n2FrebynyiLZixq32OT0iHqVk1n1x5 RmtzniAREibIvLsNalIJJ5wKdFHH2Zv5qFwojgaqW6BKGJmLTuRlOHxv02PQ2feaCL RZv15mZkWdy1w== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 03/20] btrfs: extent-tree: remove unnecessary calls to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:30 +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 We have several places explicitly calling btrfs_mark_buffer_dirty() but that is not necessarily since the target leaf came from a path that was obtained for a btree search function that modifies the btree, something like btrfs_insert_empty_item() or anything else that ends up calling btrfs_search_slot() with a value of 1 for its 'cow' argument. These just make the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove them. Signed-off-by: Filipe Manana --- fs/btrfs/extent-tree.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index e849fc34d8d9..14889b62ef59 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -570,7 +570,6 @@ static noinline int insert_extent_data_ref(struct btrfs_trans_handle *trans, btrfs_set_extent_data_ref_count(leaf, ref, num_refs); } } - btrfs_mark_buffer_dirty(trans, leaf); ret = 0; fail: btrfs_release_path(path); @@ -618,7 +617,6 @@ static noinline int remove_extent_data_ref(struct btrfs_trans_handle *trans, btrfs_set_extent_data_ref_count(leaf, ref1, num_refs); else if (key.type == BTRFS_SHARED_DATA_REF_KEY) btrfs_set_shared_data_ref_count(leaf, ref2, num_refs); - btrfs_mark_buffer_dirty(trans, leaf); } return ret; } @@ -1050,7 +1048,6 @@ void setup_inline_extent_backref(struct btrfs_trans_handle *trans, } else { btrfs_set_extent_inline_ref_offset(leaf, iref, root_objectid); } - btrfs_mark_buffer_dirty(trans, leaf); } static int lookup_extent_backref(struct btrfs_trans_handle *trans, @@ -1195,7 +1192,6 @@ static noinline_for_stack int update_inline_extent_backref( item_size -= size; btrfs_truncate_item(trans, path, item_size, 1); } - btrfs_mark_buffer_dirty(trans, leaf); return 0; } @@ -1527,7 +1523,6 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, if (extent_op) __run_delayed_extent_op(extent_op, leaf, item); - btrfs_mark_buffer_dirty(trans, leaf); btrfs_release_path(path); /* now insert the actual backref */ @@ -1711,8 +1706,6 @@ static int run_delayed_extent_op(struct btrfs_trans_handle *trans, ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); __run_delayed_extent_op(extent_op, leaf, ei); - - btrfs_mark_buffer_dirty(trans, leaf); out: btrfs_free_path(path); return ret; @@ -3268,7 +3261,6 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans, } } else { btrfs_set_extent_refs(leaf, ei, refs); - btrfs_mark_buffer_dirty(trans, leaf); } if (found_extent) { ret = remove_extent_backref(trans, extent_root, path, @@ -4836,7 +4828,6 @@ static int alloc_reserved_file_extent(struct btrfs_trans_handle *trans, btrfs_set_extent_data_ref_count(leaf, ref, ref_mod); } - btrfs_mark_buffer_dirty(trans, path->nodes[0]); btrfs_free_path(path); return alloc_reserved_extent(trans, ins->objectid, ins->offset); @@ -4911,7 +4902,6 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans, btrfs_set_extent_inline_ref_offset(leaf, iref, node->ref_root); } - btrfs_mark_buffer_dirty(trans, leaf); btrfs_free_path(path); return alloc_reserved_extent(trans, node->bytenr, fs_info->nodesize); From patchwork Wed Dec 18 17:06:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913968 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 1224F1F9A81 for ; Wed, 18 Dec 2024 17:06:55 +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=1734541616; cv=none; b=inWrQZNbAdVzDIyaiCzsjcQ1Eyc9PKxgNDi3/CU9LT0vA7xPJC+N1yypaWYcOMiES6T/ZxyySnfoEYp23PW3W0ewbfsoqvTVFFLbCKMun7uDhYYxKAM6JZMqUyHEI8AwTsRDHzLldtXLBWlzu9k/zhoOq0vJQjmCjA6fWEQlMbk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541616; c=relaxed/simple; bh=wTIXOAz/PmF8IOV+o/w1YajjrFqWLNaFZjO2r1ZAm/w=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SVktkzUXcQptcwrqS6COjkJgFxSH8JmiQ8ucibKJp/++Xomy92yWL2hdA5N1qOIc4nMQKQlOTELBEtc5TLgapVQlUR9n0O+v8MUo4TsqQsekWoHzO46+I86OQfz1yuDcG9GI/it/elTyI1GBLA5DDf4VqZodRyfcxb+jhoNQTH4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M0Ex0yKr; 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="M0Ex0yKr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FE3CC4CECD for ; Wed, 18 Dec 2024 17:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541615; bh=wTIXOAz/PmF8IOV+o/w1YajjrFqWLNaFZjO2r1ZAm/w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=M0Ex0yKrJxWf5b7JU7litZMVprIv18yWxkLoNizSRhxAZyNlGTHCfFrLHyNt+iTP9 uZXcUqQ/cnJ/z6IC7QZpkundUTBQg/a3P2tKuCQd0ncsqXmc7k8vTDjIOjqfDjV6pz P/R7DpSiCMsog3mN5dIFh6p6IKCTkh92Tloz+7x7Nrk6n3u9HCfsY2qGSgWvhOMP1w j4ySBpRkl7+m8sPXXG7Q4ZOPETziI1MQxn58I/2I5ky/xhGt+4JiP+x0AeephuwS25 38FE3qU7ZrbOtxBQRecL2jDIxlQYhK2ESAgYRCdr0BP0dtOP3/d1CsiYmCZnG2Indv y6PaMcl+CdPcA== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 04/20] btrfs: block-group: remove unnecessary calls to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:31 +0000 Message-Id: <0bdee9a4eb6960c61544334ffe292cb544a0bfa3.1734527445.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 have several places explicitly calling btrfs_mark_buffer_dirty() but that is not necessarily since the target leaf came from a path that was obtained for a btree search function that modifies the btree, something like btrfs_insert_empty_item() or anything else that ends up calling btrfs_search_slot() with a value of 1 for its 'cow' argument. These just make the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove them. Signed-off-by: Filipe Manana --- fs/btrfs/block-group.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index 5be029734cfa..8f91aa431074 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -2670,7 +2670,6 @@ static int insert_dev_extent(struct btrfs_trans_handle *trans, btrfs_set_dev_extent_chunk_offset(leaf, extent, chunk_offset); btrfs_set_dev_extent_length(leaf, extent, num_bytes); - btrfs_mark_buffer_dirty(trans, leaf); out: btrfs_free_path(path); return ret; @@ -3120,7 +3119,6 @@ static int update_block_group_item(struct btrfs_trans_handle *trans, cache->global_root_id); btrfs_set_stack_block_group_flags(&bgi, cache->flags); write_extent_buffer(leaf, &bgi, bi, sizeof(bgi)); - btrfs_mark_buffer_dirty(trans, leaf); fail: btrfs_release_path(path); /* From patchwork Wed Dec 18 17:06:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913969 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 C9A7E1F9F7D for ; Wed, 18 Dec 2024 17:06:56 +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=1734541616; cv=none; b=AYugoMvyz+s3ZLVwMGHjjBGod6HGfRocs+tefvrsqm7putZPnkpGVavJSWbcoTRxEEdYvw9ADMsLNNqNcHHev5aFulPanL6IDMR/K48ilGIBMd03ywXoB828ZXw44ARybTNS4qVZ+gUE5Dqb2pwhc9bBd/EItnAng1s8Zn/QxJw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541616; c=relaxed/simple; bh=5qm1uafcb4QTszeBGB306Iw56fpUr50UE+IuGt29ixs=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=B8MywB0s3iZrR/z319pECxdRo40csM6qjDOBOvhZFmrIo+L5GWjDidv7dVC9LCI484+49XQIibDQddaLzZY1+egjalW5GYydOg9xMg2ix1VvKZmjjwQKmnU2fkeIT+81q+5E4VRTCi9EEt/kvceUhb3CP6l8+I0eEv/pwJrbBbs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SiX8zQYe; 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="SiX8zQYe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2365FC4CEDD for ; Wed, 18 Dec 2024 17:06:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541616; bh=5qm1uafcb4QTszeBGB306Iw56fpUr50UE+IuGt29ixs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SiX8zQYeAiO7fMaiVLwl/D1gE0XJl8dIEuRybhfywcdvNWjGAVZ+AXElANZbR1aE8 J07jGsqqJTCEWsfdBZEaNicPaVkD8XyD3htyNnwuUIE5jCe7LNXpevI3gy/bWvtAMB 09jY0YzJ514abD6K7fXoVAywyZCCkttg7O/0TNfNQqcBmwNhrg6Jm3LhoQnewffmQH l0N48wrHssdazUL8/NqrIwCPkASdjz/vl9BybbyHwXeCxZoReXG3CqhbsSwn78MUVj r714U0RQEZ8mYBNAL2j8xBCBlcLQVeN7hTo+KCmXLXVJW28q+GcRnT/PZ2ybFoKwoN bbuzTKkHAh12A== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 05/20] btrfs: delayed-inode: remove unnecessary call to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:32 +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 call to btrfs_mark_buffer_dirty() at __btrfs_update_delayed_inode() is not necessary as we have a path setup for writing with btrfs_search_slot() having a 'cow' argument set to 1. This just makes the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove it. Signed-off-by: Filipe Manana --- fs/btrfs/delayed-inode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c index 508bdbae29a0..02c1efd53904 100644 --- a/fs/btrfs/delayed-inode.c +++ b/fs/btrfs/delayed-inode.c @@ -1038,7 +1038,6 @@ static int __btrfs_update_delayed_inode(struct btrfs_trans_handle *trans, struct btrfs_inode_item); write_extent_buffer(leaf, &node->inode_item, (unsigned long)inode_item, sizeof(struct btrfs_inode_item)); - btrfs_mark_buffer_dirty(trans, leaf); if (!test_bit(BTRFS_DELAYED_NODE_DEL_IREF, &node->flags)) goto out; From patchwork Wed Dec 18 17:06:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913970 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 13FCA1F9F7D for ; Wed, 18 Dec 2024 17:06:57 +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=1734541618; cv=none; b=D6tuvfaRORNlH0J9wzBb933XIGHerTvqFcGp8IUDnGYMf8nhhmtzf0yyEnDyDRmwqmQhAuhsR9s9vaCt6S7rOs+592O4JKqlydMlPUK3/cNqIDdLFGYjKlwxX/T9NubqKqr9yNfdmhO25dMOsnE5qpkqMjbiwJ5MweAztCJj/Y0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541618; c=relaxed/simple; bh=dWM7V7jtLdxXXJP97eBznDIXUEen+vuhYU1RObHSTcQ=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TwAW/WXch4xLs86TCC//5NXT1EgdMhWRc6XPBFG+Owd5IgzBnCo+MSmUA+PsaG5YOa4exj1YmJN8vo0GOhygDw2fuSPWaSDMv9h85sqetH84XU6YNvpsb63u4b/C1J6roDefSoEO4DUkuiK71fOY8rkwgaP0+NY4tScdBz/egF0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ViQ+cM7L; 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="ViQ+cM7L" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 274D6C4CED0 for ; Wed, 18 Dec 2024 17:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541617; bh=dWM7V7jtLdxXXJP97eBznDIXUEen+vuhYU1RObHSTcQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ViQ+cM7LpT8RbM0oD59pv+Jf3HBbNOmwl0qFHJor5v8d1D6OxvWL8wSLbrinxL/Bd jJQL6ky+mQ+INOZkIsfCWHap9FSk/FhtJyyxlxnByNGxO82WiGPiQKAZyVV2tLbsnu 5z+Bz5ibtk54TbssKZVRTigi9+y4cDytUiiKsxkxTTgS9fV1xCv42YG01nJ69TEtIp IKmcV0HU2tCO/gRZQ2AZRsoVJvnJ4z8WidpdEnB5ITweYHchwuK2+7eaXnlnwHN0Vr 17NCOrJJ253MxaRMDzNWk4g5EC/cU0CAm8oxQNYaVrFdgSF+yBKoHyY2OyUEgsnyM2 5bOQzzmIo0QYA== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 06/20] btrfs: dev-replace: remove unnecessary call to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:33 +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 call to btrfs_mark_buffer_dirty() at btrfs_run_dev_replace() is not necessary as we have a path setup for writing with btrfs_search_slot() having a 'cow' argument set to 1. This just makes the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove it. Signed-off-by: Filipe Manana --- fs/btrfs/dev-replace.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index ac8e97ed13f7..f86fbea0b3de 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -440,9 +440,6 @@ int btrfs_run_dev_replace(struct btrfs_trans_handle *trans) dev_replace->cursor_right); dev_replace->item_needs_writeback = 0; up_write(&dev_replace->rwsem); - - btrfs_mark_buffer_dirty(trans, eb); - out: btrfs_free_path(path); From patchwork Wed Dec 18 17:06:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913971 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 20D481FA260 for ; Wed, 18 Dec 2024 17:06:58 +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=1734541619; cv=none; b=DT9mPx2mBDXB8gzpTEa0DeZB1+ICf2wP3kHe+ifpfESZgjT3GJDQx24W4ZvFxxASfoTqwdFqu6vfFUfyuqpdTmLeh938xDGTKaQ65hMKS9VIRzyTZpYyFKujHxMOgwrE+Dw4M8Xnol1bP30Jk4IXrp8NabvG0YrKIqsN1KwaBI8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541619; c=relaxed/simple; bh=H2ZUU/RCYzpgXPp/8p/oMRJEV3l0TrGevFLRylCyDYA=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eH7zZQfWJQjjUNF1zpIKyV83cn1JLfpSMB6fDpLMJ0eJI/kX+thTa3yEQpSOemjVynJhkOsOK3xAqDJlAqsDJULsjGt4OC3Rzyg1XTRcZwiPtbes5VI9W4IYkhEwEUsabU+ysF6b32mN9Coc2ejYzCuedURHBhpO3V2IvDtsZw0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JOZ7pxSS; 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="JOZ7pxSS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BB66C4CECD for ; Wed, 18 Dec 2024 17:06:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541618; bh=H2ZUU/RCYzpgXPp/8p/oMRJEV3l0TrGevFLRylCyDYA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JOZ7pxSSwZrmyv0YwvwKl+QBh3NFX7YoB5YP20TBHjQZSlkBmV01GPzionNF2BA3a 4Y20eKdS99Y1j49jjuSHwMBRNiUe68oeoEmOtX8G1q8tBlwYUtMobfrMractK/q/Go DiiG0OK9lv+YY5sxFvx+Y5TOARyM1jBLJC3YdSSSMQ2C9dfsJNEMjrT5ZsPYZK/wyS PDnhE/gSkyrxyZySQmRNqfOios/VH6te46M+i0ahsP/4jtPlUpWyhkmlP/HlJz+xuJ w7RLaWfmOeRY5NURCqoaR7iMbeHEdQROk1YV/hDE4v0NMwlrxshsNLOE5zMC57cmS1 F03WjGfjjpumQ== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 07/20] btrfs: dir-item: remove unnecessary calls to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:34 +0000 Message-Id: <3833be2656cb7f08c0881050f9345251f112a23c.1734527445.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 have several places explicitly calling btrfs_mark_buffer_dirty() but that is not necessarily since the target leaf came from a path that was obtained for a btree search function that modifies the btree, something like btrfs_insert_empty_item() or anything else that ends up calling btrfs_search_slot() with a value of 1 for its 'cow' argument. These just make the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove them. Signed-off-by: Filipe Manana --- fs/btrfs/dir-item.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c index 1ea5d8fcfbf7..ccf91de29f80 100644 --- a/fs/btrfs/dir-item.c +++ b/fs/btrfs/dir-item.c @@ -92,7 +92,6 @@ int btrfs_insert_xattr_item(struct btrfs_trans_handle *trans, write_extent_buffer(leaf, name, name_ptr, name_len); write_extent_buffer(leaf, data, data_ptr, data_len); - btrfs_mark_buffer_dirty(trans, path->nodes[0]); return ret; } @@ -152,7 +151,6 @@ int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, name_ptr = (unsigned long)(dir_item + 1); write_extent_buffer(leaf, name->name, name_ptr, name->len); - btrfs_mark_buffer_dirty(trans, leaf); second_insert: /* FIXME, use some real flag for selecting the extra index */ From patchwork Wed Dec 18 17:06:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913972 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 2657E1FA831 for ; Wed, 18 Dec 2024 17:06:59 +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=1734541620; cv=none; b=hTXuuGv/nQIhsLg9/Y8DmSPHJ9ZYSwAahrpldGxAidieIOrmxN2yRgxMJpUcDfyxl7ayMes1yBPEtMgPZmVc3vvO6TsSIgUa//nmGaoM3+hxUoj6eI96R5ULTIa8uMJ+Ru+mXqhZTmYoxKNyIaENTCM5dicUFznYS+WGgQUGZRE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541620; c=relaxed/simple; bh=hO3/lCVsOMYZaWkyEkvySjGZGa44wyQLwuC6FyXho7s=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZXwE/6RS/6o7z6rD6BxlDwxoEuEaft+eq1On93vU1dV0PwZing+WC9SlZ7vectcqOuW+7VEbaNljZRIIs2ahaRp2PeKUApXpF3whlm/Z3+HmnKugkGvaRokdPe0XuKnDN7Dylo2h2aGCmjvnfpMO2c9dGx+y7eENsNil8xcLqXI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Vo5AOnpJ; 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="Vo5AOnpJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FB6CC4CED7 for ; Wed, 18 Dec 2024 17:06:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541619; bh=hO3/lCVsOMYZaWkyEkvySjGZGa44wyQLwuC6FyXho7s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Vo5AOnpJIM4Q3JZ23mPEUpYC5VIvCooIkFHJFLUesu4MUoDBj8FAZOYZi/zHoxdye FruEseXiKUTRtpnLdMOzkg2lm174evcEM1L95jDzafkRPFpDGUf0XvdtAAX+59sysE OZJvdNh2phcf2gtIIPqSQ8VetenX6a00rOg4flLvrvgJIm9lLnaPOtF76I3LTOHXKB NM8RMFRZOJvWLV5Eqe88rHty31Ptov3OpciQdFTAiWyc78ic1EPGN/AYzpY8hr3ilS NsuknamMODSAFB9dYq103lgOdvYNXkkpr0M6dgJImclbeSlJlKGny6VGPunKG65+wB IpQFoYXbLgJ7Q== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 08/20] btrfs: file: remove unnecessary calls to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:35 +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 We have several places explicitly calling btrfs_mark_buffer_dirty() but that is not necessarily since the target leaf came from a path that was obtained for a btree search function that modifies the btree, something like btrfs_insert_empty_item() or anything else that ends up calling btrfs_search_slot() with a value of 1 for its 'cow' argument. These just make the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove them. Signed-off-by: Filipe Manana --- fs/btrfs/file.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 4775a17c4ee1..36f51c311bb1 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -314,7 +314,6 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, btrfs_set_file_extent_offset(leaf, fi, extent_offset); btrfs_set_file_extent_num_bytes(leaf, fi, extent_end - args->start); - btrfs_mark_buffer_dirty(trans, leaf); if (update_refs && disk_bytenr > 0) { struct btrfs_ref ref = { @@ -360,7 +359,6 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, btrfs_set_file_extent_offset(leaf, fi, extent_offset); btrfs_set_file_extent_num_bytes(leaf, fi, extent_end - args->end); - btrfs_mark_buffer_dirty(trans, leaf); if (update_refs && disk_bytenr > 0) args->bytes_found += args->end - key.offset; break; @@ -384,7 +382,6 @@ int btrfs_drop_extents(struct btrfs_trans_handle *trans, btrfs_set_file_extent_num_bytes(leaf, fi, args->start - key.offset); - btrfs_mark_buffer_dirty(trans, leaf); if (update_refs && disk_bytenr > 0) args->bytes_found += extent_end - args->start; if (args->end == extent_end) @@ -639,7 +636,6 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, trans->transid); btrfs_set_file_extent_num_bytes(leaf, fi, end - other_start); - btrfs_mark_buffer_dirty(trans, leaf); goto out; } } @@ -668,7 +664,6 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, other_end - start); btrfs_set_file_extent_offset(leaf, fi, start - orig_offset); - btrfs_mark_buffer_dirty(trans, leaf); goto out; } } @@ -702,7 +697,6 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, btrfs_set_file_extent_offset(leaf, fi, split - orig_offset); btrfs_set_file_extent_num_bytes(leaf, fi, extent_end - split); - btrfs_mark_buffer_dirty(trans, leaf); ref.action = BTRFS_ADD_DELAYED_REF; ref.bytenr = bytenr; @@ -781,7 +775,6 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, btrfs_set_file_extent_type(leaf, fi, BTRFS_FILE_EXTENT_REG); btrfs_set_file_extent_generation(leaf, fi, trans->transid); - btrfs_mark_buffer_dirty(trans, leaf); } else { fi = btrfs_item_ptr(leaf, del_slot - 1, struct btrfs_file_extent_item); @@ -790,7 +783,6 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans, btrfs_set_file_extent_generation(leaf, fi, trans->transid); btrfs_set_file_extent_num_bytes(leaf, fi, extent_end - key.offset); - btrfs_mark_buffer_dirty(trans, leaf); ret = btrfs_del_items(trans, root, path, del_slot, del_nr); if (ret < 0) { @@ -2016,7 +2008,6 @@ static int fill_holes(struct btrfs_trans_handle *trans, btrfs_set_file_extent_ram_bytes(leaf, fi, num_bytes); btrfs_set_file_extent_offset(leaf, fi, 0); btrfs_set_file_extent_generation(leaf, fi, trans->transid); - btrfs_mark_buffer_dirty(trans, leaf); goto out; } @@ -2033,7 +2024,6 @@ static int fill_holes(struct btrfs_trans_handle *trans, btrfs_set_file_extent_ram_bytes(leaf, fi, num_bytes); btrfs_set_file_extent_offset(leaf, fi, 0); btrfs_set_file_extent_generation(leaf, fi, trans->transid); - btrfs_mark_buffer_dirty(trans, leaf); goto out; } btrfs_release_path(path); @@ -2181,7 +2171,6 @@ static int btrfs_insert_replace_extent(struct btrfs_trans_handle *trans, btrfs_set_file_extent_num_bytes(leaf, extent, replace_len); if (extent_info->is_new_extent) btrfs_set_file_extent_generation(leaf, extent, trans->transid); - btrfs_mark_buffer_dirty(trans, leaf); btrfs_release_path(path); ret = btrfs_inode_set_file_extent_range(inode, extent_info->file_offset, From patchwork Wed Dec 18 17:06:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913973 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 D5BDF1FA8D6 for ; Wed, 18 Dec 2024 17:07:00 +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=1734541620; cv=none; b=Q2PgQFLHqfwfrIG/oqwMbDlKV1QePsqIXpViiMhe1e5fksv4cPOZQ3+c/39beqh2JZ2bI7dcqZq2LZCctfuqWFlxSiuTdXJbZNcf/qEagYZJf4BFZE4xStvSXtEOoYCPya+cWFl9O5UkPDBdelkOkf5KM1BvhQu1gMLG4QeF3qQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541620; c=relaxed/simple; bh=G2Yf43vIG9olS0cGs5gb4tZAw/qH/tXvSip0GfUBG5c=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LAdWh+sxvFBXYQZ1MbOVqA+pvJdgjFKt39DGRO6gpxD/WW3w/SbaNJkcwMqunGVyLllA+LBGhC5aJNSgVqIoVYK2xZ67xbyFPoci+ZAYAML8HGTGilm1kWZBWtZszq0WUpQA/10WKK6j2FM/0Ork5uAAU6nRLSmxjyt8mvZGbbs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fgP9PRwz; 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="fgP9PRwz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34E7AC4CED0 for ; Wed, 18 Dec 2024 17:07:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541620; bh=G2Yf43vIG9olS0cGs5gb4tZAw/qH/tXvSip0GfUBG5c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fgP9PRwzK140foI1WEr9OOsG2WQbpH1zjyKdmVIc1pPfQMTQsKzXPSy/0RV6IEjNq 8YC9WU04UKmQL9oHCoOPLArkNJlJf9EQzJp19XMmlPhaXL31MluIpMBZub6QSHcL8f /tGlMSpiZxzaQ1FcVEw1NzID5aVPXh/TdnPa7C1yaGxeV2UPOpFIxxxWNHMRgBKTok TrEytWC4Wf9HDGSAtycIruyxPHw/VUsjuD1imWhHZjg1uLB+Dx2y/28g0t8tryV/Ar 9qNIpRlNNvtIYBbPb3Yo+X0EHrXmk6Z+D0mr8yfXmUcmO5MlLfUxz4BvOpyKNdTUMG 0i/LlcLBPLrsw== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 09/20] btrfs: file-item: remove unnecessary calls to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:36 +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 We have several places explicitly calling btrfs_mark_buffer_dirty() but that is not necessarily since the target leaf came from a path that was obtained for a btree search function that modifies the btree, something like btrfs_insert_empty_item() or anything else that ends up calling btrfs_search_slot() with a value of 1 for its 'cow' argument. These just make the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove them. Signed-off-by: Filipe Manana --- fs/btrfs/file-item.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 886749b39672..d04a3b47b1fb 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c @@ -190,8 +190,6 @@ int btrfs_insert_hole_extent(struct btrfs_trans_handle *trans, btrfs_set_file_extent_compression(leaf, item, 0); btrfs_set_file_extent_encryption(leaf, item, 0); btrfs_set_file_extent_other_encoding(leaf, item, 0); - - btrfs_mark_buffer_dirty(trans, leaf); out: btrfs_free_path(path); return ret; @@ -1259,7 +1257,6 @@ int btrfs_csum_file_blocks(struct btrfs_trans_handle *trans, ins_size /= csum_size; total_bytes += ins_size * fs_info->sectorsize; - btrfs_mark_buffer_dirty(trans, path->nodes[0]); if (total_bytes < sums->len) { btrfs_release_path(path); cond_resched(); From patchwork Wed Dec 18 17:06:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913974 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 EB9591FA8E9 for ; Wed, 18 Dec 2024 17:07:01 +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=1734541622; cv=none; b=sxJxFki/egazcqsQ8zh34wcUwk+tCOc0QVaO5AkyDgUMnjl6p6nFXIn4bXf2zBc57ILX6/3+Hvkd3i4MTJXSAIj7F1zaaJuMI2Kk4qnO4yzGHbs3weyj706dO432YczDB3G9y9d7XeulXgficQDACkqGzbdlK9rxyvETjg0SEJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541622; c=relaxed/simple; bh=B1mEI4d9psrXdXGp8ojuBIO56aqevJE/gb4atkoF/rU=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SNQL6J9GMOEsFPXnFJad8VOCnopmGPy5ivj+JJ1Of7o4xI5mvO/Lyhoj0tIqS5wnOWD9D8Z7yWLgSR4Nj2fj7q4COEDEGso+3ueqClaVdUm2++uJIfsPa9r70Ecl4bYiSFhP5gDymngGel9bCPp+GQyHSbrX9MjmL/u28CN1CLE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ntf5hoSJ; 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="ntf5hoSJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39DABC4CECD for ; Wed, 18 Dec 2024 17:07:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541621; bh=B1mEI4d9psrXdXGp8ojuBIO56aqevJE/gb4atkoF/rU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ntf5hoSJxxX1kLOQScBwew6l3ot0/wuWI4fZ2fCUD8F/gSghnZFRO3ROS8SJGO/ej G0H50lRVi+BpMqDBb5ZwAx4B/sN91BLMR2vj6w8DmPCdgtM/z7ljO1LOomr8mSUphg xa/s0q+nqBFwvLsQKcc6o0dLA5Gp0b5QknVgVSPNdjATU69Iv+5BMP25Ush5hGvPmY 4JWR+WVrAPeMIrDTgP6Dz9k9zCO7dINafae5YsRITsFf5zXrz249OqZSXlvsmnMUu1 33GOb8oVx8ermWeKfK7WQQ4UdFQcBDGoGpW5k+TBmd+8+kuGjw1YxH+Bt6Iwwm130k Vaz+lcCJmSgDg== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 10/20] btrfs: free-space-cache: remove unnecessary calls to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:37 +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 We have several places explicitly calling btrfs_mark_buffer_dirty() but that is not necessarily since the target leaf came from a path that was obtained for a btree search function that modifies the btree, something like btrfs_insert_empty_item() or anything else that ends up calling btrfs_search_slot() with a value of 1 for its 'cow' argument. These just make the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove them. Signed-off-by: Filipe Manana --- fs/btrfs/free-space-cache.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 17707c898eae..3048cb38dc80 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c @@ -198,7 +198,6 @@ static int __create_free_space_inode(struct btrfs_root *root, btrfs_set_inode_nlink(leaf, inode_item, 1); btrfs_set_inode_transid(leaf, inode_item, trans->transid); btrfs_set_inode_block_group(leaf, inode_item, offset); - btrfs_mark_buffer_dirty(trans, leaf); btrfs_release_path(path); key.objectid = BTRFS_FREE_SPACE_OBJECTID; @@ -216,7 +215,6 @@ static int __create_free_space_inode(struct btrfs_root *root, struct btrfs_free_space_header); memzero_extent_buffer(leaf, (unsigned long)header, sizeof(*header)); btrfs_set_free_space_key(leaf, header, &disk_key); - btrfs_mark_buffer_dirty(trans, leaf); btrfs_release_path(path); return 0; @@ -1189,7 +1187,6 @@ update_cache_item(struct btrfs_trans_handle *trans, btrfs_set_free_space_entries(leaf, header, entries); btrfs_set_free_space_bitmaps(leaf, header, bitmaps); btrfs_set_free_space_generation(leaf, header, trans->transid); - btrfs_mark_buffer_dirty(trans, leaf); btrfs_release_path(path); return 0; From patchwork Wed Dec 18 17:06:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913975 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 E4A701FA8F9 for ; Wed, 18 Dec 2024 17:07: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=1734541623; cv=none; b=l4PkS01csoaI8AxUt82gNZ4IZB3twRgA1AlYKrrMHldO2MXml/wJoD8mWkxhXyBFWe/nnwjuvXKX0b9J/BLBR/bcX1fySeikdBxzZIhNvNiGwG46tGDLDHnuXA65h8keyFJG0alJmqawgb2bYXbG1crJ13XOJezlL5eGZkU6t5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541623; c=relaxed/simple; bh=7geP1RmZK0P6k/1W9BT/0jpieO5k9sruie7dVTuCf6A=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LGmuPFfvuD/dCioSzefdRq9z/FXIFVCvIWs1GJM9G6TvUKDiyUWiOmejmKu/Baiae8w2nV6qvP7eHVdZuXmylpoFHflMMUeeXr0eWLtHrS5F7ucAmtA5VG5TF5jdJ8QGsxOjIOB7IhWh7ER4xw/FxlXtqV5B+t04rhOFwEUdbuY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=F3VNyukZ; 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="F3VNyukZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DC0DC4CECD for ; Wed, 18 Dec 2024 17:07:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541622; bh=7geP1RmZK0P6k/1W9BT/0jpieO5k9sruie7dVTuCf6A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=F3VNyukZLGecGER1D1Tkq5BxmMtbIPIPRpIyS/xoeQnPCuFcsUpfhCNnxJ83fdAFf R8qvhmHRgwPOoAcYpIto+V659Zb8m4bKDC4Cy7Sl1Yl4z/liFZ4hgqlc+8eaznH6Ts truZZCmYUkZbj0d1p3NrNvriXeQjVYxlddJU2Vnw9Yb9R0r/b8P8PK4MlAo47D8DVY vnGmjoR4LNooYM1+SQLjdJuDHcwfg1HTzNk/uobXXirUcFU538PQQGT7suNVc/kgjW YG/0MiaVW02DYEbJbQSC/mzhVGLrfBNRZoHhBXAWi3ljyi9nsp7Maay6ofwkHckNfy JY66jLxIttGSg== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 11/20] btrfs: inode: remove unnecessary calls to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:38 +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 We have several places explicitly calling btrfs_mark_buffer_dirty() but that is not necessarily since the target leaf came from a path that was obtained for a btree search function that modifies the btree, something like btrfs_insert_empty_item() or anything else that ends up calling btrfs_search_slot() with a value of 1 for its 'cow' argument. These just make the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove them. Signed-off-by: Filipe Manana --- fs/btrfs/inode.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8a173a24ac05..052ed957f65a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -564,7 +564,6 @@ static int insert_inline_extent(struct btrfs_trans_handle *trans, kunmap_local(kaddr); folio_put(folio); } - btrfs_mark_buffer_dirty(trans, leaf); btrfs_release_path(path); /* @@ -2918,7 +2917,6 @@ static int insert_reserved_file_extent(struct btrfs_trans_handle *trans, btrfs_item_ptr_offset(leaf, path->slots[0]), sizeof(struct btrfs_file_extent_item)); - btrfs_mark_buffer_dirty(trans, leaf); btrfs_release_path(path); /* @@ -4082,7 +4080,6 @@ static noinline int btrfs_update_inode_item(struct btrfs_trans_handle *trans, struct btrfs_inode_item); fill_inode_item(trans, leaf, inode_item, &inode->vfs_inode); - btrfs_mark_buffer_dirty(trans, leaf); btrfs_set_inode_last_trans(trans, inode); ret = 0; failed: @@ -6377,7 +6374,6 @@ int btrfs_create_new_inode(struct btrfs_trans_handle *trans, } } - btrfs_mark_buffer_dirty(trans, path->nodes[0]); /* * We don't need the path anymore, plus inheriting properties, adding * ACLs, security xattrs, orphan item or adding the link, will result in @@ -8649,7 +8645,6 @@ static int btrfs_symlink(struct mnt_idmap *idmap, struct inode *dir, ptr = btrfs_file_extent_inline_start(ei); write_extent_buffer(leaf, symname, ptr, name_len); - btrfs_mark_buffer_dirty(trans, leaf); btrfs_free_path(path); d_instantiate_new(dentry, inode); From patchwork Wed Dec 18 17:06:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913976 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 E10511FAC3B for ; Wed, 18 Dec 2024 17:07: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=1734541624; cv=none; b=m1gEvBKV652351BJ0O1l6B+ezxInHmug0y6pJNm0B+DzYTnRe84Nfkc1kUCj5eEjC3g46F7CcomLeqObpvBO1Z7ktIl88nfyX834AWtpIelP+RxxILmhgH+0xvPIZ0vDYJ6hea5UHn4Ap8wgMR2X3xd8oXZ3qCvp8QxTvohoSgk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541624; c=relaxed/simple; bh=1ldsaUaU0aBmFrIKv5tTaxtRnhhdUHQE9Pddq04DA0o=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sLaeiQ0CkqCL+Hc9D9aiGntOGf0JumLEYjzXyjVGGJ8yU9wquKqqmJncQssZAkxfpkWoVK3P5PPEpTG7dI6F0PKt0FuT3UwE8jW28WwIJgaxHLT0AI8aMtIMg3+PD6HaAp29TAIN8yCnSImjE0OXnDD6DtYsM0KtFWG3ayeN2wk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PsBrM1KX; 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="PsBrM1KX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41D9DC4CED0 for ; Wed, 18 Dec 2024 17:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541623; bh=1ldsaUaU0aBmFrIKv5tTaxtRnhhdUHQE9Pddq04DA0o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PsBrM1KXSYJ61mDcMl1apBySD9WZe2EU+Wads3ogOPl5a2ipYOMLIOBPPtjOmVtwE MxsWCv1zP10YY84+hTIcfSEuig8AoxVSdCI9h7NM+EwnQS0rboYwetbexZie8kZUP1 Pd5CX0KV2ItaFnQ2I+y7svgAYfmO0vKZxZy4YmQi6K/svKN7nzJke9p9QHzY8+74MU nxZEKOVJuHqk7bbAh6H57UwBAYeBYQesCE2f6fVCuGVxTSB3yZxqR1Q6/XyZSarjZI laUW0gSyb/HWtV2hEHGk0Q1xGhVMxXk4FUD+Wer+gawzo+B0s8ZD+09rmIY0SjTBXl 7Z8C7s/N7JcGA== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 12/20] btrfs: inode-item: remove unnecessary calls to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:39 +0000 Message-Id: <805b065b840df48c8b2e95c06f2851178d865e2b.1734527445.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 have several places explicitly calling btrfs_mark_buffer_dirty() but that is not necessarily since the target leaf came from a path that was obtained for a btree search function that modifies the btree, something like btrfs_insert_empty_item() or anything else that ends up calling btrfs_search_slot() with a value of 1 for its 'cow' argument. These just make the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove them. Signed-off-by: Filipe Manana --- fs/btrfs/inode-item.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c index 29572dfaf878..448aa1a682d6 100644 --- a/fs/btrfs/inode-item.c +++ b/fs/btrfs/inode-item.c @@ -298,8 +298,6 @@ static int btrfs_insert_inode_extref(struct btrfs_trans_handle *trans, ptr = (unsigned long)&extref->name; write_extent_buffer(path->nodes[0], name->name, ptr, name->len); - btrfs_mark_buffer_dirty(trans, path->nodes[0]); - out: btrfs_free_path(path); return ret; @@ -363,8 +361,6 @@ int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans, ptr = (unsigned long)(ref + 1); } write_extent_buffer(path->nodes[0], name->name, ptr, name->len); - btrfs_mark_buffer_dirty(trans, path->nodes[0]); - out: btrfs_free_path(path); @@ -590,7 +586,6 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, num_dec = (orig_num_bytes - extent_num_bytes); if (extent_start != 0) control->sub_bytes += num_dec; - btrfs_mark_buffer_dirty(trans, leaf); } else { extent_num_bytes = btrfs_file_extent_disk_num_bytes(leaf, fi); From patchwork Wed Dec 18 17:06:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913977 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 E42A21FAC4D for ; Wed, 18 Dec 2024 17:07:04 +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=1734541625; cv=none; b=DPT0cQETfEb/UM+jMgxnFTr2xluX/HRSg7kjqUIVgpR1Y1IffCk+TvBmwIrkwt72gxqsRFliCuf8qhNbR4FUmulY42Kvo9twD+YrWNhuThgu0E40IfnTTQZmvlpCgiAR/IyLmIKLVoqsLst5at6BiVk/DDzUkjn6587m356aVI0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541625; c=relaxed/simple; bh=F9GmDBc+7QDgPlyWu1aRV6eYPErmrWCjaYaOJXgMisQ=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WPs2rl0GuVphNJM3vNO+RHGcVafuLJKJtma31VJQU48sK5XBVp9HefCkyj7xeqsNl9JvwyhQ5DVdIm5IemXJu3t1QwgFHHKjeYMnDWLRfTvpn/Kog72jz8utqf2EANDy5KkxEDdHsUn5NOhGasmc37Hks3AbMQ2817LMkEOqX8A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VxBD7qeZ; 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="VxBD7qeZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44D0AC4CECD for ; Wed, 18 Dec 2024 17:07:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541624; bh=F9GmDBc+7QDgPlyWu1aRV6eYPErmrWCjaYaOJXgMisQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VxBD7qeZinOZ3k8NZwSd/Yb4SJukm2FNhPGbUBi7NG9anDsVNndk/Oi2TxAV1ojhC scaVgGiNFPcDxIzJ9xTiFR8Yx8DVQqV1hmqEvoiepfb578dixf0aVzs8hUiWJ4CFkU wfPCZoLvZoJXQv5RK7GK6OcBvkia/PMmZc0KSgNJR/wGdycWIfWkqOD4098SRyierp ilkhE0A5zPIF8iMn5KYjyA/0StCyoueeL3uaKCaf2+Mr+FQlmGDBsarQQ8f7JIWNLG kMvTI8z2F1njxXejOdAMyGMWaoZnx5HjqsOKh/LFcdUlhHQ7duDp7dfcg8nEK6fJxP qMK+z6TOgsyIg== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 13/20] btrfs: ioctl: remove unnecessary call to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:40 +0000 Message-Id: <631e83219099d38a4608511286d1d4d14b7812fd.1734527445.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 The call to btrfs_mark_buffer_dirty() at btrfs_ioctl_default_subvol() is not necessary as we have a path setup for writing with btrfs_search_slot() having a 'cow' argument set to 1. This just makes the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove it. Signed-off-by: Filipe Manana --- fs/btrfs/ioctl.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 7872de140489..0946dcb978e4 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2916,7 +2916,6 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp) btrfs_cpu_key_to_disk(&disk_key, &new_root->root_key); btrfs_set_dir_item_key(path->nodes[0], di, &disk_key); - btrfs_mark_buffer_dirty(trans, path->nodes[0]); btrfs_release_path(path); btrfs_set_fs_incompat(fs_info, DEFAULT_SUBVOL); From patchwork Wed Dec 18 17:06:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913978 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 441FE1FAC4D for ; Wed, 18 Dec 2024 17:07:05 +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=1734541626; cv=none; b=svZ+sVuqPpKJaWy7+c+j+SysKydclF62r/2lQf4icg4YIX5YFI5s8b3cSaf3b/CHZcii+J/3V2VPMN9DqRGnyBvbVmEZG1IobE+5FOnczchA6Dt1CrIaKBjNm4Di34Yk/YB0pPn0rWlk6mpJietJ3EiBK+1w3QhlcB1OcRF8S9E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541626; c=relaxed/simple; bh=jRvaotzJxwRPIdyOkRuyOELpjHMauo8ht482e1Qx97I=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=S1/OQYiZoAaEi5uyhxwvHMZQrCSod513ERtDNgrWyHAIJbAqaB+ohW6gX8JGycJhJm5HrtV7IcuGS26KHWGj0KQIAr+3BlK9Pmw3D20WPzuBwjE8T6auxjhUFYIjPeoPYESZ/YwA6lDTSHRblflVAwY+gYJkXv6+zWSyZQVj1a4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KI8YpkIn; 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="KI8YpkIn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46E48C4CED0 for ; Wed, 18 Dec 2024 17:07:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541625; bh=jRvaotzJxwRPIdyOkRuyOELpjHMauo8ht482e1Qx97I=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KI8YpkInDoUIpj+l2D7NbHrEgPTTi4Its3+fUPAcCktg5aJUkHP7q2sa0AsEhtgB0 wg9LitRKusrjv3SYVtR9JC2Gs5rPXfOpScBhB48vpXbmZG6s/DPelQ9lbVGIXpJK+V 04JU8CQpjHBwv0uA8dYBtmUcWNJvXiqiwzFl037j+n4kArp1eu7AitqwJvo28mpUcK WL7z9ncSbvqudyNFtf9iW82mBF/0FNTcfIOHaqLo5PaxCCkY7ChcUe6BCBUA7HFnQC AH02hrik9Q1NTRaYT/DFvAOK+4YB4e7/ESLFMlESLIB/boIArxbD7s94CgNn2RARS5 3ziGlbVMSaGPw== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 14/20] btrfs: qgroup: remove unnecessary calls to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:41 +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 We have several places explicitly calling btrfs_mark_buffer_dirty() but that is not necessarily since the target leaf came from a path that was obtained for a btree search function that modifies the btree, something like btrfs_insert_empty_item() or anything else that ends up calling btrfs_search_slot() with a value of 1 for its 'cow' argument. These just make the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove them. Signed-off-by: Filipe Manana --- fs/btrfs/qgroup.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 993b5e803699..b90fabe302e6 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -673,9 +673,6 @@ static int add_qgroup_relation_item(struct btrfs_trans_handle *trans, u64 src, key.offset = dst; ret = btrfs_insert_empty_item(trans, quota_root, path, &key, 0); - - btrfs_mark_buffer_dirty(trans, path->nodes[0]); - btrfs_free_path(path); return ret; } @@ -752,8 +749,6 @@ static int add_qgroup_item(struct btrfs_trans_handle *trans, btrfs_set_qgroup_info_excl(leaf, qgroup_info, 0); btrfs_set_qgroup_info_excl_cmpr(leaf, qgroup_info, 0); - btrfs_mark_buffer_dirty(trans, leaf); - btrfs_release_path(path); key.type = BTRFS_QGROUP_LIMIT_KEY; @@ -771,8 +766,6 @@ static int add_qgroup_item(struct btrfs_trans_handle *trans, btrfs_set_qgroup_limit_rsv_rfer(leaf, qgroup_limit, 0); btrfs_set_qgroup_limit_rsv_excl(leaf, qgroup_limit, 0); - btrfs_mark_buffer_dirty(trans, leaf); - ret = 0; out: btrfs_free_path(path); @@ -859,9 +852,6 @@ static int update_qgroup_limit_item(struct btrfs_trans_handle *trans, btrfs_set_qgroup_limit_max_excl(l, qgroup_limit, qgroup->max_excl); btrfs_set_qgroup_limit_rsv_rfer(l, qgroup_limit, qgroup->rsv_rfer); btrfs_set_qgroup_limit_rsv_excl(l, qgroup_limit, qgroup->rsv_excl); - - btrfs_mark_buffer_dirty(trans, l); - out: btrfs_free_path(path); return ret; @@ -905,9 +895,6 @@ static int update_qgroup_info_item(struct btrfs_trans_handle *trans, btrfs_set_qgroup_info_rfer_cmpr(l, qgroup_info, qgroup->rfer_cmpr); btrfs_set_qgroup_info_excl(l, qgroup_info, qgroup->excl); btrfs_set_qgroup_info_excl_cmpr(l, qgroup_info, qgroup->excl_cmpr); - - btrfs_mark_buffer_dirty(trans, l); - out: btrfs_free_path(path); return ret; @@ -947,9 +934,6 @@ static int update_qgroup_status_item(struct btrfs_trans_handle *trans) btrfs_set_qgroup_status_generation(l, ptr, trans->transid); btrfs_set_qgroup_status_rescan(l, ptr, fs_info->qgroup_rescan_progress.objectid); - - btrfs_mark_buffer_dirty(trans, l); - out: btrfs_free_path(path); return ret; @@ -1130,8 +1114,6 @@ int btrfs_quota_enable(struct btrfs_fs_info *fs_info, BTRFS_QGROUP_STATUS_FLAGS_MASK); btrfs_set_qgroup_status_rescan(leaf, ptr, 0); - btrfs_mark_buffer_dirty(trans, leaf); - key.objectid = 0; key.type = BTRFS_ROOT_REF_KEY; key.offset = 0; From patchwork Wed Dec 18 17:06:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913979 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 0337E1FBC94 for ; Wed, 18 Dec 2024 17:07:06 +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=1734541627; cv=none; b=JLoctL7Ha8d6j1JHgAb754LtK7eUmmaA3UQGOquJ+DVd2wSVh6PxdJQVRhXoyG7ktW/0JCx0Li5yKRdOL01wOKf3qXHBS5Zr11nFZQMUvbiLAAAq4nunpcn5X+0vt9BiXocgFqg8jND7x6dQ4k9C58PRe3BV0pN7S6dGdLtCQyk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541627; c=relaxed/simple; bh=DZQr1AA3c7qYor4LhCmgUYx78zwq8C4hDfmWym5aeuc=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=m8+VYPG42GjhPKnFOpnx2VYJZk4k3OJAzpKCLMXliTgnJhIjsst47//ud+kKxcQngMznBOKS7tSH7h6zp20yhCoAwQg9Bu9cNJ1Ng0SZrqE8zeTBxonPVwbDqoaHMjQgV2CJ1q6v33Yh5OoMeq74SvkC/ym0Qb8fHCPfSsT4SDs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PTHNod+2; 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="PTHNod+2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B169C4CECD for ; Wed, 18 Dec 2024 17:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541626; bh=DZQr1AA3c7qYor4LhCmgUYx78zwq8C4hDfmWym5aeuc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PTHNod+2UK7kx4yJUZiZxgvwUFg7pObiOxn4Tbu1Po5L7/15/gwv432Cu7Lk5bvvF v0vO7VdXDKA8rR58xDrmw1/qJ2PgzS0xGNkO/40ptcOfnFyc+brj42BwShOxVrQZhB wiul0zu1MbD0PAI5TV1hVAsUlkx7IIXrdpTtn4imLEtzDg7xDLuBMPDmq38LVbnfBF LiSVPXi6wwk4p4wY2NpUE00sZPgOtG7v2DSt6RiUgkqryBkCKozJ9Fd9vNKkQkS+26 BdMsQRDYwF7cHTJF0uLVe6klhOJrwdcE01Dhgo2fbpOegetgTesXeZjCpvT9+OzbMa +n2eSYg+/PL4Q== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 15/20] btrfs: raid-stripe-tree: remove unnecessary call to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:42 +0000 Message-Id: <391f3310c893ee95f6aeba758365e24d71b87302.1734527445.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 The call to btrfs_mark_buffer_dirty() at update_raid_extent_item() is not necessary as we have a path setup for writing with btrfs_search_slot() having a 'cow' argument set to 1. This just makes the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove it. Signed-off-by: Filipe Manana --- fs/btrfs/raid-stripe-tree.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/raid-stripe-tree.c b/fs/btrfs/raid-stripe-tree.c index 45b823a0913a..0bf3c032d9dc 100644 --- a/fs/btrfs/raid-stripe-tree.c +++ b/fs/btrfs/raid-stripe-tree.c @@ -169,7 +169,6 @@ static int update_raid_extent_item(struct btrfs_trans_handle *trans, write_extent_buffer(leaf, stripe_extent, btrfs_item_ptr_offset(leaf, slot), item_size); - btrfs_mark_buffer_dirty(trans, leaf); btrfs_free_path(path); return ret; From patchwork Wed Dec 18 17:06:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913980 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 F31681FBCB0 for ; Wed, 18 Dec 2024 17:07:07 +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=1734541628; cv=none; b=SwmmlZLaQ3h4vfJAC1FzIPoEhTw1HKzYaqQwBLCqezYHfGEIrr57X3iGXNDoNgkINJTo/lExXdh0LFu+wa6ceZks3oqDLiLACpneuzOSml9JFYSnvKwKg2ye8jCbehpStRSzjXk20OeuUgfLMcqg/Q3u6me1RVqgR14RCLxJIPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541628; c=relaxed/simple; bh=+/Jfnfa9pF0R8Q8+6kfAj1m+yM6g+Iiyo2D4CYIJib8=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=g/evGOAOl6nCcTIr0MAI/PTVjnzZwKBHCF57j2w0InptIy60G50rAyxm0K2YVBLvQoo2zIxVd328iFR/cp9YbMQeSmEwImQpCJY1HGuylHUjqJCEBzeSTe5wz/A5JksWiaJjikYXEr1H1Nk1FK5x91b590RvshQqE+Awe3I471Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tAtENVPN; 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="tAtENVPN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D8AAC4CED0 for ; Wed, 18 Dec 2024 17:07:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541627; bh=+/Jfnfa9pF0R8Q8+6kfAj1m+yM6g+Iiyo2D4CYIJib8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tAtENVPNS+wJ41X2G2Ws1bqRHRUP+U/JFrYJh6w5ko1ezyBB5GDXqMNQBjl6SfAHz cTvmTXpiGndutpOH309ykPmFoaw8zEnn4pt+1b+6V1HuB7vU2IZvqbxjk14U43nCrR 8+4TTjQZydg6nqHu4ZC+Iv/sO252lg4+D1ELFbNje06NF3e0ciCqZltiSY+BozTfIQ cWBP3J1OtV9Vz690U7epd2lDevlg6yepcB6rivfXmk7caxT1gnVvLsB+Ri3NibVJMI auZlen89/rezbavI/o9kU9DmK/ZGaS66n/4/dfRXmswgL6YI3hT43nRzqEADtz3OTq QdNoc4o928Fpw== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 16/20] btrfs: relocation: remove unnecessary calls to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:43 +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 We have several places explicitly calling btrfs_mark_buffer_dirty() but that is not necessarily since the target leaf came from a path that was obtained for a btree search function that modifies the btree, something like btrfs_insert_empty_item() or anything else that ends up calling btrfs_search_slot() with a value of 1 for its 'cow' argument. These just make the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove them. Signed-off-by: Filipe Manana --- fs/btrfs/relocation.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index cdd9a7b15a11..d4100e58172f 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -856,7 +856,6 @@ int replace_file_extents(struct btrfs_trans_handle *trans, u32 i; int ret = 0; int first = 1; - int dirty = 0; if (rc->stage != UPDATE_DATA_PTRS) return 0; @@ -936,7 +935,6 @@ int replace_file_extents(struct btrfs_trans_handle *trans, } btrfs_set_file_extent_disk_bytenr(leaf, fi, new_bytenr); - dirty = 1; key.offset -= btrfs_file_extent_offset(leaf, fi); ref.action = BTRFS_ADD_DELAYED_REF; @@ -967,8 +965,6 @@ int replace_file_extents(struct btrfs_trans_handle *trans, break; } } - if (dirty) - btrfs_mark_buffer_dirty(trans, leaf); if (inode) btrfs_add_delayed_iput(inode); return ret; @@ -1161,13 +1157,11 @@ int replace_path(struct btrfs_trans_handle *trans, struct reloc_control *rc, */ btrfs_set_node_blockptr(parent, slot, new_bytenr); btrfs_set_node_ptr_generation(parent, slot, new_ptr_gen); - btrfs_mark_buffer_dirty(trans, parent); btrfs_set_node_blockptr(path->nodes[level], path->slots[level], old_bytenr); btrfs_set_node_ptr_generation(path->nodes[level], path->slots[level], old_ptr_gen); - btrfs_mark_buffer_dirty(trans, path->nodes[level]); ref.action = BTRFS_ADD_DELAYED_REF; ref.bytenr = old_bytenr; @@ -3728,7 +3722,6 @@ static int __insert_orphan_inode(struct btrfs_trans_handle *trans, btrfs_set_inode_mode(leaf, item, S_IFREG | 0600); btrfs_set_inode_flags(leaf, item, BTRFS_INODE_NOCOMPRESS | BTRFS_INODE_PREALLOC); - btrfs_mark_buffer_dirty(trans, leaf); out: btrfs_free_path(path); return ret; From patchwork Wed Dec 18 17:06:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913981 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 0AE431FA8E9 for ; Wed, 18 Dec 2024 17:07:09 +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=1734541629; cv=none; b=l72UnozKd2z0/lQINvDodNC7QXLimV3sriighB+5hurZ3V6u0ouUQ91kHImwe5vKC7ciMYyAdpujSYesJYnzPpgOzU81g/bmpmGePesmqm+aVZa48g1BY4a0gwVsmmNA6q3At8UFxiY0CKMJYPz0aO2tBp8+luu1qSC1cUH2o5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541629; c=relaxed/simple; bh=6Qw7uSRx7Qm4u6q/gEbPWjb6LcI+qospRa/zpff441Q=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qYzpWnVSLpw6C0BY47QKtnitKkUJe9zsQ/yUrfLr7UKqU+1SOpMhsPgSWldhIhdB2G5fSNc/RvcIzrzqdzMGvjQlZceioNA8jNFsLNMkcuFWMrl5K9woUlpG7uwASiZKqQWDSHOPSMIUfgNtXPTJFeudB1F1KR2es/YB/VMdm/A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CgRl4au5; 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="CgRl4au5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54A66C4CECD for ; Wed, 18 Dec 2024 17:07:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541628; bh=6Qw7uSRx7Qm4u6q/gEbPWjb6LcI+qospRa/zpff441Q=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CgRl4au5M9IuKcKynEbchv4IYWiCwR43L4wIK2Rzw689n1jwUlUM9LS/MaCPc2KSq 3yuOVCB8UFDl54Qf7MxivMeNf590LvS5U0OF/CHwYW3GX6n0bCosMtUBPeGij4PI+8 vtbG8D5sJtK0p/yEJ9I4EVp/+QSjpG4r8GNa8sBRULNjTAU+9fJdIPyA22P0EhSS23 fvHpBXzWBNAbj7tFuokgDnmAwJ0Xvw/aylTB95Plk35fpVfYls29Xnw90MypnsjnF2 D+cgT47ZnqFP15+J6R9dHQo1k5NcyTgceqoze3I4r7KPWPJ0vWnSBaZaMdvQb/vFtt KXlOvOaL4GQow== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 17/20] btrfs: root-tree: remove unnecessary calls to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:44 +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 We have several places explicitly calling btrfs_mark_buffer_dirty() but that is not necessarily since the target leaf came from a path that was obtained for a btree search function that modifies the btree, something like btrfs_insert_empty_item() or anything else that ends up calling btrfs_search_slot() with a value of 1 for its 'cow' argument. These just make the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove them. Signed-off-by: Filipe Manana --- fs/btrfs/root-tree.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c index 33962671a96c..e22e6b06927a 100644 --- a/fs/btrfs/root-tree.c +++ b/fs/btrfs/root-tree.c @@ -197,7 +197,6 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root btrfs_set_root_generation_v2(item, btrfs_root_generation(item)); write_extent_buffer(l, item, ptr, sizeof(*item)); - btrfs_mark_buffer_dirty(trans, path->nodes[0]); out: btrfs_free_path(path); return ret; @@ -447,7 +446,6 @@ int btrfs_add_root_ref(struct btrfs_trans_handle *trans, u64 root_id, btrfs_set_root_ref_name_len(leaf, ref, name->len); ptr = (unsigned long)(ref + 1); write_extent_buffer(leaf, name->name, ptr, name->len); - btrfs_mark_buffer_dirty(trans, leaf); if (key.type == BTRFS_ROOT_BACKREF_KEY) { btrfs_release_path(path); From patchwork Wed Dec 18 17:06:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913982 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 46D9B1FBE92 for ; Wed, 18 Dec 2024 17:07:10 +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=1734541630; cv=none; b=Md5fYQgBfPM9lVV0kPEcgcxDwvbo8CwZQXZWGVEqG8hSZcjt/bAxBbEnIJnSqEthOXcP6n4NrU64p3tNcYF5lzduKIgAAROJmIp4vzlb0Qs86+9DNiNq4dFJPqLh0pnpJ0kA1zqV5eEXWD4wvz/OvGigDhGyfWWsjPGvrDoWatk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541630; c=relaxed/simple; bh=YcmVzk4TSdKHPT5pB2D2AfELrCwnZDek/xwtkktKw5o=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GibbYr/blUpNg8LtGvgd+K5heSMdY53d6k9RtJCcsZpKzMqyk2s/dlAvXzDAvsukGRo9Wg59qUiiUGgux4x0BZshPy8Qh/4w+eNBnQKxqMPUBYyghFYGVlACU5iNy7pN+6cvINeZDMpcggKhuXnimiSgNNaynF0OHud1O7JKYDE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LkVOoWSh; 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="LkVOoWSh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57C0FC4CED0 for ; Wed, 18 Dec 2024 17:07:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541629; bh=YcmVzk4TSdKHPT5pB2D2AfELrCwnZDek/xwtkktKw5o=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LkVOoWShTezvAVPgjVkFb8Zyt0DRvT6+0JDTl2crLmtLh1fpP64fP31GJhP1s665x 8/k0K+guAAuB+SM+Nm5ZZdhT6GCgc3RBBv8PDJ1rQ5alVXfhv51akVCpflA/n4+Oui 62B4Od924LqpINj9m8dwt4rOVU29nIOV0RA+RPXjdrUdzXlBQt17ZTrxL4oRdHDfiU IAAnRiBZn1x2lgIdfijTFAFwP5GrUha9MfG1d75TcBeNX+/5J4ss20hsZS01579fIa xLyjQV5YmwB2j6/Jr07SVuWxbhdjuSNd+NUjkZGBx9+9zajeWpdk2JcoU7Nz2P/obx LGIhPPHoRCOZw== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 18/20] btrfs: uuid-tree: remove unnecessary call to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:45 +0000 Message-Id: <4094da56a76bc9ed72772ec3c6e904b37db4c494.1734527445.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 The call to btrfs_mark_buffer_dirty() at btrfs_uuid_tree_add() is not necessary as we have a path setup for writing with btrfs_search_slot() having a 'cow' argument set to 1 (through btrfs_insert_empty_item()). This just makes the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove it. Signed-off-by: Filipe Manana --- fs/btrfs/uuid-tree.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/btrfs/uuid-tree.c b/fs/btrfs/uuid-tree.c index aca2861f2187..17b5e81123a1 100644 --- a/fs/btrfs/uuid-tree.c +++ b/fs/btrfs/uuid-tree.c @@ -140,8 +140,6 @@ int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans, const u8 *uuid, u8 typ ret = 0; subid_le = cpu_to_le64(subid_cpu); write_extent_buffer(eb, &subid_le, offset, sizeof(subid_le)); - btrfs_mark_buffer_dirty(trans, eb); - out: btrfs_free_path(path); return ret; From patchwork Wed Dec 18 17:06:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913983 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 068F71FBEAA for ; Wed, 18 Dec 2024 17:07:11 +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=1734541631; cv=none; b=OuJW1C+9DsAv/31SgZMiqzyLV8YP0AskfjS7wMWQZtsQKlkfet/QANL/AKmEMAZpcxTSTjPLtWb2OxVnOFeoKFiFMfQ491qU2enlb03TE1DSVnXL2KpJguGGfEsdCBimTU5WzMkGUAL1gJUN9vtliLM8GNLPYhExmxjRe0JTaqI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541631; c=relaxed/simple; bh=XKE9hGDbVTXihAfTuetBRbi35ErMjC0c9DFeXS1dYqI=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LrEMfb0tHj60hlLHLxmQvKTFINbKgeKK4RuD6CpmJYmG0Gh3whKBPT/5u9IoNkfvFHBnLzRstHSzghWURfyhejVkNqEAMhMqHryNW/KdYwyUTyqCRG1f0LLMJqnumCjdbHpyvYKUtfX+cq82+p1dM2aOyDkkRPj/sAdxVn4UDX0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MoMF4aoL; 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="MoMF4aoL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C11BC4CEDD for ; Wed, 18 Dec 2024 17:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541630; bh=XKE9hGDbVTXihAfTuetBRbi35ErMjC0c9DFeXS1dYqI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=MoMF4aoLeeUkjj30Mwfk1pNE+LlLeKqYDCrW26SAK4TpbTbtChIxe2paJ1KmtLFpe g8k1shdAsljs0UMZ5Ko875r95ZYkTk8LBwXIR+DfgHJWCSuiIRnv9IP5DtqdypLgaF gydWESjMmj4XTm4ll4eqkZNGtAOZ3cTzTW7yiKMl+Sye0ULQZ5T6vOr0k5WY9I8HGA YGchlb8O41dTl4eFh3RrwxdWFQCFpmx3S8a9/JcZylokTUzi2yZszuEupIoUsN+CeG htr0XML5I64CTsTk+ipCOugzQsa121W9Z+1VdUJWB10vj+kdVny5bzWVIPEmrwZCQb 3sqjniWTHnFbQ== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 19/20] btrfs: volumes: remove unnecessary calls to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:46 +0000 Message-Id: <932b0c07f2d8a7ea4e7dd52eb71545490346ad2b.1734527445.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 have several places explicitly calling btrfs_mark_buffer_dirty() but that is not necessarily since the target leaf came from a path that was obtained for a btree search function that modifies the btree, something like btrfs_insert_empty_item() or anything else that ends up calling btrfs_search_slot() with a value of 1 for its 'cow' argument. These just make the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove them. Signed-off-by: Filipe Manana --- fs/btrfs/volumes.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index d32913c51d69..7975d0d1236c 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2046,7 +2046,6 @@ static int btrfs_add_dev_item(struct btrfs_trans_handle *trans, ptr = btrfs_device_fsid(dev_item); write_extent_buffer(leaf, trans->fs_info->fs_devices->metadata_uuid, ptr, BTRFS_FSID_SIZE); - btrfs_mark_buffer_dirty(trans, leaf); ret = 0; out: @@ -2742,11 +2741,9 @@ static int btrfs_finish_sprout(struct btrfs_trans_handle *trans) device = btrfs_find_device(fs_info->fs_devices, &args); BUG_ON(!device); /* Logic error */ - if (device->fs_devices->seeding) { + if (device->fs_devices->seeding) btrfs_set_device_generation(leaf, dev_item, device->generation); - btrfs_mark_buffer_dirty(trans, leaf); - } path->slots[0]++; goto next_slot; @@ -3039,8 +3036,6 @@ static noinline int btrfs_update_device(struct btrfs_trans_handle *trans, btrfs_device_get_disk_total_bytes(device)); btrfs_set_device_bytes_used(leaf, dev_item, btrfs_device_get_bytes_used(device)); - btrfs_mark_buffer_dirty(trans, leaf); - out: btrfs_free_path(path); return ret; @@ -3749,10 +3744,7 @@ static int insert_balance_item(struct btrfs_fs_info *fs_info, btrfs_set_balance_meta(leaf, item, &disk_bargs); btrfs_cpu_balance_args_to_disk(&disk_bargs, &bctl->sys); btrfs_set_balance_sys(leaf, item, &disk_bargs); - btrfs_set_balance_flags(leaf, item, bctl->flags); - - btrfs_mark_buffer_dirty(trans, leaf); out: btrfs_free_path(path); err = btrfs_commit_transaction(trans); @@ -7746,8 +7738,6 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans, for (i = 0; i < BTRFS_DEV_STAT_VALUES_MAX; i++) btrfs_set_dev_stats_value(eb, ptr, i, btrfs_dev_stat_read(device, i)); - btrfs_mark_buffer_dirty(trans, eb); - out: btrfs_free_path(path); return ret; From patchwork Wed Dec 18 17:06:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13913984 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 0D28F1FC0E2 for ; Wed, 18 Dec 2024 17:07:12 +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=1734541632; cv=none; b=rKHamuYVlTtBKk3VPE9zhDhbrv4s2lisFsVCEubG9Rx5vFKo5epLs67lYQpZ/pI9ZmcIr/3tR0tB30+9S641xw03pxcaY0+X9slx+IsRmdvdvPQcde3hzJzvhQGeVi/XT2pBSraixQdIXJyVdQyJJc9+MnxxKC1MHn1QkBa+ltw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734541632; c=relaxed/simple; bh=amfu69XGVKcpUCq4XJ0FAL/QurK9vmGStA6FqT6BeHw=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HeCCu2tr0SBDiql5AAJ06JiRw4FQ4G7oVpUe7gZw6gtdEulNlCbqd3FIs2Asv/4UgEHldYeXOCmJmnh3eZ8XMHrANlzGysAe7ti4wULkI74x34FXM7aUfht1oXiQkhSdBoMZ/tvkzi6TzY2MIl2gSyXHecCNthrIoHC/rb0ltzY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ajAmNBuG; 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="ajAmNBuG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F830C4CED0 for ; Wed, 18 Dec 2024 17:07:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1734541631; bh=amfu69XGVKcpUCq4XJ0FAL/QurK9vmGStA6FqT6BeHw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ajAmNBuGXagHrw0vMuT61kLeFxjU3hMnpiL/bCqEmnibULpfBHV7d6oXRjY0D2aTV KTvCIPnlBoeCBQlBbcoOO10L+yRAERMRMac6lgwtWMwAFbdXYBVWEBmg5sGDykLc1j 0m6p+zUjrF78+OcsggxLYu/40GXK/RrU+XO94bo8nvW5f7jtKdLhMjxk0Bqke1bbkP 7GXRbUdZU99OKwalklJOxiRHDBDABRSOiEf7NcOipLTHeMWWuProvdD7m+tAs5ngXA CjMOaiti4QBDgmbBTIw1t6WhQw8nEa+3TF2b161s7mMpD5CYNbTv3ZBmKc9GhRZtcS C3MwP3kFPs+wg== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH 20/20] btrfs: xattr: remove unnecessary call to btrfs_mark_buffer_dirty() Date: Wed, 18 Dec 2024 17:06:47 +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 call to btrfs_mark_buffer_dirty() at btrfs_setxattr() is not necessary as we have a path setup for writing with btrfs_search_slot() having a 'cow' argument set to 1. This just makes the code more verbose, confusing and add a little extra overhead and well as increase the module's text size, so remove it. Signed-off-by: Filipe Manana --- fs/btrfs/xattr.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c index bc18710d1dcf..3e0edbcf73e1 100644 --- a/fs/btrfs/xattr.c +++ b/fs/btrfs/xattr.c @@ -204,7 +204,6 @@ int btrfs_setxattr(struct btrfs_trans_handle *trans, struct inode *inode, btrfs_set_dir_data_len(leaf, di, size); data_ptr = ((unsigned long)(di + 1)) + name_len; write_extent_buffer(leaf, value, data_ptr, size); - btrfs_mark_buffer_dirty(trans, leaf); } else { /* * Insert, and we had space for the xattr, so path->slots[0] is