From patchwork Wed Sep 27 11:09:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Filipe Manana X-Patchwork-Id: 13400665 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 207FDE810CE for ; Wed, 27 Sep 2023 11:09:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231334AbjI0LJj (ORCPT ); Wed, 27 Sep 2023 07:09:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231329AbjI0LJi (ORCPT ); Wed, 27 Sep 2023 07:09:38 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3327F3 for ; Wed, 27 Sep 2023 04:09:37 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A520C433C8 for ; Wed, 27 Sep 2023 11:09:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695812977; bh=IdInY2600PhoiYLbimc4gGLO52J0bK/Rxxyqp7I2uas=; h=From:To:Subject:Date:In-Reply-To:References:From; b=u1XxXXi4LTuhcG/jrjw0Ooo60EAXZlQ0i84Hrm3uv5HRv2S/07rrE0tng89y+HSSm efCJJGIWCTmIXJMFt+YHeXZTp6dhBx3VXpOPg6Y4mFzIvMe+W7bA+NoTnWvyMdK6X/ SiiyqvBcDI55aWwxc5+BkwNkV397y3MnRoKhb7i+JtdgMp6oJLByPWi5iWcj6Q3Nia rUc8JcD4273ZmJ0x8aWIXP6YDAfvenl9/VQaPAVHbqL7o/lFCguyaLHnaRp+YKnKsN G6ZicUbUnlg+jRVQrlEJtjqdZohfZe+LDTo5ApqdQioB8ABrLKK795m/hU9RAjRMXi Se3VL6PkiGP1A== From: fdmanana@kernel.org To: linux-btrfs@vger.kernel.org Subject: [PATCH v2 5/8] btrfs: use round_down() to align block offset at btrfs_cow_block() Date: Wed, 27 Sep 2023 12:09:25 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org From: Filipe Manana At btrfs_cow_block() we can use round_down() to align the extent buffer's logical offset to the start offset of a metadata block group, instead of the less easy to read set of bitwise operations (two plus one subtraction). So replace the bitwise operations with a round_down() call. Signed-off-by: Filipe Manana --- fs/btrfs/ctree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index a05c9204928e..8d29b9e09286 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -712,7 +712,7 @@ int btrfs_cow_block(struct btrfs_trans_handle *trans, return 0; } - search_start = buf->start & ~((u64)SZ_1G - 1); + search_start = round_down(buf->start, SZ_1G); /* * Before CoWing this block for later modification, check if it's