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.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html