From: Hans van Kranenburg <hans.van.kranenburg@mendix.com>
To: kreijack@inwind.it, Ashish Samant <ashish.samant@oracle.com>,
linux-btrfs@vger.kernel.org
Cc: bo.li.liu@oracle.com
Subject: Re: [PATCH] Btrfs-progs: add check-only option for balance
Date: Sun, 12 Jun 2016 20:53:34 +0200 [thread overview]
Message-ID: <575DAFAE.10906@mendix.com> (raw)
In-Reply-To: <cbd07ef0-83ba-e8af-fe6c-2ed5689965c2@inwind.it>
Hi!
On 06/12/2016 08:41 PM, Goffredo Baroncelli wrote:
> Hi All,
>
> On 2016-06-10 22:47, Hans van Kranenburg wrote:
>>> + if (sk->min_objectid < sk->max_objectid) +
>>> sk->min_objectid += 1;
>>
>> ...and now it's (289406977 168 19193856), which means you're
>> continuing your search *after* the block group item!
>>
>> (289406976 168 19193856) is actually (289406976 << 72) + (168 <<
>> 64) + 19193856, which is 1366685806470112827871857008640
>>
>> The search is continued at 1366685811192479310741502222336, which
>> skips 4722366482869645213696 possible places where an object could
>> live in the tree.
>
> I am not sure to follow you. The extent tree (the tree involved in
> the search), contains only two kind of object:
>
> - BLOCK_GROUP_ITEM where the key means (logical address, 0xc0, size
> in bytes)
> - EXTENT_ITEM, where the key means (logical address, 0xa8,
> size in bytes)
>
> So it seems that for each (possible) "logical address", only two
> items might exist; the two item are completely identified by
> (objectid, type, ). It should not possible (for the extent tree) to
> have two item with the same objectid,key and different offset. So,
> for the extent tree, it is safe to advance only the objectid field.
>
> I am wrong ?
When calling the search ioctl, the caller has to provide a memory buffer
that the kernel is going to fill with results. For BTRFS_IOC_TREE_SEARCH
used here, this buffer has a fixed size of 4096 bytes. Without some
headers etc, this leaves a bit less than 4000 bytes of space for the
kernel to write search result objects to.
If I do a search that will result in far more objects to be returned
than possible to fit in those <4096 bytes, the kernel will just put a
few in there until the next one does not fit any more.
It's the responsibility of the caller to change the start of the search
to point just after the last received object and do the search again, in
order to retrieve a few extra results.
So, the important line here was: "...when the extent_item just manages
to squeeze in as last result into the current result buffer from the
ioctl..."
--
Hans van Kranenburg - System / Network Engineer
T +31 (0)10 2760434 | hans.van.kranenburg@mendix.com | www.mendix.com
next prev parent reply other threads:[~2016-06-12 18:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-09 21:46 [PATCH] Btrfs-progs: add check-only option for balance Ashish Samant
2016-06-10 17:57 ` Goffredo Baroncelli
2016-06-10 20:47 ` Hans van Kranenburg
2016-06-12 18:41 ` Goffredo Baroncelli
2016-06-12 18:53 ` Hans van Kranenburg [this message]
2016-06-14 18:11 ` Goffredo Baroncelli
2016-06-14 18:16 ` Hugo Mills
2016-06-14 18:55 ` Goffredo Baroncelli
2016-06-14 18:21 ` Ashish Samant
-- strict thread matches above, loose matches on Subject: below --
2016-01-14 23:12 Liu Bo
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=575DAFAE.10906@mendix.com \
--to=hans.van.kranenburg@mendix.com \
--cc=ashish.samant@oracle.com \
--cc=bo.li.liu@oracle.com \
--cc=kreijack@inwind.it \
--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 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.