public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Josef Bacik <josef@toxicpanda.com>,
	linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH 12/12] btrfs: use _offset helpers instead of offsetof in generic_bin_search
Date: Wed, 9 Mar 2022 15:51:59 +0200	[thread overview]
Message-ID: <766bd883-e688-5a4e-2da9-038bd8bba945@suse.com> (raw)
In-Reply-To: <51de9fc987057bc50097fd217e8a3fa51068a49c.1646692306.git.josef@toxicpanda.com>



On 8.03.22 г. 0:33 ч., Josef Bacik wrote:
> The starting offset for the items/keys are going to be dependent on
> extent tree v2, use the helpers instead of offsetof directly.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
>   fs/btrfs/ctree.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
> index 1a6f24baf33b..6e8c02eec548 100644
> --- a/fs/btrfs/ctree.c
> +++ b/fs/btrfs/ctree.c
> @@ -781,10 +781,10 @@ static noinline int generic_bin_search(struct extent_buffer *eb, int low,
>   	}
>   
>   	if (btrfs_header_level(eb) == 0) {
> -		p = offsetof(struct btrfs_leaf, items);
> +		p = btrfs_item_nr_offset(eb, 0);

nit: This could be switched to BTRFS_LEAF_DATA_OFFSET.

>   		item_size = sizeof(struct btrfs_item);
>   	} else {
> -		p = offsetof(struct btrfs_node, ptrs);
> +		p = btrfs_node_key_ptr_offset(eb, 0);
>   		item_size = sizeof(struct btrfs_key_ptr);
>   	}
>   

  reply	other threads:[~2022-03-09 13:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 22:33 [PATCH 00/12] btrfs: item helper prep work for snapshot_id Josef Bacik
2022-03-07 22:33 ` [PATCH 01/12] btrfs: move btrfs_node_key into ctree.h Josef Bacik
2022-03-07 22:33 ` [PATCH 02/12] btrfs: add a btrfs_node_key_ptr helper, convert the users Josef Bacik
2022-03-09 13:48   ` Nikolay Borisov
2022-03-09 13:48     ` Nikolay Borisov
2022-03-07 22:33 ` [PATCH 03/12] btrfs: introduce *_leaf_data helpers Josef Bacik
2022-03-07 22:33 ` [PATCH 04/12] btrfs: make BTRFS_LEAF_DATA_OFFSET take an eb arg Josef Bacik
2022-03-07 22:33 ` [PATCH 05/12] btrfs: pass eb to the node_key_ptr helpers Josef Bacik
2022-03-07 22:33 ` [PATCH 06/12] btrfs: pass eb to the item_nr_offset helper Josef Bacik
2022-03-09 13:55   ` Nikolay Borisov
2022-03-07 22:33 ` [PATCH 07/12] btrfs: add snapshot_id to the btrfs_header and related defs Josef Bacik
2022-03-07 22:33 ` [PATCH 08/12] btrfs: move the header SETGET funcs Josef Bacik
2022-03-07 22:33 ` [PATCH 09/12] btrfs: move the super " Josef Bacik
2022-03-07 22:33 ` [PATCH 10/12] btrfs: move BTRFS_LEAF related definitions below " Josef Bacik
2022-03-07 22:33 ` [PATCH 11/12] btrfs: const-ify fs_info for the compat flag handlers Josef Bacik
2022-03-07 22:33 ` [PATCH 12/12] btrfs: use _offset helpers instead of offsetof in generic_bin_search Josef Bacik
2022-03-09 13:51   ` Nikolay Borisov [this message]
2022-03-09 13:57 ` [PATCH 00/12] btrfs: item helper prep work for snapshot_id Nikolay Borisov
2022-03-14 17:12   ` Sweet Tea Dorminy

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=766bd883-e688-5a4e-2da9-038bd8bba945@suse.com \
    --to=nborisov@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --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