Btrfs-progs: refactor resolve_root() function a bit