From: David Sterba <dsterba@suse.cz>
To: Liu Bo <bo.li.liu@oracle.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [RFC][PATCH] btrfs-progs: inspect: new subcommand to dump chunks
Date: Thu, 23 Jun 2016 14:43:33 +0200 [thread overview]
Message-ID: <20160623124332.GA4915@suse.cz> (raw)
In-Reply-To: <20160623015352.GA15815@localhost.localdomain>
On Wed, Jun 22, 2016 at 06:53:52PM -0700, Liu Bo wrote:
> > +static u64 fill_usage(int fd, u64 lstart)
> > +{
> > + struct btrfs_ioctl_search_args args;
> > + struct btrfs_ioctl_search_key *sk = &args.key;
> > + struct btrfs_ioctl_search_header sh;
> > + struct btrfs_block_group_item *item;
> > + int ret;
> > +
> > + memset(&args, 0, sizeof(args));
> > + sk->tree_id = BTRFS_EXTENT_TREE_OBJECTID;
> > + sk->min_objectid = lstart;
> > + sk->max_objectid = lstart;
> > + sk->min_type = BTRFS_BLOCK_GROUP_ITEM_KEY;
> > + sk->max_type = BTRFS_BLOCK_GROUP_ITEM_KEY;
> > + sk->min_offset = 0;
> > + sk->max_offset = (u64)-1;
> > + sk->max_transid = (u64)-1;
> > +
> > + sk->nr_items = 4096;
>
> What if we set nr_items = 1? From the code review, this can let us
> stop and return immediately.
Indeed, I've copy-pasted the search code. When it's 1 it returns
immediatelly if the metadata are cached, cold read took a few seconds on
a terabyte-sized filesystem.
prev parent reply other threads:[~2016-06-23 12:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-22 17:26 [RFC][PATCH] btrfs-progs: inspect: new subcommand to dump chunks David Sterba
2016-06-22 22:20 ` Hans van Kranenburg
2016-06-23 13:13 ` David Sterba
2016-06-23 13:17 ` Hans van Kranenburg
2016-06-23 1:10 ` Hans van Kranenburg
2016-06-23 13:27 ` David Sterba
2016-06-23 1:20 ` Qu Wenruo
2016-06-23 13:07 ` David Sterba
2016-06-23 1:53 ` Liu Bo
2016-06-23 12:43 ` David Sterba [this message]
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=20160623124332.GA4915@suse.cz \
--to=dsterba@suse.cz \
--cc=bo.li.liu@oracle.com \
--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;
as well as URLs for NNTP newsgroup(s).