Re: question about the data structure of crush_map

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

 



On Sun, 1 Dec 2013, Lipeng Wan wrote:
> Hi Dong,
> 
> Thanks for your reply. Then is it valid to access the memory space
> specified by that negative id?

You'll notice that every time we index the bucket array, the index is 
something like

	-1 - id

so that -1 maps to the first item, -2 to the second, etc.  This is safe 
because it's always preceded by some check that id is < 0 (i.e., a bucket 
id).

sage

> 
> L Wan
> 
> On Sun, Dec 1, 2013 at 10:31 PM, Dong Yuan <yuandong1222@xxxxxxxxx> wrote:
> > If my memory serves me well, negative id means buckets (root, room,
> > rack, cabinet, etc.), well positive means osds.
> >
> > On 2 December 2013 11:20, Lipeng Wan <lipengwan86@xxxxxxxxx> wrote:
> >> Hi guys,
> >>
> >> I am reading the source code of ceph and trying to understand the data
> >> structure of crush_map. Now I am confused by the use of "struct
> >> crush_bucket **buckets" in function "int crush_do_rule(...)" in
> >> src/crush/mapper.c. It seems that the index of array "map->buckets[]"
> >> could be negative (see line 551, src/crush/mapper.c). I was wondering
> >> if anyone could explain why the index of this array can be negative
> >> and how those buckets were added into this array. Thanks.
> >>
> >> Best,
> >> L. Wan
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> >> the body of a message to majordomo@xxxxxxxxxxxxxxx
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> >
> >
> > --
> > Dong Yuan
> > Email:yuandong1222@xxxxxxxxx
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux