Extract (flags & BS_HEAP_TYPE) into a function
This commit is contained in:
@@ -484,7 +484,7 @@ int journal_flusher_co::check_and_punch_checksums()
|
||||
assert(wr);
|
||||
uint32_t *csums = (uint32_t*)(wr->get_checksums(bs->heap)
|
||||
+ (vec.offset/bs->dsk.csum_block_size)*(bs->dsk.data_csum_type & 0xFF)
|
||||
- (((wr->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE) ? 0 : (wr->offset/bs->dsk.csum_block_size)*(bs->dsk.data_csum_type & 0xFF)));
|
||||
- ((wr->type() == BS_HEAP_BIG_WRITE) ? 0 : (wr->offset/bs->dsk.csum_block_size)*(bs->dsk.data_csum_type & 0xFF)));
|
||||
bs->heap->calc_block_checksums(
|
||||
csums, vec.buf, wr->get_int_bitmap(bs->heap), vec.offset, vec.offset+vec.len, false,
|
||||
[&](uint32_t mismatch_pos, uint32_t expected_csum, uint32_t real_csum)
|
||||
|
||||
@@ -23,10 +23,10 @@ heap_write_t *heap_write_t::next()
|
||||
uint32_t heap_write_t::get_size(blockstore_heap_t *heap)
|
||||
{
|
||||
return (sizeof(heap_write_t) +
|
||||
((flags & BS_HEAP_TYPE) != BS_HEAP_TOMBSTONE
|
||||
(type() != BS_HEAP_TOMBSTONE
|
||||
? heap->dsk->clean_entry_bitmap_size
|
||||
: 0) +
|
||||
((flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE
|
||||
(type() == BS_HEAP_BIG_WRITE
|
||||
? heap->dsk->clean_entry_bitmap_size
|
||||
: 0) +
|
||||
get_csum_size(heap));
|
||||
@@ -36,13 +36,13 @@ uint32_t heap_write_t::get_csum_size(blockstore_heap_t *heap)
|
||||
{
|
||||
if (!heap->dsk->csum_block_size)
|
||||
{
|
||||
return ((flags & BS_HEAP_TYPE) == BS_HEAP_SMALL_WRITE || (flags & BS_HEAP_TYPE) == BS_HEAP_INTENT_WRITE ? 4 : 0);
|
||||
return (type() == BS_HEAP_SMALL_WRITE || type() == BS_HEAP_INTENT_WRITE ? 4 : 0);
|
||||
}
|
||||
if ((flags & BS_HEAP_TYPE) == BS_HEAP_TOMBSTONE)
|
||||
if (type() == BS_HEAP_TOMBSTONE)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if ((flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE)
|
||||
if (type() == BS_HEAP_BIG_WRITE)
|
||||
{
|
||||
// We always store full checksums for "big" entries to prevent ENOSPC on compaction
|
||||
// when (big_write+small_write) are smaller than (compacted big_write)
|
||||
@@ -56,8 +56,7 @@ uint32_t heap_write_t::get_csum_size(blockstore_heap_t *heap)
|
||||
bool heap_write_t::needs_recheck(blockstore_heap_t *heap)
|
||||
{
|
||||
return len > 0 && lsn > heap->compacted_lsn &&
|
||||
((flags & BS_HEAP_TYPE) == BS_HEAP_SMALL_WRITE ||
|
||||
(flags & BS_HEAP_TYPE) == BS_HEAP_INTENT_WRITE);
|
||||
(type() == BS_HEAP_SMALL_WRITE || type() == BS_HEAP_INTENT_WRITE);
|
||||
}
|
||||
|
||||
bool heap_write_t::needs_compact(blockstore_heap_t *heap)
|
||||
@@ -87,14 +86,14 @@ bool heap_write_t::is_allowed_before_compacted(uint64_t compacted_lsn, bool is_l
|
||||
|
||||
uint8_t *heap_write_t::get_ext_bitmap(blockstore_heap_t *heap)
|
||||
{
|
||||
if ((flags & BS_HEAP_TYPE) == BS_HEAP_TOMBSTONE)
|
||||
if (type() == BS_HEAP_TOMBSTONE)
|
||||
return NULL;
|
||||
return ((uint8_t*)this + sizeof(heap_write_t));
|
||||
}
|
||||
|
||||
uint8_t *heap_write_t::get_int_bitmap(blockstore_heap_t *heap)
|
||||
{
|
||||
if ((flags & BS_HEAP_TYPE) != BS_HEAP_BIG_WRITE)
|
||||
if (type() != BS_HEAP_BIG_WRITE)
|
||||
return NULL;
|
||||
return ((uint8_t*)this + sizeof(heap_write_t) + heap->dsk->clean_entry_bitmap_size);
|
||||
}
|
||||
@@ -103,10 +102,10 @@ uint8_t *heap_write_t::get_checksums(blockstore_heap_t *heap)
|
||||
{
|
||||
if (!heap->dsk->csum_block_size)
|
||||
return NULL;
|
||||
if (len && ((flags & BS_HEAP_TYPE) == BS_HEAP_SMALL_WRITE ||
|
||||
(flags & BS_HEAP_TYPE) == BS_HEAP_INTENT_WRITE))
|
||||
if (len && (type() == BS_HEAP_SMALL_WRITE ||
|
||||
type() == BS_HEAP_INTENT_WRITE))
|
||||
return ((uint8_t*)this + sizeof(heap_write_t) + heap->dsk->clean_entry_bitmap_size);
|
||||
if ((flags & BS_HEAP_TYPE) != BS_HEAP_BIG_WRITE)
|
||||
if (type() != BS_HEAP_BIG_WRITE)
|
||||
return NULL;
|
||||
return ((uint8_t*)this + sizeof(heap_write_t) + 2*heap->dsk->clean_entry_bitmap_size);
|
||||
}
|
||||
@@ -114,7 +113,7 @@ uint8_t *heap_write_t::get_checksums(blockstore_heap_t *heap)
|
||||
uint32_t *heap_write_t::get_checksum(blockstore_heap_t *heap)
|
||||
{
|
||||
if (heap->dsk->csum_block_size || !len ||
|
||||
(flags & BS_HEAP_TYPE) != BS_HEAP_SMALL_WRITE && (flags & BS_HEAP_TYPE) != BS_HEAP_INTENT_WRITE)
|
||||
type() != BS_HEAP_SMALL_WRITE && type() != BS_HEAP_INTENT_WRITE)
|
||||
return NULL;
|
||||
return (uint32_t*)((uint8_t*)this + sizeof(heap_write_t) + heap->dsk->clean_entry_bitmap_size);
|
||||
}
|
||||
@@ -404,14 +403,14 @@ skip_object:
|
||||
to_compact = true;
|
||||
continue;
|
||||
}
|
||||
if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_SMALL_WRITE &&
|
||||
if (wr->type() == BS_HEAP_SMALL_WRITE &&
|
||||
!is_buffer_area_free(wr->location, wr->len))
|
||||
{
|
||||
fprintf(stderr, "Notice: write %jx:%jx v%lu (l%lu) buffered data overlaps with other writes, skipping object\n",
|
||||
obj->inode, obj->stripe, wr->version, wr->lsn);
|
||||
goto skip_object;
|
||||
}
|
||||
if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE &&
|
||||
if (wr->type() == BS_HEAP_BIG_WRITE &&
|
||||
is_data_used(wr->location))
|
||||
{
|
||||
fprintf(stderr, "Notice: write %jx:%jx v%lu (l%lu) data overlaps with other writes, skipping object\n",
|
||||
@@ -420,7 +419,7 @@ skip_object:
|
||||
}
|
||||
if (wr->needs_recheck(this))
|
||||
{
|
||||
if (!buffer_area || (wr->flags & BS_HEAP_TYPE) == BS_HEAP_INTENT_WRITE)
|
||||
if (!buffer_area || wr->type() == BS_HEAP_INTENT_WRITE)
|
||||
{
|
||||
to_recheck = true;
|
||||
}
|
||||
@@ -428,8 +427,8 @@ skip_object:
|
||||
else if (!calc_checksums(wr, buffer_area + wr->location, false))
|
||||
{
|
||||
// entry is invalid (not fully written before OSD crash) - remove it and all newer (previous) entries too
|
||||
if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_INTENT_WRITE &&
|
||||
wr->next() && (wr->next()->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE &&
|
||||
if (wr->type() == BS_HEAP_INTENT_WRITE &&
|
||||
wr->next() && wr->next()->type() == BS_HEAP_BIG_WRITE &&
|
||||
wr->next()->version == wr->version)
|
||||
{
|
||||
// BIG_WRITE+INTENT_WRITE pair
|
||||
@@ -469,11 +468,11 @@ skip_object:
|
||||
for (auto wr = obj->get_writes(); wr; wr = wr->next())
|
||||
{
|
||||
used_space += wr->size;
|
||||
if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_SMALL_WRITE)
|
||||
if (wr->type() == BS_HEAP_SMALL_WRITE)
|
||||
{
|
||||
use_buffer_area(obj->inode, wr->location, wr->len);
|
||||
}
|
||||
else if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE)
|
||||
else if (wr->type() == BS_HEAP_BIG_WRITE)
|
||||
{
|
||||
// Mark data block as used
|
||||
use_data(obj->inode, wr->location);
|
||||
@@ -553,8 +552,8 @@ bool blockstore_heap_t::calc_checksums(heap_write_t *wr, uint8_t *data, bool set
|
||||
{
|
||||
if (!dsk->csum_block_size)
|
||||
{
|
||||
if ((wr->flags & BS_HEAP_TYPE) != BS_HEAP_SMALL_WRITE &&
|
||||
(wr->flags & BS_HEAP_TYPE) != BS_HEAP_INTENT_WRITE)
|
||||
if (wr->type() != BS_HEAP_SMALL_WRITE &&
|
||||
wr->type() != BS_HEAP_INTENT_WRITE)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -568,7 +567,7 @@ bool blockstore_heap_t::calc_checksums(heap_write_t *wr, uint8_t *data, bool set
|
||||
}
|
||||
return ((*wr_csum) == real_csum);
|
||||
}
|
||||
uint32_t offset = ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE
|
||||
uint32_t offset = (wr->type() == BS_HEAP_BIG_WRITE
|
||||
? (wr->offset / dsk->csum_block_size) * (dsk->data_csum_type & 0xFF) : 0);
|
||||
return calc_block_checksums((uint32_t*)(wr->get_checksums(this) + offset), data, wr->get_int_bitmap(this),
|
||||
wr->offset, wr->offset+wr->len, set, NULL);
|
||||
@@ -681,7 +680,7 @@ bool blockstore_heap_t::recheck_small_writes(std::function<void(bool is_data, ui
|
||||
{
|
||||
if (wr->needs_recheck(this))
|
||||
{
|
||||
bool is_intent = (wr->flags & BS_HEAP_TYPE) == BS_HEAP_INTENT_WRITE;
|
||||
bool is_intent = wr->type() == BS_HEAP_INTENT_WRITE;
|
||||
uint64_t loc = wr->location;
|
||||
if (is_intent)
|
||||
{
|
||||
@@ -709,8 +708,8 @@ bool blockstore_heap_t::recheck_small_writes(std::function<void(bool is_data, ui
|
||||
}
|
||||
if (wr && !calc_checksums(wr, buf, false))
|
||||
{
|
||||
if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_INTENT_WRITE &&
|
||||
wr->next() && (wr->next()->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE &&
|
||||
if (wr->type() == BS_HEAP_INTENT_WRITE &&
|
||||
wr->next() && wr->next()->type() == BS_HEAP_BIG_WRITE &&
|
||||
wr->next()->version == wr->version)
|
||||
{
|
||||
// BIG_WRITE+INTENT_WRITE pair
|
||||
@@ -957,7 +956,7 @@ uint32_t blockstore_heap_t::compact_object_to(heap_object_t *obj, uint64_t compa
|
||||
if (compacted_wr_count)
|
||||
{
|
||||
bool is_last = !wr->next();
|
||||
if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE)
|
||||
if (wr->type() == BS_HEAP_BIG_WRITE)
|
||||
{
|
||||
big_wr = wr;
|
||||
}
|
||||
@@ -1167,8 +1166,8 @@ uint32_t blockstore_heap_t::find_block_space(uint32_t block_num, uint32_t space)
|
||||
int blockstore_heap_t::add_object(object_id oid, heap_write_t *wr, uint32_t *modified_block)
|
||||
{
|
||||
// By now, initial small_writes are not allowed
|
||||
if ((wr->flags & BS_HEAP_TYPE) != BS_HEAP_BIG_WRITE &&
|
||||
(wr->flags & BS_HEAP_TYPE) != BS_HEAP_TOMBSTONE)
|
||||
if (wr->type() != BS_HEAP_BIG_WRITE &&
|
||||
wr->type() != BS_HEAP_TOMBSTONE)
|
||||
{
|
||||
return EINVAL;
|
||||
}
|
||||
@@ -1279,7 +1278,7 @@ bool blockstore_heap_t::mvcc_save_copy(heap_object_t *obj)
|
||||
}
|
||||
for (auto wr = obj->get_writes(); wr; wr = wr->next())
|
||||
{
|
||||
if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE)
|
||||
if (wr->type() == BS_HEAP_BIG_WRITE)
|
||||
{
|
||||
mvcc_data_refs[wr->location] += add_ref;
|
||||
if (wr->flags & BS_HEAP_STABLE)
|
||||
@@ -1291,7 +1290,7 @@ bool blockstore_heap_t::mvcc_save_copy(heap_object_t *obj)
|
||||
add_ref = 1;
|
||||
}
|
||||
}
|
||||
else if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_SMALL_WRITE)
|
||||
else if (wr->type() == BS_HEAP_SMALL_WRITE)
|
||||
{
|
||||
mvcc_buffer_refs[wr->location] += add_ref;
|
||||
}
|
||||
@@ -1308,12 +1307,12 @@ void blockstore_heap_t::mark_overwritten(uint64_t over_lsn, uint64_t inode, heap
|
||||
{
|
||||
mark_lsn_compacted(wr->lsn, true);
|
||||
}
|
||||
if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE)
|
||||
if (wr->type() == BS_HEAP_BIG_WRITE)
|
||||
{
|
||||
overwrite_ref_queue.push_back((heap_refqi_t){ .lsn = over_lsn, .inode = inode, .location = wr->location, .len = 0, .is_data = true });
|
||||
mvcc_data_refs[wr->location] += !tracking_active;
|
||||
}
|
||||
else if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_SMALL_WRITE && wr->size > 0)
|
||||
else if (wr->type() == BS_HEAP_SMALL_WRITE && wr->size > 0)
|
||||
{
|
||||
overwrite_ref_queue.push_back((heap_refqi_t){ .lsn = over_lsn, .inode = inode, .location = wr->location, .len = wr->len, .is_data = false });
|
||||
mvcc_buffer_refs[wr->location] += !tracking_active;
|
||||
@@ -1335,7 +1334,7 @@ int blockstore_heap_t::update_object(uint32_t block_num, heap_object_t *obj, hea
|
||||
return ENOSPC;
|
||||
}
|
||||
auto first_wr = obj->get_writes();
|
||||
if ((first_wr->flags & BS_HEAP_TYPE) == BS_HEAP_TOMBSTONE && !is_overwrite)
|
||||
if (first_wr->type() == BS_HEAP_TOMBSTONE && !is_overwrite)
|
||||
{
|
||||
// Small overwrites are only allowed over live objects
|
||||
return EINVAL;
|
||||
@@ -1350,8 +1349,8 @@ int blockstore_heap_t::update_object(uint32_t block_num, heap_object_t *obj, hea
|
||||
// Unstable intent writes over stable are not allowed
|
||||
return EINVAL;
|
||||
}
|
||||
if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_INTENT_WRITE &&
|
||||
(first_wr->flags & BS_HEAP_TYPE) == BS_HEAP_INTENT_WRITE &&
|
||||
if (wr->type() == BS_HEAP_INTENT_WRITE &&
|
||||
first_wr->type() == BS_HEAP_INTENT_WRITE &&
|
||||
!first_wr->can_be_collapsed(this))
|
||||
{
|
||||
// Intent writes are not allowed over noncollapsible intent writes
|
||||
@@ -1371,11 +1370,11 @@ int blockstore_heap_t::update_object(uint32_t block_num, heap_object_t *obj, hea
|
||||
if (tracking_active)
|
||||
{
|
||||
// MVCC reference tracking is in action for the object, increase the refcount
|
||||
if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE)
|
||||
if (wr->type() == BS_HEAP_BIG_WRITE)
|
||||
{
|
||||
mvcc_data_refs[wr->location]++;
|
||||
}
|
||||
else if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_SMALL_WRITE)
|
||||
else if (wr->type() == BS_HEAP_SMALL_WRITE)
|
||||
{
|
||||
mvcc_buffer_refs[wr->location]++;
|
||||
}
|
||||
@@ -1400,7 +1399,7 @@ int blockstore_heap_t::update_object(uint32_t block_num, heap_object_t *obj, hea
|
||||
used_delta -= free_writes(first_wr, NULL);
|
||||
new_wr->next_pos = 0;
|
||||
}
|
||||
else if ((first_wr->flags & BS_HEAP_TYPE) == BS_HEAP_INTENT_WRITE &&
|
||||
else if (first_wr->type() == BS_HEAP_INTENT_WRITE &&
|
||||
first_wr->can_be_collapsed(this))
|
||||
{
|
||||
auto second_wr = first_wr->next();
|
||||
@@ -1482,8 +1481,8 @@ int blockstore_heap_t::post_stabilize(object_id oid, uint64_t version, uint32_t
|
||||
stab_count++;
|
||||
unstable_wr = wr;
|
||||
if (!unstable_big_wr &&
|
||||
((wr->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE ||
|
||||
(wr->flags & BS_HEAP_TYPE) == BS_HEAP_TOMBSTONE))
|
||||
(wr->type() == BS_HEAP_BIG_WRITE ||
|
||||
wr->type() == BS_HEAP_TOMBSTONE))
|
||||
{
|
||||
unstable_big_wr = wr;
|
||||
}
|
||||
@@ -1733,7 +1732,7 @@ void blockstore_heap_t::free_object_space(inode_t inode, heap_write_t *from, hea
|
||||
{
|
||||
for (heap_write_t *wr = from; wr && wr != to; wr = wr->next())
|
||||
{
|
||||
if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE)
|
||||
if (wr->type() == BS_HEAP_BIG_WRITE)
|
||||
{
|
||||
deref_data(inode, wr->location, mode != BS_HEAP_FREE_MAIN);
|
||||
if (mode == BS_HEAP_FREE_MVCC && (wr->flags & BS_HEAP_STABLE))
|
||||
@@ -1742,7 +1741,7 @@ void blockstore_heap_t::free_object_space(inode_t inode, heap_write_t *from, hea
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_SMALL_WRITE)
|
||||
else if (wr->type() == BS_HEAP_SMALL_WRITE)
|
||||
{
|
||||
deref_buffer(inode, wr->location, wr->len, mode != BS_HEAP_FREE_MAIN);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ struct __attribute__((__packed__)) heap_write_t
|
||||
// uint32_t[] checksums
|
||||
|
||||
heap_write_t *next();
|
||||
inline uint8_t type() const { return (flags & BS_HEAP_TYPE); }
|
||||
uint32_t get_size(blockstore_heap_t *heap);
|
||||
uint32_t get_csum_size(blockstore_heap_t *heap);
|
||||
bool needs_recheck(blockstore_heap_t *heap);
|
||||
|
||||
@@ -35,8 +35,8 @@ int blockstore_impl_t::dequeue_read(blockstore_op_t *op)
|
||||
}
|
||||
fulfilled += prepare_read(PRIV(op)->read_vec, obj, wr, op->offset, op->offset+op->len);
|
||||
if (fulfilled == op->len ||
|
||||
(wr->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE ||
|
||||
(wr->flags & BS_HEAP_TYPE) == BS_HEAP_TOMBSTONE)
|
||||
wr->type() == BS_HEAP_BIG_WRITE ||
|
||||
wr->type() == BS_HEAP_TOMBSTONE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -102,11 +102,11 @@ int blockstore_impl_t::fulfill_read(blockstore_op_t *op)
|
||||
|
||||
uint32_t blockstore_impl_t::prepare_read(std::vector<copy_buffer_t> & read_vec, heap_object_t *obj, heap_write_t *wr, uint32_t start, uint32_t end)
|
||||
{
|
||||
if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE)
|
||||
if (wr->type() == BS_HEAP_BIG_WRITE)
|
||||
{
|
||||
return prepare_read_with_bitmaps(read_vec, obj, wr, start, end);
|
||||
}
|
||||
if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_TOMBSTONE)
|
||||
if (wr->type() == BS_HEAP_TOMBSTONE)
|
||||
{
|
||||
return prepare_read_zero(read_vec, start, end);
|
||||
}
|
||||
@@ -170,7 +170,7 @@ uint32_t blockstore_impl_t::prepare_read_simple(std::vector<copy_buffer_t> & rea
|
||||
find_holes(read_vec, start, end, [&](int & pos, uint32_t start, uint32_t end)
|
||||
{
|
||||
res += end-start;
|
||||
if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_SMALL_WRITE && dsk.inmemory_journal)
|
||||
if (wr->type() == BS_HEAP_SMALL_WRITE && dsk.inmemory_journal)
|
||||
{
|
||||
// read buffered data from memory
|
||||
read_vec.insert(read_vec.begin() + (pos++), (copy_buffer_t){
|
||||
@@ -197,7 +197,7 @@ uint32_t blockstore_impl_t::prepare_read_simple(std::vector<copy_buffer_t> & rea
|
||||
blk_end = ((end-1) / dsk.csum_block_size + 1) * dsk.csum_block_size;
|
||||
blk_end = blk_end > wr->offset+wr->len ? wr->offset+wr->len : blk_end;
|
||||
uint32_t skip_csum = 0;
|
||||
if (!perfect_csum_update && (wr->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE)
|
||||
if (!perfect_csum_update && wr->type() == BS_HEAP_BIG_WRITE)
|
||||
{
|
||||
for (auto owr = obj->get_writes(); owr && owr != wr; owr = owr->next())
|
||||
if (owr->offset < blk_end && owr->offset+owr->len > blk_start)
|
||||
@@ -233,12 +233,12 @@ void blockstore_impl_t::prepare_disk_read(std::vector<copy_buffer_t> & read_vec,
|
||||
uint32_t blk_start, uint32_t blk_end, uint32_t start, uint32_t end, uint32_t copy_flags)
|
||||
{
|
||||
// Only one INTENT_WRITE is allowed at a time
|
||||
assert((wr->flags & BS_HEAP_TYPE) != BS_HEAP_INTENT_WRITE || (wr->next()->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE);
|
||||
assert(wr->type() != BS_HEAP_INTENT_WRITE || wr->next()->type() == BS_HEAP_BIG_WRITE);
|
||||
copy_buffer_t vec = {
|
||||
.copy_flags = ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_SMALL_WRITE ? COPY_BUF_JOURNAL : COPY_BUF_DATA) | copy_flags,
|
||||
.copy_flags = (wr->type() == BS_HEAP_SMALL_WRITE ? COPY_BUF_JOURNAL : COPY_BUF_DATA) | copy_flags,
|
||||
.offset = start,
|
||||
.len = end-start,
|
||||
.disk_offset = ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_INTENT_WRITE ? wr->next()->location : wr->location) + blk_start,
|
||||
.disk_offset = (wr->type() == BS_HEAP_INTENT_WRITE ? wr->next()->location : wr->location) + blk_start,
|
||||
.disk_len = blk_end - blk_start,
|
||||
.wr_lsn = wr->lsn,
|
||||
};
|
||||
@@ -359,7 +359,7 @@ bool blockstore_impl_t::verify_read_checksums(blockstore_op_t *op)
|
||||
uint8_t *buf = vec.buf ? vec.buf : (op->buf + vec.offset - op->offset);
|
||||
uint32_t *csums = (uint32_t*)(wr->get_checksums(heap)
|
||||
+ (blk_start/dsk.csum_block_size)*(dsk.data_csum_type & 0xFF)
|
||||
- (((wr->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE) ? 0 : (wr->offset/dsk.csum_block_size)*(dsk.data_csum_type & 0xFF)));
|
||||
- ((wr->type() == BS_HEAP_BIG_WRITE) ? 0 : (wr->offset/dsk.csum_block_size)*(dsk.data_csum_type & 0xFF)));
|
||||
if (!heap->calc_block_checksums(csums, buf, wr->get_int_bitmap(heap),
|
||||
blk_start, blk_end, false, [&](uint32_t mismatch_pos, uint32_t expected_csum, uint32_t real_csum)
|
||||
{
|
||||
|
||||
@@ -60,7 +60,7 @@ int blockstore_impl_t::dequeue_write(blockstore_op_t *op)
|
||||
}
|
||||
// FIXME: Allow to do initial writes as buffered, not redirected
|
||||
// FIXME: Allow to do direct writes over holes
|
||||
else if (!obj || (obj->get_writes()->flags & BS_HEAP_TYPE) == BS_HEAP_TOMBSTONE ||
|
||||
else if (!obj || obj->get_writes()->type() == BS_HEAP_TOMBSTONE ||
|
||||
op->offset == 0 && op->len == dsk.data_block_size)
|
||||
{
|
||||
// Big (redirect) write
|
||||
@@ -145,13 +145,13 @@ int blockstore_impl_t::dequeue_write(blockstore_op_t *op)
|
||||
{
|
||||
// Direct intent-write
|
||||
BS_SUBMIT_CHECK_SQES(1);
|
||||
if ((obj->get_writes()->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE)
|
||||
if (obj->get_writes()->type() == BS_HEAP_BIG_WRITE)
|
||||
{
|
||||
PRIV(op)->location = obj->get_writes()->location;
|
||||
}
|
||||
else
|
||||
{
|
||||
assert((obj->get_writes()->next()->flags & BS_HEAP_TYPE) == BS_HEAP_BIG_WRITE);
|
||||
assert(obj->get_writes()->next()->type() == BS_HEAP_BIG_WRITE);
|
||||
PRIV(op)->location = obj->get_writes()->next()->location;
|
||||
}
|
||||
process_intent:
|
||||
|
||||
Reference in New Issue
Block a user