uint64_t b_len = length + head_pad + tail_pad;
if ((b_off % chunk_size == 0 && b_len % chunk_size == 0) &&
b->get_blob().get_ondisk_length() >= b_off + b_len &&
- b->get_blob().is_unused(b_off, b_len, min_alloc_size) &&
+ b->get_blob().is_unused(b_off, b_len) &&
b->get_blob().is_allocated(b_off, b_len)) {
dout(20) << __func__ << " write to unused 0x" << std::hex
<< b_off << "~" << b_len
dout(20) << __func__ << " lex old " << *ep << dendl;
Extent *le = o->extent_map.set_lextent(offset, b_off + head_pad, length, b,
&wctx->old_extents);
- b->dirty_blob().mark_used(le->blob_offset, le->length, min_alloc_size);
+ b->dirty_blob().mark_used(le->blob_offset, le->length);
txc->statfs_delta.stored() += le->length;
dout(20) << __func__ << " lex " << *le << dendl;
return;
<< " at " << op->extents << dendl;
Extent *le = o->extent_map.set_lextent(offset, offset - bstart, length, b,
&wctx->old_extents);
- b->dirty_blob().mark_used(le->blob_offset, le->length, min_alloc_size);
+ b->dirty_blob().mark_used(le->blob_offset, le->length);
txc->statfs_delta.stored() += le->length;
dout(20) << __func__ << " lex " << *le << dendl;
return;
if (wi.mark_unused) {
auto b_off = wi.b_off;
auto b_len = wi.bl.length();
- if (b_off)
- b->dirty_blob().add_unused(0, b_off, min_alloc_size);
- if (b_off + b_len < wi.blob_length)
+ if (b_off) {
+ b->dirty_blob().add_unused(0, b_off);
+ }
+ if (b_off + b_len < wi.blob_length) {
b->dirty_blob().add_unused(b_off + b_len,
- wi.blob_length - (b_off + b_len),
- min_alloc_size);
+ wi.blob_length - (b_off + b_len));
+ }
}
// queue io
ls.push_back(new bluestore_blob_t);
ls.back()->init_csum(CSUM_XXHASH32, 16, 65536);
ls.back()->csum_data = buffer::claim_malloc(4, strdup("abcd"));
- ls.back()->add_unused(0, 3, 4096);
- ls.back()->add_unused(8, 8, 4096);
+ ls.back()->add_unused(0, 3);
+ ls.back()->add_unused(8, 8);
ls.back()->extents.emplace_back(bluestore_pextent_t(0x40100000, 0x10000));
ls.back()->extents.emplace_back(
bluestore_pextent_t(bluestore_pextent_t::INVALID_OFFSET, 0x1000));
}
/// return true if the logical range has never been used
- bool is_unused(uint64_t offset, uint64_t length, uint64_t min_alloc_size) const {
+ bool is_unused(uint64_t offset, uint64_t length) const {
if (!has_unused()) {
return false;
}
- assert((min_alloc_size % unused.size()) == 0);
- assert(offset + length <= min_alloc_size);
- uint64_t chunk_size = min_alloc_size / unused.size();
+ uint64_t blob_len = get_logical_length();
+ assert((blob_len % unused.size()) == 0);
+ assert(offset + length <= blob_len);
+ uint64_t chunk_size = blob_len / unused.size();
uint64_t start = offset / chunk_size;
uint64_t end = ROUND_UP_TO(offset + length, chunk_size) / chunk_size;
assert(end <= unused.size());
}
/// mark a range that has never been used
- void add_unused(uint64_t offset, uint64_t length, uint64_t min_alloc_size) {
- assert((min_alloc_size % unused.size()) == 0);
- assert(offset + length <= min_alloc_size);
- uint64_t chunk_size = min_alloc_size / unused.size();
+ void add_unused(uint64_t offset, uint64_t length) {
+ uint64_t blob_len = get_logical_length();
+ assert((blob_len % unused.size()) == 0);
+ assert(offset + length <= blob_len);
+ uint64_t chunk_size = blob_len / unused.size();
uint64_t start = ROUND_UP_TO(offset, chunk_size) / chunk_size;
uint64_t end = (offset + length) / chunk_size;
assert(end <= unused.size());
}
/// indicate that a range has (now) been used.
- void mark_used(uint64_t offset, uint64_t length, uint64_t min_alloc_size) {
+ void mark_used(uint64_t offset, uint64_t length) {
if (has_unused()) {
- assert((min_alloc_size % unused.size()) == 0);
- assert(offset + length <= min_alloc_size);
- uint64_t chunk_size = min_alloc_size / unused.size();
+ uint64_t blob_len = get_logical_length();
+ assert((blob_len % unused.size()) == 0);
+ assert(offset + length <= blob_len);
+ uint64_t chunk_size = blob_len / unused.size();
uint64_t start = offset / chunk_size;
uint64_t end = ROUND_UP_TO(offset + length, chunk_size) / chunk_size;
assert(end <= unused.size());