linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tobias Reinhard <trtracer@gmail.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: Retrieving CSUM-Tree
Date: Fri, 25 Jan 2019 17:59:55 +0100	[thread overview]
Message-ID: <91b98362-9019-3199-990d-072466b1b455@gmail.com> (raw)
In-Reply-To: <a0e58490-8610-2b86-751f-772625fdf0ca@gmx.com>

Am 13.01.2019 um 12:02 schrieb Qu Wenruo:
>
> On 2019/1/13 下午6:19, Tobias Reinhard wrote:
>> Hi,
>>
>> I want to read the complete CSUM-Tree from userspace. I tried it via the
>> ioctl. This is what the code looks like:
>>
>> struct btrfs_sv2_args sv2_args;
>> int fd = open(filename, O_RDONLY);
>> sv2_args.key.tree_id = BTRFS_CSUM_TREE_OBJECTID;
>> sv2_args.key.min_objectid = 0;
>> sv2_args.key.max_objectid = -1;
>> sv2_args.key.min_offset = 0;
>> sv2_args.key.max_offset = -1;
>> sv2_args.key.min_transid = 0;
>> sv2_args.key.max_transid = -1;
>> sv2_args.key.min_type = BTRFS_CSUM_ITEM_KEY;
>> sv2_args.key.max_type = BTRFS_CSUM_ITEM_KEY;
>> sv2_args.key.nr_items = -1;
>> sv2_args.buf_size = sizeof(sv2_args.buf);
>> ioctl(fd, BTRFS_IOC_TREE_SEARCH_V2, &sv2_args);
>>
>> But the device is not small and I hit the limit of the
>> btrfs_sv2_args.buf which seems to be 16 MB.
>>
>> How can I get the *complete* CSUM-Tree?
>>
>> Limiting to offset does not work (My first idea was to do it this way
>> and get it in chunks).
> That's strange.
>
> Are you still using 0~-1 objectid and 0~-1 type, just last_offset~-1?
>
> Have tried searching using the following parameters?
> min_objectid = max_objectid = BTRFS_EXTENT_CSUM_OBJECTID
> min_type = max_type = BTRFS_CSUM_ITEM_KEY;
> min_offset = last_found_csum_offset
> max_offset = -1

Sorry for my late response.

If I set

min_objectid = max_objectid = BTRFS_EXTENT_CSUM_OBJECTID

I don't get anything. I have to set it to max=-1 (min doesn't matter).

And in that I case, min_offset and max_offset doesn't matter - I always 
get the same result. I can even use "wrong" filters like min=1000 max=500.

Tobias


  reply	other threads:[~2019-01-25 17:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-13 10:19 Retrieving Tobias Reinhard
2019-01-13 11:02 ` Retrieving Qu Wenruo
2019-01-25 16:59   ` Tobias Reinhard [this message]
2019-01-25 18:05     ` Retrieving CSUM-Tree Hans van Kranenburg
2019-01-25 20:45       ` Tobias Reinhard
2019-01-25 20:49         ` Hans van Kranenburg
2019-01-25 21:22 ` Retrieving Zygo Blaxell

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=91b98362-9019-3199-990d-072466b1b455@gmail.com \
    --to=trtracer@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.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 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).