Skip to content

Commit 6217a62

Browse files
authored
Merge pull request ceph#51933 from aclamk/wip-aclamk-bs-onode-doc
os/bluestore: Some in-code documentation for Onode / blob
2 parents 7f26596 + 1df3806 commit 6217a62

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

src/os/bluestore/BlueStore.cc

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3642,6 +3642,54 @@ BlueStore::BlobRef BlueStore::ExtentMap::split_blob(
36423642
}
36433643

36443644
// Onode
3645+
//
3646+
// Mapping blobs over Onode's logical offsets.
3647+
//
3648+
// Blob is always continous. Blobs may overlap.
3649+
// Non-mapped regions are "0" when read.
3650+
// 1 2 3
3651+
// 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
3652+
// <blob.a.blob.a><blob.b.blo> <blob.c.blob.c.blob.c.blob>
3653+
// <blob.d.blob.d.b> <blob.e.blob.e>
3654+
// blob.a starts at 0x0 length 0xe
3655+
// blob.b starts at 0xf length 0xb
3656+
// blob.c starts at 0x23 length 0x1b
3657+
// blob.d starts at 0x06 length 0x12
3658+
// blob.e starts at 0x2d length 0xf
3659+
//
3660+
// Blobs can have non-encoded parts:
3661+
// 1 2 3
3662+
// 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
3663+
// aaaaaa......aaabbbbb...bbbb ccccccccccccccc..........cc
3664+
// dddddd........ddd .....eeeeeeeeee
3665+
// "." - non-encoded parts of blob (holes)
3666+
//
3667+
// Mapping logical to blob:
3668+
// extent_map maps {Onode's logical offset, length}=>{Blob, in-blob offset}
3669+
// {0x0, 0x6}=>{blob.a, 0x0}
3670+
// {0x6, 0x6}=>{blob.d, 0x0}
3671+
// {0xc, 0x3}=>{blob.a, 0xc}
3672+
// {0xf, 0x5}=>{blob.b, 0x0}
3673+
// {0x14, 0x3}=>{blob.d, 0xe}
3674+
// {0x17, 0x4}=>{blob.b, 0x8}
3675+
// a hole here
3676+
// {0x23, 0xe}=>{blob.c, 0x0}
3677+
// and so on...
3678+
//
3679+
// Compressed blobs do not have non-encoded parts.
3680+
// Same example as above but all blobs are compressed:
3681+
// 1 2 3
3682+
// 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
3683+
// aaaaaaAAAAAAaaabbbbbBBBbbbb cccccccccccccccCCCCCCCCCCcc
3684+
// ddddddDDDDDDDDddd EEEEEeeeeeeeeee
3685+
// A-E: parts of blobs that are never used.
3686+
// This can happen when a compressed blob is overwritten partially.
3687+
// The target ranges are no longer used, but are left there because they are necessary
3688+
// for successful decompression.
3689+
//
3690+
// In compressed blobs PExtentVector and csum refer to actually occupied disk space.
3691+
// Blob's logical length is larger then occupied disk space.
3692+
// Mapping from extent_map always uses offsets of decompressed data.
36453693

36463694
#undef dout_prefix
36473695
#define dout_prefix *_dout << "bluestore.onode(" << this << ")." << __func__ << " "

0 commit comments

Comments
 (0)