Fix bitmap calculation for EC N+1 & the new store and EC N+2+ for the old store
This commit is contained in:
+24
-4
@@ -21,16 +21,31 @@ extern "C" {
|
||||
|
||||
static inline void extend_read(uint32_t start, uint32_t end, osd_rmw_stripe_t & stripe)
|
||||
{
|
||||
if (stripe.read_end == 0)
|
||||
if (end == UINT32_MAX)
|
||||
{
|
||||
// UINT32_MAX means that the stripe only needs bitmap
|
||||
if (!stripe.read_end)
|
||||
{
|
||||
stripe.read_start = 0;
|
||||
stripe.read_end = UINT32_MAX;
|
||||
}
|
||||
}
|
||||
else if (stripe.read_end == UINT32_MAX)
|
||||
{
|
||||
if (end > 0)
|
||||
{
|
||||
stripe.read_start = start;
|
||||
stripe.read_end = end;
|
||||
}
|
||||
}
|
||||
else if (stripe.read_end == 0)
|
||||
{
|
||||
stripe.read_start = start;
|
||||
stripe.read_end = end;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stripe.read_end < end && end != UINT32_MAX ||
|
||||
// UINT32_MAX means that stripe only needs bitmap, end != 0 => needs also data
|
||||
stripe.read_end == UINT32_MAX && end != 0)
|
||||
if (stripe.read_end < end)
|
||||
stripe.read_end = end;
|
||||
if (stripe.read_start > start)
|
||||
stripe.read_start = start;
|
||||
@@ -664,6 +679,11 @@ void* calc_rmw(void *request_buf, osd_rmw_stripe_t *stripes, uint64_t *read_osd_
|
||||
for (int role = 0; role < pg_minsize; role++)
|
||||
{
|
||||
cover_read(start, end, stripes[role]);
|
||||
if (!stripes[role].read_end && (stripes[role].req_start != 0 || stripes[role].req_end != chunk_size))
|
||||
{
|
||||
// Read bitmaps even if we don't need data but it's not fully overwritten
|
||||
stripes[role].read_end = UINT32_MAX;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (write_osd_set != read_osd_set)
|
||||
|
||||
@@ -897,7 +897,7 @@ void test14()
|
||||
15. EC 2+2 partial overwrite with 1 missing stripe
|
||||
calc_rmw(offset=64K+28K, len=4K, osd_set=[1,2,3,0], write_set=[1,2,3,0])
|
||||
= {
|
||||
read: [ [ 28K, 32K ], [ 0, 0 ], [ 0, 0 ], [ 0, 0 ] ],
|
||||
read: [ [ 28K, 32K ], [ 0, -1 (BITMAP ONLY) ], [ 0, 0 ], [ 0, 0 ] ],
|
||||
write: [ [ 0, 0 ], [ 28K, 32K ], [ 28K, 32K ], [ 0, 0 ] ],
|
||||
input buffer: [ write1 ],
|
||||
rmw buffer: [ write2, read0 ],
|
||||
@@ -925,7 +925,7 @@ void test15(bool second)
|
||||
stripes[i].bmp_buf = bitmaps+i;
|
||||
assert(rmw_buf);
|
||||
assert(stripes[0].read_start == 28*1024 && stripes[0].read_end == 32*1024);
|
||||
assert(stripes[1].read_start == 0 && stripes[1].read_end == 0);
|
||||
assert(stripes[1].read_start == 0 && stripes[1].read_end == UINT32_MAX);
|
||||
assert(stripes[2].read_start == 0 && stripes[2].read_end == 0);
|
||||
assert(stripes[3].read_start == 0 && stripes[3].read_end == 0);
|
||||
assert(stripes[0].write_start == 0 && stripes[0].write_end == 0);
|
||||
|
||||
Reference in New Issue
Block a user