From: David Sterba <dsterba@suse.cz>
To: Gerhard Heift <gerhard@heift.name>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: BTRFS_SEARCH_ARGS_BUFSIZE too small
Date: Wed, 15 Jan 2014 19:39:18 +0100 [thread overview]
Message-ID: <20140115183918.GF6498@twin.jikos.cz> (raw)
In-Reply-To: <CACeaM885anPZOwbAw_2w43vOU8e0zkj-w_drar1sJhpppCsJeA@mail.gmail.com>
On Fri, Jan 10, 2014 at 12:44:17AM +0100, Gerhard Heift wrote:
> I'm playing around with the BTRFS_IOC_SEARCH_TREE to extract the csums
> of the physical blocks. During the tests some item_header had len = 0,
> which indicates the buffer was to small to hold the item. I added a
> printk into the kernel to get the original size of the item and it was
> around 6600 bytes.
This can happen with the metadata blocks bigger than 4k, the search
ioctl does not have buffer large enough as you've found. The EXTENT_CSUM
items seem to cap at 16k, no matter what's the node size (tried with
64k).
> Is there another way to get the item? Otherwise I would suggest to
> create an ioctl, which is a little bit more flexible, something like
>
> struct btrfs_ioctl_search_args2 {
> struct btrfs_ioctl_search_key key;
> __u64 buf_len
> char buf[0];
> };
Yeah, a V2 ioctl has to be introduced, the structure could look like
this. Kernel would have uo directly copy_to_user to the buffer without
the intermediate memcpy to the in-kernel copy of the ioctl structure.
david
next prev parent reply other threads:[~2014-01-15 18:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-09 23:44 BTRFS_SEARCH_ARGS_BUFSIZE too small Gerhard Heift
2014-01-15 18:39 ` David Sterba [this message]
2014-01-15 19:29 ` Gerhard Heift
2014-01-16 15:07 ` 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=20140115183918.GF6498@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=gerhard@heift.name \
--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