Remove zerofill in blockstore (an old and unused artifact)
This commit is contained in:
@@ -23,14 +23,12 @@ blockstore_impl_t::blockstore_impl_t(blockstore_config_t & config, ring_loop_i *
|
||||
dsk.open_meta();
|
||||
dsk.open_journal();
|
||||
dsk.calc_lengths();
|
||||
zero_object = (uint8_t*)memalign_or_die(MEM_ALIGNMENT, dsk.data_block_size);
|
||||
}
|
||||
catch (std::exception & e)
|
||||
{
|
||||
dsk.close_all();
|
||||
throw;
|
||||
}
|
||||
memset(zero_object, 0, dsk.data_block_size);
|
||||
meta_superblock = (uint8_t*)memalign_or_die(MEM_ALIGNMENT, dsk.meta_block_size);
|
||||
memset(meta_superblock, 0, dsk.meta_block_size);
|
||||
}
|
||||
@@ -55,8 +53,6 @@ blockstore_impl_t::~blockstore_impl_t()
|
||||
free(buffer_area);
|
||||
if (meta_superblock)
|
||||
free(meta_superblock);
|
||||
if (zero_object)
|
||||
free(zero_object);
|
||||
ringloop->unregister_consumer(&ring_consumer);
|
||||
dsk.close_all();
|
||||
}
|
||||
@@ -281,7 +277,8 @@ void blockstore_impl_t::enqueue_op(blockstore_op_t *op)
|
||||
((op->opcode == BS_OP_READ || op->opcode == BS_OP_WRITE || op->opcode == BS_OP_WRITE_STABLE) && (
|
||||
op->offset >= dsk.data_block_size ||
|
||||
op->len > dsk.data_block_size-op->offset ||
|
||||
(op->len % dsk.disk_alignment)
|
||||
(op->offset % dsk.bitmap_granularity) ||
|
||||
(op->len % dsk.bitmap_granularity)
|
||||
)) ||
|
||||
readonly && op->opcode != BS_OP_READ && op->opcode != BS_OP_LIST)
|
||||
{
|
||||
|
||||
@@ -58,7 +58,6 @@ struct blockstore_op_private_t
|
||||
int stab_pos;
|
||||
|
||||
// Write
|
||||
struct iovec iov_zerofill[3];
|
||||
timespec tv_begin;
|
||||
};
|
||||
|
||||
@@ -111,7 +110,6 @@ public:
|
||||
std::vector<blockstore_op_t*> submit_queue;
|
||||
int unsynced_data_write_count = 0, unsynced_buffer_write_count = 0, unsynced_meta_write_count = 0;
|
||||
int unsynced_queued_ops = 0;
|
||||
uint8_t *zero_object = NULL;
|
||||
|
||||
std::vector<uint32_t> pending_modified_blocks;
|
||||
robin_hood::unordered_flat_map<uint32_t, bs_modified_block_t> modified_blocks;
|
||||
@@ -226,6 +224,6 @@ public:
|
||||
inline uint32_t get_block_size() { return dsk.data_block_size; }
|
||||
inline uint64_t get_block_count() { return dsk.block_count; }
|
||||
uint64_t get_free_block_count();
|
||||
inline uint32_t get_bitmap_granularity() { return dsk.disk_alignment; }
|
||||
inline uint32_t get_bitmap_granularity() { return dsk.bitmap_granularity; }
|
||||
inline uint64_t get_journal_size() { return dsk.journal_len; }
|
||||
};
|
||||
|
||||
@@ -174,25 +174,9 @@ enospc:
|
||||
heap->use_data(op->oid.inode, PRIV(op)->location);
|
||||
io_uring_sqe *sqe = get_sqe();
|
||||
ring_data_t *data = ((ring_data_t*)sqe->user_data);
|
||||
uint64_t stripe_offset = (op->offset % dsk.bitmap_granularity);
|
||||
uint64_t stripe_end = (op->offset + op->len) % dsk.bitmap_granularity;
|
||||
// Zero fill up to dsk.bitmap_granularity
|
||||
int vcnt = 0;
|
||||
if (stripe_offset)
|
||||
{
|
||||
PRIV(op)->iov_zerofill[vcnt++] = (struct iovec){ zero_object, (size_t)stripe_offset };
|
||||
}
|
||||
PRIV(op)->iov_zerofill[vcnt++] = (struct iovec){ op->buf, op->len };
|
||||
if (stripe_end)
|
||||
{
|
||||
stripe_end = dsk.bitmap_granularity - stripe_end;
|
||||
PRIV(op)->iov_zerofill[vcnt++] = (struct iovec){ zero_object, (size_t)stripe_end };
|
||||
}
|
||||
data->iov.iov_len = op->len + stripe_offset + stripe_end; // to check it in the callback
|
||||
data->iov = (struct iovec){ op->buf, op->len };
|
||||
data->callback = [this, op](ring_data_t *data) { handle_write_event(data, op); };
|
||||
io_uring_prep_writev(
|
||||
sqe, dsk.data_fd, PRIV(op)->iov_zerofill, vcnt, dsk.data_offset + loc + op->offset - stripe_offset
|
||||
);
|
||||
io_uring_prep_writev(sqe, dsk.data_fd, &data->iov, 1, dsk.data_offset + loc + op->offset);
|
||||
PRIV(op)->pending_ops++;
|
||||
PRIV(op)->op_state = 1;
|
||||
write_iodepth++;
|
||||
|
||||
Reference in New Issue
Block a user