2019-12-26 14:06:03 +03:00
|
|
|
void slice()
|
|
|
|
{
|
|
|
|
// Slice the request into blockstore requests to individual objects
|
|
|
|
// Primary OSD still operates individual stripes, except they're twice the size of the blockstore's stripe.
|
|
|
|
std::vector read_parts;
|
|
|
|
int block = bs->get_block_size();
|
2020-02-23 19:03:06 +03:00
|
|
|
uint64_t stripe1 = cur_op->req.rw.offset / block / 2;
|
|
|
|
uint64_t stripe2 = (cur_op->req.rw.offset + cur_op->req.rw.len + block*2 - 1) / block / 2 - 1;
|
2019-12-26 14:06:03 +03:00
|
|
|
for (uint64_t s = stripe1; s <= stripe2; s++)
|
|
|
|
{
|
2020-02-23 19:03:06 +03:00
|
|
|
uint64_t start = s == stripe1 ? cur_op->req.rw.offset - stripe1*block*2 : 0;
|
|
|
|
uint64_t end = s == stripe2 ? cur_op->req.rw.offset + cur_op->req.rw.len - stripe2*block*2 : block*2;
|
2019-12-26 14:06:03 +03:00
|
|
|
if (start < block)
|
|
|
|
{
|
|
|
|
read_parts.push_back({
|
|
|
|
.role = 1,
|
|
|
|
.oid = {
|
2020-02-23 19:03:06 +03:00
|
|
|
.inode = cur_op->req.rw.inode,
|
2019-12-26 14:06:03 +03:00
|
|
|
.stripe = (s << STRIPE_ROLE_BITS) | 1,
|
|
|
|
},
|
|
|
|
.version = UINT64_MAX,
|
|
|
|
.offset = start,
|
|
|
|
.len = (block < end ? block : end) - start,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if (end > block)
|
|
|
|
{
|
|
|
|
read_parts.push_back({
|
|
|
|
.role = 2,
|
|
|
|
.oid = {
|
2020-02-23 19:03:06 +03:00
|
|
|
.inode = cur_op->req.rw.inode,
|
2019-12-26 14:06:03 +03:00
|
|
|
.stripe = (s << STRIPE_ROLE_BITS) | 2,
|
|
|
|
},
|
|
|
|
.version = UINT64_MAX,
|
|
|
|
.offset = (start > block ? start-block : 0),
|
|
|
|
.len = end - (start > block ? start-block : 0),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|