From: Stefan Behrens <sbehrens@giantdisaster.de>
To: Zach Brown <zab@redhat.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v5 1/8] Btrfs: introduce a tree for items that map UUIDs to something
Date: Mon, 24 Jun 2013 18:42:13 +0200 [thread overview]
Message-ID: <51C876E5.4060802@giantdisaster.de> (raw)
In-Reply-To: <20130621161138.GA25321@lenny.home.zabbo.net>
On Fri, 21 Jun 2013 09:11:38 -0700, Zach Brown wrote:
>>>> + offset = (unsigned long)ptr;
>>>> + while (sub_item_len > 0) {
>>>> + u64 data;
>>>> +
>>>> + read_extent_buffer(eb, &data, offset, sizeof(data));
>>>> + data = le64_to_cpu(data);
>>>> + if (data == subid) {
>>>> + ret = 0;
>>>> + break;
>>>> + }
>>>> + offset += sizeof(data);
>>>> + sub_item_len--;
>>>> + }
>>>
>>> This could be cleaned up a bit by comparing an on-stack little-endian
>>> input subid with each little-endian subid in the item with
>>> memcmp_extent_buffer().
>>
>> This would save some CPU cycles for the repeated le64_to_cpu() and for
>> the memcpy(). The number of lines of code is equal for both ways.
>
> Hmm? It would be many fewer lines of code.
Are you thinking of something shorter than the following?
offset = (unsigned long)ptr;
subid = cpu_to_le64(subid);
while (sub_item_len > 0) {
if (memcmp_extent_buffer(eb, &subid, offset,
sizeof(subid)) == 0) {
ret = 0;
break;
}
offset += sizeof(subid);
sub_item_len--;
}
next prev parent reply other threads:[~2013-06-24 16:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-20 17:45 [PATCH v5 0/8] Btrfs: introduce a tree for UUID to subvol ID mapping Stefan Behrens
2013-06-20 17:45 ` [PATCH v5 1/8] Btrfs: introduce a tree for items that map UUIDs to something Stefan Behrens
2013-06-20 19:47 ` Zach Brown
2013-06-21 8:47 ` Stefan Behrens
2013-06-21 16:11 ` Zach Brown
2013-06-24 16:42 ` Stefan Behrens [this message]
2013-06-24 18:10 ` Zach Brown
2013-06-21 16:20 ` Chris Mason
2013-06-20 17:45 ` [PATCH v5 2/8] Btrfs: support printing UUID tree elements Stefan Behrens
2013-06-20 17:45 ` [PATCH v5 3/8] Btrfs: create UUID tree if required Stefan Behrens
2013-06-20 17:45 ` [PATCH v5 4/8] Btrfs: maintain subvolume items in the UUID tree Stefan Behrens
2013-06-20 17:45 ` [PATCH v5 5/8] Btrfs: fill UUID tree initially Stefan Behrens
2013-06-20 17:45 ` [PATCH v5 6/8] Btrfs: introduce uuid-tree-gen field Stefan Behrens
2013-06-20 17:45 ` [PATCH v5 7/8] Btrfs: check UUID tree during mount if required Stefan Behrens
2013-06-20 19:49 ` Zach Brown
2013-06-20 17:45 ` [PATCH v5 8/8] Btrfs: add mount option to force UUID tree checking Stefan Behrens
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=51C876E5.4060802@giantdisaster.de \
--to=sbehrens@giantdisaster.de \
--cc=linux-btrfs@vger.kernel.org \
--cc=zab@redhat.com \
/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.