From: fdmanana@kernel.org
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 5/8] btrfs: use round_down() to align block offset at btrfs_cow_block()
Date: Tue, 26 Sep 2023 13:45:17 +0100 [thread overview]
Message-ID: <fbeeb5bca850f70e3e01744130d05239e5267c9c.1695731843.git.fdmanana@suse.com> (raw)
In-Reply-To: <cover.1695731838.git.fdmanana@suse.com>
From: Filipe Manana <fdmanana@suse.com>
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 <fdmanana@suse.com>
---
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 602da318ba11..9849477c5e19 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
--
2.40.1
next prev parent reply other threads:[~2023-09-26 12:45 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-26 12:45 [PATCH 0/8] btrfs: some fixes and cleanups around btrfs_cow_block() fdmanana
2023-09-26 12:45 ` [PATCH 1/8] btrfs: error out when COWing block using a stale transaction fdmanana
2023-09-26 17:31 ` David Sterba
2023-09-26 17:57 ` Filipe Manana
2023-09-26 18:18 ` Filipe Manana
2023-09-26 12:45 ` [PATCH 2/8] btrfs: error when COWing block from a root that is being deleted fdmanana
2023-09-26 12:45 ` [PATCH 3/8] btrfs: error out when reallocating block for defrag using a stale transaction fdmanana
2023-09-26 17:41 ` David Sterba
2023-09-26 12:45 ` [PATCH 4/8] btrfs: remove noinline attribute from btrfs_cow_block() fdmanana
2023-09-26 12:45 ` fdmanana [this message]
2023-09-26 12:45 ` [PATCH 6/8] btrfs: rename and export __btrfs_cow_block() fdmanana
2023-09-26 12:45 ` [PATCH 7/8] btrfs: export comp_keys() from ctree.c as btrfs_comp_keys() fdmanana
2023-09-26 12:45 ` [PATCH 8/8] btrfs: move btrfs_realloc_node() from ctree.c into defrag.h fdmanana
2023-09-27 11:09 ` [PATCH v2 0/8] btrfs: some fixes and cleanups around btrfs_cow_block() fdmanana
2023-09-27 11:09 ` [PATCH v2 1/8] btrfs: error out when COWing block using a stale transaction fdmanana
2023-09-27 11:09 ` [PATCH v2 2/8] btrfs: error when COWing block from a root that is being deleted fdmanana
2023-09-27 11:09 ` [PATCH v2 3/8] btrfs: error out when reallocating block for defrag using a stale transaction fdmanana
2023-09-27 11:09 ` [PATCH v2 4/8] btrfs: remove noinline attribute from btrfs_cow_block() fdmanana
2023-09-27 11:09 ` [PATCH v2 5/8] btrfs: use round_down() to align block offset at btrfs_cow_block() fdmanana
2023-09-27 11:09 ` [PATCH v2 6/8] btrfs: rename and export __btrfs_cow_block() fdmanana
2023-09-27 11:09 ` [PATCH v2 7/8] btrfs: export comp_keys() from ctree.c as btrfs_comp_keys() fdmanana
2023-09-27 11:09 ` [PATCH v2 8/8] btrfs: move btrfs_realloc_node() from ctree.c into defrag.c fdmanana
2023-09-29 14:35 ` David Sterba
2023-09-29 14:33 ` [PATCH v2 0/8] btrfs: some fixes and cleanups around btrfs_cow_block() David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fbeeb5bca850f70e3e01744130d05239e5267c9c.1695731843.git.fdmanana@suse.com \
--to=fdmanana@kernel.org \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).