On Mon, Aug 06, 2018 at 02:25:24PM +0900, Misono Tomohiro wrote:
> There are two members in struct btrfs_root which indicate root's
> objectid: ->objectid and ->root_key.objectid.
>
> They are both set to the same value in __setup_root():
> static void __setup_root(struct btrfs_root *root,
> struct btrfs_fs_info *fs_info,
> u64 objectid)
> {
> ...
> root->objectid = objectid;
> ...
> root->root_key.objectid = objecitd;
> ...
> }
> and not changed to other value after initialization.
>
> grep in btrfs directory shows both are used in many places:
> $ grep -rI "root->root_key.objectid" | wc -l
> 133
> $ grep -rI "root->objectid" | wc -l
> 55
> (4.17, inc. some noise)
>
> It is confusing to have two similar variable names and it seems
> that there is no rule about which should be used in a certain case.
>
> Since ->root_key itself is needed for tree reloc tree, let's remove
> 'objecitd' member and unify code to use ->root_key.objectid in all places.
>
> Signed-off-by: Misono Tomohiro <misono.tomohiro@xxxxxxxxxxxxxx>
Reviewed-by: David Sterba <dsterba@xxxxxxxx>
If you have further updates, please base them on top of this patch as it
looks good to me in its current form.