summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--storage/innobase/buf/buf0flu.cc73
-rw-r--r--storage/innobase/fsp/fsp0sysspace.cc2
-rw-r--r--storage/innobase/include/os0file.h37
3 files changed, 41 insertions, 71 deletions
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 8a7dd5578ad..fd29cd9c561 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -1035,51 +1035,46 @@ page status as NORMAL. It initiates the write to the file only after
releasing the page from flush list and its associated mutex.
@param[in,out] bpage freed buffer page
@param[in] space tablespace object of the freed page */
-static void buf_flush_freed_page(buf_page_t* bpage, fil_space_t* space)
+static void buf_flush_freed_page(buf_page_t *bpage, fil_space_t *space)
{
- const page_id_t page_id(bpage->id.space(), bpage->id.page_no());
- BPageMutex* block_mutex = buf_page_get_mutex(bpage);
- const bool uncompressed = (buf_page_get_state(bpage)
- == BUF_BLOCK_FILE_PAGE);
- bool punch_hole = false;
-
- mutex_enter(&buf_pool->mutex);
- mutex_enter(block_mutex);
-
- buf_page_set_io_fix(bpage, BUF_IO_NONE);
- bpage->status = buf_page_t::NORMAL;
- buf_flush_write_complete(bpage, false);
-
- if (uncompressed) {
- rw_lock_sx_unlock_gen(&((buf_block_t*) bpage)->lock,
- BUF_IO_WRITE);
- }
-
- buf_pool->stat.n_pages_written++;
- mutex_exit(block_mutex);
- mutex_exit(&buf_pool->mutex);
-
- if (space->is_compressed()) {
+ ut_ad(buf_page_in_file(bpage));
+ const bool uncompressed= buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE;
+ BPageMutex *block_mutex= uncompressed
+ ? &reinterpret_cast<buf_block_t*>(bpage)->mutex
+ : &buf_pool->zip_mutex;
+
+ mutex_enter(&buf_pool->mutex);
+ mutex_enter(block_mutex);
+
+ buf_page_set_io_fix(bpage, BUF_IO_NONE);
+ bpage->status= buf_page_t::NORMAL;
+ buf_flush_write_complete(bpage, false);
+
+ if (uncompressed)
+ rw_lock_sx_unlock_gen(&reinterpret_cast<buf_block_t*>(bpage)->lock,
+ BUF_IO_WRITE);
+
+ buf_pool->stat.n_pages_written++;
+ mutex_exit(&buf_pool->mutex);
+ const page_id_t page_id(bpage->id);
+ const auto zip_size= bpage->zip_size();
+ mutex_exit(block_mutex);
+
+ const bool punch_hole=
#if defined(HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE) || defined(_WIN32)
- punch_hole = (space != fil_system.temp_space
- && space->is_compressed());
-
+ space->is_compressed() ||
#endif
- }
+ false;
- if (srv_immediate_scrub_data_uncompressed || punch_hole) {
- /* Zero write the page */
- ulint type = IORequest::WRITE;
- IORequest request(type, NULL);
- page_t* frame = const_cast<byte*>(field_ref_zero);
+ ut_ad(space->id == page_id.space());
+ ut_ad(space->zip_size() == zip_size);
- fil_io(request, punch_hole ? true :false,
- page_id, space->zip_size(), 0,
- space->physical_size(), frame, NULL,
- false, punch_hole);
- }
+ if (punch_hole || srv_immediate_scrub_data_uncompressed)
+ fil_io(IORequestWrite, punch_hole, page_id, zip_size, 0,
+ zip_size ? zip_size : srv_page_size,
+ const_cast<byte*>(field_ref_zero), nullptr, false, punch_hole);
- space->release_for_io();
+ space->release_for_io();
}
/********************************************************************//**
diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc
index 22da0f62391..f0dea8ebde2 100644
--- a/storage/innobase/fsp/fsp0sysspace.cc
+++ b/storage/innobase/fsp/fsp0sysspace.cc
@@ -912,6 +912,8 @@ SysTablespace::open_or_create(
if (!space) {
return DB_ERROR;
}
+ ut_ad(!space->is_compressed());
+ ut_ad(space->full_crc32());
} else {
ut_ad(!fil_system.sys_space);
ut_ad(space_id() == TRX_SYS_SPACE);
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index c22dddffe92..bfe43305146 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -212,39 +212,12 @@ public:
PUNCH_HOLE = 64,
};
- /** Default constructor */
- IORequest()
- :
- m_bpage(NULL),
- m_fil_node(NULL),
- m_type(READ)
- {
- /* No op */
- }
-
- /**
- @param[in] type Request type, can be a value that is
- ORed from the above enum */
- explicit IORequest(ulint type)
- :
- m_bpage(NULL),
- m_fil_node(NULL),
- m_type(static_cast<uint16_t>(type))
- {
- if (!is_punch_hole_supported()) {
- clear_punch_hole();
- }
- }
-
/**
@param[in] type Request type, can be a value that is
ORed from the above enum
@param[in] bpage Page to be written */
- IORequest(ulint type, buf_page_t* bpage)
- :
- m_bpage(bpage),
- m_fil_node(NULL),
- m_type(static_cast<uint16_t>(type))
+ IORequest(ulint type= READ, buf_page_t *bpage= nullptr)
+ : m_bpage(bpage), m_type(static_cast<uint16_t>(type))
{
if (bpage && buf_page_should_punch_hole(bpage)) {
set_punch_hole();
@@ -372,13 +345,13 @@ public:
private:
/** Page to be written on write operation. */
- buf_page_t* m_bpage;
+ buf_page_t* const m_bpage= nullptr;
/** File node */
- fil_node_t* m_fil_node;
+ fil_node_t* m_fil_node= nullptr;
/** Request type bit flags */
- uint16_t m_type;
+ uint16_t m_type= READ;
};
/* @} */