Hello, How do you want me to do this? I started writing stuff and then realized I've got two options 1) for every superblock we create a directory inside /sys/fs/btrfs with the sb->s_id (so the device name), and then in there we have the random info like blocks_used, total_blocks, etc. Then for every subvol/snapshot created inside that super block (ie every btrfs_root item associated with that super_block) we have another sysfs directory, with all of its individual information, and do something ugly like root->inode->i_dentry->d_name.name for the name of the directory. The only problem I'm having with this is where to store the kobj for the super_block. I could keep a running list of the super_block kobj's within the sysfs code, or change btrfs_super_block into btrfs_super_block_item and make a seperate btrfs_super_block struct for the in memory superblock. 2) ignore the superblock, and just create sysfs directories for the btrfs_root's. This means the only ugly thing we are doing is getting the root item's name, we dont have to do all the weird stuff to keep track of the super block, but we lose the ability to report certain things about the superblock (not that I think that matters too much b/c df and such should take care of all of that anyway). Let me know which way you want to go and I'll do whats needed. Josef P.S. is there a public IRC channel/AIM/gtalk/anything I can reach you on so I don't have to send all these quick question emails?
On Wed, 15 Aug 2007 16:01:17 -0400 Josef Bacik <jbacik@redhat.com> wrote:> Hello, > > How do you want me to do this? I started writing stuff and then > realized I've got two options > > 1) for every superblock we create a directory inside /sys/fs/btrfs > with the sb->s_id (so the device name), and then in there we have the > random info like blocks_used, total_blocks, etc. Then for every > subvol/snapshot created inside that super block (ie every btrfs_root > item associated with that super_block) we have another sysfs > directory, with all of its individual information, and do something > ugly like root->inode->i_dentry->d_name.name for the name of the > directory. The only problem I'm having with this is where to store > the kobj for the super_block. I could keep a running list of the > super_block kobj's within the sysfs code, or change btrfs_super_block > into btrfs_super_block_item and make a seperate btrfs_super_block > struct for the in memory superblock.I think option #1 would be the easiest to use. You can put the kobject for the super block in struct btrfs_fs_info, which is basically the stuff global to the FS.> > P.S. is there a public IRC channel/AIM/gtalk/anything I can reach you > on so I don't have to send all these quick question emails? >I'm on #linuxfs on irc.oftc.net, it's a good place for these kinds of discussions I think. Thanks, Chris