forked from vitalif/vitastor
Rename space_check.sectors_required to sectors_to_write
parent
9b5d8b9ad4
commit
534a4a657e
|
@ -6,7 +6,7 @@
|
||||||
blockstore_journal_check_t::blockstore_journal_check_t(blockstore_impl_t *bs)
|
blockstore_journal_check_t::blockstore_journal_check_t(blockstore_impl_t *bs)
|
||||||
{
|
{
|
||||||
this->bs = bs;
|
this->bs = bs;
|
||||||
sectors_required = 0;
|
sectors_to_write = 0;
|
||||||
next_pos = bs->journal.next_free;
|
next_pos = bs->journal.next_free;
|
||||||
next_sector = bs->journal.cur_sector;
|
next_sector = bs->journal.cur_sector;
|
||||||
first_sector = -1;
|
first_sector = -1;
|
||||||
|
@ -35,12 +35,11 @@ int blockstore_journal_check_t::check_available(blockstore_op_t *op, int entries
|
||||||
}
|
}
|
||||||
required -= fits;
|
required -= fits;
|
||||||
next_in_pos += fits * size;
|
next_in_pos += fits * size;
|
||||||
sectors_required++;
|
sectors_to_write++;
|
||||||
}
|
}
|
||||||
else if (bs->journal.sector_info[next_sector].dirty)
|
else if (bs->journal.sector_info[next_sector].dirty)
|
||||||
{
|
{
|
||||||
// sectors_required is more like "sectors to write"
|
sectors_to_write++;
|
||||||
sectors_required++;
|
|
||||||
}
|
}
|
||||||
if (required <= 0)
|
if (required <= 0)
|
||||||
{
|
{
|
||||||
|
@ -108,7 +107,7 @@ int blockstore_journal_check_t::check_available(blockstore_op_t *op, int entries
|
||||||
(bs->journal.next_free >= bs->journal.used_start
|
(bs->journal.next_free >= bs->journal.used_start
|
||||||
? bs->journal.len-bs->journal.block_size - (bs->journal.next_free-bs->journal.used_start)
|
? bs->journal.len-bs->journal.block_size - (bs->journal.next_free-bs->journal.used_start)
|
||||||
: bs->journal.used_start - bs->journal.next_free),
|
: bs->journal.used_start - bs->journal.next_free),
|
||||||
sectors_required
|
sectors_to_write
|
||||||
);
|
);
|
||||||
PRIV(op)->wait_for = WAIT_JOURNAL;
|
PRIV(op)->wait_for = WAIT_JOURNAL;
|
||||||
bs->flusher->request_trim();
|
bs->flusher->request_trim();
|
||||||
|
|
|
@ -181,7 +181,7 @@ struct blockstore_journal_check_t
|
||||||
{
|
{
|
||||||
blockstore_impl_t *bs;
|
blockstore_impl_t *bs;
|
||||||
uint64_t next_pos, next_sector, next_in_pos;
|
uint64_t next_pos, next_sector, next_in_pos;
|
||||||
int sectors_required, first_sector; // "sectors to write"
|
int sectors_to_write, first_sector;
|
||||||
bool right_dir; // writing to the end or the beginning of the ring buffer
|
bool right_dir; // writing to the end or the beginning of the ring buffer
|
||||||
|
|
||||||
blockstore_journal_check_t(blockstore_impl_t *bs);
|
blockstore_journal_check_t(blockstore_impl_t *bs);
|
||||||
|
|
|
@ -75,8 +75,8 @@ skip_ov:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// There is sufficient space. Get SQEs
|
// There is sufficient space. Get SQEs
|
||||||
struct io_uring_sqe *sqe[space_check.sectors_required];
|
struct io_uring_sqe *sqe[space_check.sectors_to_write];
|
||||||
for (i = 0; i < space_check.sectors_required; i++)
|
for (i = 0; i < space_check.sectors_to_write; i++)
|
||||||
{
|
{
|
||||||
BS_SUBMIT_GET_SQE_DECL(sqe[i]);
|
BS_SUBMIT_GET_SQE_DECL(sqe[i]);
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ skip_ov:
|
||||||
journal.crc32_last = je->crc32;
|
journal.crc32_last = je->crc32;
|
||||||
}
|
}
|
||||||
prepare_journal_sector_write(journal, journal.cur_sector, sqe[s++], cb);
|
prepare_journal_sector_write(journal, journal.cur_sector, sqe[s++], cb);
|
||||||
assert(s == space_check.sectors_required);
|
assert(s == space_check.sectors_to_write);
|
||||||
if (cur_sector == -1)
|
if (cur_sector == -1)
|
||||||
PRIV(op)->min_flushed_journal_sector = 1 + journal.cur_sector;
|
PRIV(op)->min_flushed_journal_sector = 1 + journal.cur_sector;
|
||||||
PRIV(op)->max_flushed_journal_sector = 1 + journal.cur_sector;
|
PRIV(op)->max_flushed_journal_sector = 1 + journal.cur_sector;
|
||||||
|
|
|
@ -98,8 +98,8 @@ int blockstore_impl_t::dequeue_stable(blockstore_op_t *op)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// There is sufficient space. Get SQEs
|
// There is sufficient space. Get SQEs
|
||||||
struct io_uring_sqe *sqe[space_check.sectors_required];
|
struct io_uring_sqe *sqe[space_check.sectors_to_write];
|
||||||
for (i = 0; i < space_check.sectors_required; i++)
|
for (i = 0; i < space_check.sectors_to_write; i++)
|
||||||
{
|
{
|
||||||
BS_SUBMIT_GET_SQE_DECL(sqe[i]);
|
BS_SUBMIT_GET_SQE_DECL(sqe[i]);
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ int blockstore_impl_t::dequeue_stable(blockstore_op_t *op)
|
||||||
journal.crc32_last = je->crc32;
|
journal.crc32_last = je->crc32;
|
||||||
}
|
}
|
||||||
prepare_journal_sector_write(journal, journal.cur_sector, sqe[s++], cb);
|
prepare_journal_sector_write(journal, journal.cur_sector, sqe[s++], cb);
|
||||||
assert(s == space_check.sectors_required);
|
assert(s == space_check.sectors_to_write);
|
||||||
if (cur_sector == -1)
|
if (cur_sector == -1)
|
||||||
PRIV(op)->min_flushed_journal_sector = 1 + journal.cur_sector;
|
PRIV(op)->min_flushed_journal_sector = 1 + journal.cur_sector;
|
||||||
PRIV(op)->max_flushed_journal_sector = 1 + journal.cur_sector;
|
PRIV(op)->max_flushed_journal_sector = 1 + journal.cur_sector;
|
||||||
|
|
|
@ -112,8 +112,8 @@ int blockstore_impl_t::continue_sync(blockstore_op_t *op)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// Get SQEs. Don't bother about merging, submit each journal sector as a separate request
|
// Get SQEs. Don't bother about merging, submit each journal sector as a separate request
|
||||||
struct io_uring_sqe *sqe[space_check.sectors_required];
|
struct io_uring_sqe *sqe[space_check.sectors_to_write];
|
||||||
for (int i = 0; i < space_check.sectors_required; i++)
|
for (int i = 0; i < space_check.sectors_to_write; i++)
|
||||||
{
|
{
|
||||||
BS_SUBMIT_GET_SQE_DECL(sqe[i]);
|
BS_SUBMIT_GET_SQE_DECL(sqe[i]);
|
||||||
}
|
}
|
||||||
|
@ -153,7 +153,7 @@ int blockstore_impl_t::continue_sync(blockstore_op_t *op)
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
prepare_journal_sector_write(journal, journal.cur_sector, sqe[s++], cb);
|
prepare_journal_sector_write(journal, journal.cur_sector, sqe[s++], cb);
|
||||||
assert(s == space_check.sectors_required);
|
assert(s == space_check.sectors_to_write);
|
||||||
if (cur_sector == -1)
|
if (cur_sector == -1)
|
||||||
PRIV(op)->min_flushed_journal_sector = 1 + journal.cur_sector;
|
PRIV(op)->min_flushed_journal_sector = 1 + journal.cur_sector;
|
||||||
PRIV(op)->max_flushed_journal_sector = 1 + journal.cur_sector;
|
PRIV(op)->max_flushed_journal_sector = 1 + journal.cur_sector;
|
||||||
|
|
Loading…
Reference in New Issue