ictx->lock.Unlock();
uint64_t left = len;
+ vector<ObjectExtent> v;
+ if (ictx->object_cacher)
+ v.reserve(end_block - start_block + 1);
+
for (uint64_t i = start_block; i <= end_block; i++) {
ictx->lock.Lock();
string oid = get_block_oid(ictx->header, i);
uint64_t block_ofs = get_block_ofs(ictx->header, off + total_write);
ictx->lock.Unlock();
uint64_t write_len = min(block_size - block_ofs, left);
+
+ if (ictx->object_cacher) {
+ v.push_back(ObjectExtent(oid, block_ofs, write_len));
+ v.back().oloc.pool = ictx->data_ctx.get_id();
+ }
+
librados::ObjectWriteOperation write_op;
if (block_ofs == 0 && write_len == block_size)
write_op.remove();
total_write += write_len;
left -= write_len;
}
+
+ if (ictx->object_cacher)
+ ictx->object_cacher->truncate_set(ictx->object_set, v);
+
return total_write;
}
if (r < 0)
return r;
+ vector<ObjectExtent> v;
+ if (ictx->object_cacher)
+ v.reserve(end_block - start_block + 1);
+
c->get();
for (uint64_t i = start_block; i <= end_block; i++) {
ictx->lock.Lock();
AioBlockCompletion *block_completion = new AioBlockCompletion(cct, c, off, len, NULL);
uint64_t write_len = min(block_size - block_ofs, left);
+
+ if (ictx->object_cacher) {
+ v.push_back(ObjectExtent(oid, block_ofs, write_len));
+ v.back().oloc.pool = ictx->data_ctx.get_id();
+ }
+
if (block_ofs == 0 && write_len == block_size)
block_completion->write_op.remove();
else if (block_ofs + write_len == block_size)
}
r = 0;
done:
+ if (ictx->object_cacher)
+ ictx->object_cacher->truncate_set(ictx->object_set, v);
+
c->finish_adding_completions();
c->put();