The Comprehensive Ceph Guide
فارسیGet started

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
object set 0 · objects 0…3 · 2 stripes per row
0123
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…
ObjectOffset in objectLengthbuffer_extents
rbd_data.10226b8b4567.000000000000000026214465536[48576, 65536]
rbd_data.10226b8b4567.000000000000000126214465536[114112, 65536]
rbd_data.10226b8b4567.000000000000000226214465536[179648, 65536]
rbd_data.10226b8b4567.0000000000000003213568103392[0, 48576] [245184, 54816]
rbd create pool/img --size 10G --object-size 4M --stripe-unit 64K --stripe-count 4

Follows:

  • src/osdc/Striper.cc :: Striper::file_to_extents an image range to object extents
  • Striper.cc :: get_num_objects, get_file_offset, object_truncate_size object counts and the reverse mapping
  • src/librbd/ImageCtx.cc :: ImageCtx::init (format_string "%s.%016llx") the data object name
  • src/include/rbd_types.h :: RBD_DATA_PREFIX "rbd_data." the name prefix
  • src/test/test_striper.cc :: the upstream test vectors used by tests/sims the vectors the tests compare against
A fixed snapshot of the simulator; the interactive version is in the web edition's lab. Interactive lab: RBD striping mapper