From: Nikolay Borisov <nborisov@suse.com>
To: Marcos Paulo de Souza <mpdesouza@suse.de>,
Marcos Paulo de Souza <mpdesouza@suse.com>,
linux-btrfs@vger.kernel.org
Cc: dsterba@suse.com
Subject: Re: [PATCH RFC] btrfs: Introduce btrfs_for_each_slot
Date: Mon, 16 Aug 2021 15:30:33 +0300 [thread overview]
Message-ID: <42dfeb76-e6b7-55da-04be-d7868fd3d397@suse.com> (raw)
In-Reply-To: <9107ecb2f56198dc7329820d3a25173d4924682d.camel@suse.de>
On 16.08.21 г. 15:21, Marcos Paulo de Souza wrote:
> On Mon, 2021-08-02 at 09:57 -0300, Marcos Paulo de Souza wrote:
>> There is a common pattern when search for a key in btrfs:
>>
>> * Call btrfs_search_slot
>> * Endless loop
>> * If the found slot is bigger than the current items in the
>> leaf, check the
>> next one
>> * If still not found in the next leaf, return 1
>> * Do something with the code
>> * Increment current slot, and continue
>>
>> This pattern can be improved by creating an iterator macro, similar
>> to
>> those for_each_X already existing in the linux kernel. using this
>> approach means to reduce significantly boilerplate code, along making
>> it
>> easier to newcomers to understand how to code works.
>>
>> Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
>> ---
>>
>> I've being testing this approach in the last few weeks, and using
>> this macro
>> all over the btrfs codebase, and not issues found yet. This is just
>> a RFC
>> showing how the xattr code would benefit using the macro.
>>
>> The only part that I didn't like was using the ret variable as a
>> macro
>> argument, but I couldn't find a better way to do it...
>>
>> That's why this is an RFC, so please comment :)
>
> Gentle ping :)
>
I didn't give a RB because the patch is too small in the sense that it
shows just a single caller. In order to be able to better ascertain how
useful is I was expecting you'd submit a larger series containing all
the necessary changes. Additionally, does this patch relate to the
changes in 'btrfs: Use btrfs_find_item whenever possible' or are those 2
independent?
next prev parent reply other threads:[~2021-08-16 12:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-02 12:57 [PATCH RFC] btrfs: Introduce btrfs_for_each_slot Marcos Paulo de Souza
2021-08-16 12:21 ` Marcos Paulo de Souza
2021-08-16 12:30 ` Nikolay Borisov [this message]
2021-08-16 12:54 ` David Sterba
2021-08-19 12:27 ` David Sterba
2021-08-19 12:34 ` 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=42dfeb76-e6b7-55da-04be-d7868fd3d397@suse.com \
--to=nborisov@suse.com \
--cc=dsterba@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=mpdesouza@suse.com \
--cc=mpdesouza@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.