From 534a4a657e373fc4f078a765678c6c8a2fa24f27 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Tue, 2 Feb 2021 01:30:23 +0300 Subject: [PATCH] Rename space_check.sectors_required to sectors_to_write --- blockstore_journal.cpp | 9 ++++----- blockstore_journal.h | 2 +- blockstore_rollback.cpp | 6 +++--- blockstore_stable.cpp | 6 +++--- blockstore_sync.cpp | 6 +++--- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/blockstore_journal.cpp b/blockstore_journal.cpp index 6819c9b2..3ac0eb04 100644 --- a/blockstore_journal.cpp +++ b/blockstore_journal.cpp @@ -6,7 +6,7 @@ blockstore_journal_check_t::blockstore_journal_check_t(blockstore_impl_t *bs) { this->bs = bs; - sectors_required = 0; + sectors_to_write = 0; next_pos = bs->journal.next_free; next_sector = bs->journal.cur_sector; first_sector = -1; @@ -35,12 +35,11 @@ int blockstore_journal_check_t::check_available(blockstore_op_t *op, int entries } required -= fits; next_in_pos += fits * size; - sectors_required++; + sectors_to_write++; } else if (bs->journal.sector_info[next_sector].dirty) { - // sectors_required is more like "sectors to write" - sectors_required++; + sectors_to_write++; } 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.len-bs->journal.block_size - (bs->journal.next_free-bs->journal.used_start) : bs->journal.used_start - bs->journal.next_free), - sectors_required + sectors_to_write ); PRIV(op)->wait_for = WAIT_JOURNAL; bs->flusher->request_trim(); diff --git a/blockstore_journal.h b/blockstore_journal.h index cfd5f210..ba0387a6 100644 --- a/blockstore_journal.h +++ b/blockstore_journal.h @@ -181,7 +181,7 @@ struct blockstore_journal_check_t { blockstore_impl_t *bs; 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 blockstore_journal_check_t(blockstore_impl_t *bs); diff --git a/blockstore_rollback.cpp b/blockstore_rollback.cpp index 1a521f4e..b0cf9eb8 100644 --- a/blockstore_rollback.cpp +++ b/blockstore_rollback.cpp @@ -75,8 +75,8 @@ skip_ov: return 0; } // There is sufficient space. Get SQEs - struct io_uring_sqe *sqe[space_check.sectors_required]; - for (i = 0; i < space_check.sectors_required; i++) + struct io_uring_sqe *sqe[space_check.sectors_to_write]; + for (i = 0; i < space_check.sectors_to_write; i++) { BS_SUBMIT_GET_SQE_DECL(sqe[i]); } @@ -101,7 +101,7 @@ skip_ov: journal.crc32_last = je->crc32; } 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) PRIV(op)->min_flushed_journal_sector = 1 + journal.cur_sector; PRIV(op)->max_flushed_journal_sector = 1 + journal.cur_sector; diff --git a/blockstore_stable.cpp b/blockstore_stable.cpp index b065603d..02071780 100644 --- a/blockstore_stable.cpp +++ b/blockstore_stable.cpp @@ -98,8 +98,8 @@ int blockstore_impl_t::dequeue_stable(blockstore_op_t *op) return 0; } // There is sufficient space. Get SQEs - struct io_uring_sqe *sqe[space_check.sectors_required]; - for (i = 0; i < space_check.sectors_required; i++) + struct io_uring_sqe *sqe[space_check.sectors_to_write]; + for (i = 0; i < space_check.sectors_to_write; 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; } 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) PRIV(op)->min_flushed_journal_sector = 1 + journal.cur_sector; PRIV(op)->max_flushed_journal_sector = 1 + journal.cur_sector; diff --git a/blockstore_sync.cpp b/blockstore_sync.cpp index 59694437..ac08ad4c 100644 --- a/blockstore_sync.cpp +++ b/blockstore_sync.cpp @@ -112,8 +112,8 @@ int blockstore_impl_t::continue_sync(blockstore_op_t *op) return 0; } // Get SQEs. Don't bother about merging, submit each journal sector as a separate request - struct io_uring_sqe *sqe[space_check.sectors_required]; - for (int i = 0; i < space_check.sectors_required; i++) + struct io_uring_sqe *sqe[space_check.sectors_to_write]; + for (int i = 0; i < space_check.sectors_to_write; i++) { BS_SUBMIT_GET_SQE_DECL(sqe[i]); } @@ -153,7 +153,7 @@ int blockstore_impl_t::continue_sync(blockstore_op_t *op) it++; } 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) PRIV(op)->min_flushed_journal_sector = 1 + journal.cur_sector; PRIV(op)->max_flushed_journal_sector = 1 + journal.cur_sector;