Re: [PATCH v2 1/2] btrfs-progs: add BTRFS_DEV_ITEMS_OBJECTID in comment in print-tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 28, 2019 at 10:27:41PM +0800, Qu Wenruo wrote:
> 
> 
> On 2019/8/28 下午10:06, Anand Jain wrote:
> > So when searching for BTRFS_DEV_ITEMS_OBJECTID, it hits, albeit it is
> > defined same as BTRFS_ROOT_TREE_OBJECTID.
> > 
> > Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
> 
> Reviewed-by: Qu Wenruo <wqu@xxxxxxxx>
> 
> > ---
> > v1->v2: Improve comment.
> > 
> >  print-tree.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/print-tree.c b/print-tree.c
> > index b31e515f8989..b1c59d776547 100644
> > --- a/print-tree.c
> > +++ b/print-tree.c
> > @@ -705,6 +705,11 @@ void print_objectid(FILE *stream, u64 objectid, u8 type)
> >  
> >  	switch (objectid) {
> >  	case BTRFS_ROOT_TREE_OBJECTID:
> > +		/*
> > +		 * BTRFS_ROOT_TREE_OBJECTID and BTRFS_DEV_ITEMS_OBJECTID are
> > +		 * defined with the same value of 1ULL, distinguish them by
> > +		 * checking the type.
> > +		 */
> 
> Oh, some bad design from the very beginning of btrfs.

No, why bad design? Objectids need to be unique inside one group, like
tree ids, but are otherwise independent and must be interpreted together
with the key type. Which is exactly what print_objectid does.



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux