RBD striping mapper
In the book: Chapter 37
Lab
RBD striping mapper
Set an image's object size, stripe_unit and stripe_count and an I/O's offset and length: see which rbd_data objects it touches and where.
2560objects when full
4 MiBobject_size
16 MiBobject set size
4objects touched by this I/O
blockno = ⌊off / su⌋ · stripeno = ⌊blockno / sc⌋ · stripepos = blockno % sc · objectsetno = ⌊stripeno / (os / su)⌋ · objectno = objectsetno × sc + stripepos · offset in object = (stripeno % (os / su)) × su + off % su
| 0 | 1 | 2 | 3 | |
|---|---|---|---|---|
| s0… | ||||
| s2… | ||||
| s4… | ||||
| s6… | ||||
| s8… | ||||
| s10… | ||||
| s12… | ||||
| s14… | ||||
| s16… | ||||
| s18… | ||||
| s20… | ||||
| s22… | ||||
| s24… | ||||
| s26… | ||||
| s28… | ||||
| s30… | ||||
| s32… | ||||
| s34… | ||||
| s36… | ||||
| s38… | ||||
| s40… | ||||
| s42… | ||||
| s44… | ||||
| s46… | ||||
| s48… | ||||
| s50… | ||||
| s52… | ||||
| s54… | ||||
| s56… | ||||
| s58… | ||||
| s60… | ||||
| s62… |
| Object | Offset in object | Length | buffer_extents |
|---|---|---|---|
rbd_data.10226b8b4567.0000000000000000 | 262144 | 65536 | [48576, 65536] |
rbd_data.10226b8b4567.0000000000000001 | 262144 | 65536 | [114112, 65536] |
rbd_data.10226b8b4567.0000000000000002 | 262144 | 65536 | [179648, 65536] |
rbd_data.10226b8b4567.0000000000000003 | 213568 | 103392 | [0, 48576] [245184, 54816] |
rbd create pool/img --size 10G --object-size 4M --stripe-unit 64K --stripe-count 4Follows:
src/osdc/Striper.cc :: Striper::file_to_extentsan image range to object extentsStriper.cc :: get_num_objects, get_file_offset, object_truncate_sizeobject counts and the reverse mappingsrc/librbd/ImageCtx.cc :: ImageCtx::init (format_string "%s.%016llx")the data object namesrc/include/rbd_types.h :: RBD_DATA_PREFIX "rbd_data."the name prefixsrc/test/test_striper.cc :: the upstream test vectors used by tests/simsthe vectors the tests compare against