[Btrfs-devel] I'm kind of confused...
Josef Bacik
jbacik at redhat.com
Fri Aug 17 08:21:27 PDT 2007
On Fri, Aug 17, 2007 at 06:24:52AM +0800, Yan Zheng wrote:
> 2007/8/17, Josef Bacik <jbacik at redhat.com>:
> > Hello,
> >
> > I'm trying to get the name of the root item so I can populate sysfs properly,
> > and I'm doing this
> >
> >
> > dir_item = btrfs_item_ptr(l, path->slots[0], struct btrfs_dir_item);
> > name_ptr = (char *)(dir_item + 1);
> > ret = btrfs_sysfs_add_root(root, name_ptr,
> > btrfs_dir_name_len(dir_item));
> >
> > in btrfs_find_last_root after the btrfs_disk_key_to_cpu() part. Problem is I'm
> > getting a null name. Now here's the part I'm confused about, we get to
> > btrfs_find_last_root via find_and_setup_root via btrfs_read_fs_root_no_radix.
> > In btrfs_find_last_root you have this
> >
> > ret = btrfs_search_slot(NULL, root, &search_key, path, 0, 0);
> > if (ret < 0)
> > goto out;
> > BUG_ON(ret == 0);
> >
> both search_key's flags and offset are set to the maximum value and
> it's intended no item has such large flags and offset. If there are
> items that have the objectid search for, the item at [path->slots[0]
> - 1] should be last one (the one has largest offset) .
> (btrfs_search_slot use binary search)
>
> Good luck.
>
Ahh well that explains it, thank you very much :). /me has been staring at this
code for too long...
Josef
More information about the Btrfs-devel
mailing list