From ce5cd13bc8541b732ec722a48dcde20e4ee4e37e Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Wed, 27 Nov 2019 02:33:33 +0300 Subject: [PATCH] Use fdatasync (just for testing over an FS) --- blockstore_flush.cpp | 4 ++-- blockstore_init.cpp | 2 +- blockstore_stable.cpp | 6 +++--- blockstore_sync.cpp | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/blockstore_flush.cpp b/blockstore_flush.cpp index 075dcbbf..f0bbdfe4 100644 --- a/blockstore_flush.cpp +++ b/blockstore_flush.cpp @@ -353,14 +353,14 @@ resume_0: await_sqe(9); data->callback = simple_callback; data->iov = { 0 }; - my_uring_prep_fsync(sqe, bs->data_fd, 0); + my_uring_prep_fsync(sqe, bs->data_fd, IORING_FSYNC_DATASYNC); wait_count++; if (bs->meta_fd != bs->data_fd) { await_sqe(10); data->callback = simple_callback; data->iov = { 0 }; - my_uring_prep_fsync(sqe, bs->meta_fd, 0); + my_uring_prep_fsync(sqe, bs->meta_fd, IORING_FSYNC_DATASYNC); wait_count++; } wait_state = 11; diff --git a/blockstore_init.cpp b/blockstore_init.cpp index d57d6e25..aa7a5286 100644 --- a/blockstore_init.cpp +++ b/blockstore_init.cpp @@ -206,7 +206,7 @@ resume_1: my_uring_prep_writev(sqe, bs->journal.fd, &data->iov, 1, bs->journal.offset); wait_count++; GET_SQE(); - my_uring_prep_fsync(sqe, bs->journal.fd, 0); + my_uring_prep_fsync(sqe, bs->journal.fd, IORING_FSYNC_DATASYNC); data->iov = { 0 }; data->callback = simple_callback; wait_count++; diff --git a/blockstore_stable.cpp b/blockstore_stable.cpp index 2c45e079..e6be1f70 100644 --- a/blockstore_stable.cpp +++ b/blockstore_stable.cpp @@ -7,9 +7,9 @@ // // This makes 1 4K small write+sync look like: // 512b+4K (journal) + sync + 512b (journal) + sync + 4K (data) [+ sync?] + 512b (metadata) + sync. -// WA = 2.375. It's not the best, SSD FTL-like redirect-write with defragmentation -// could probably be lower even with defragmentation. But it's fixed and it's still -// better than in Ceph. :) except for HDD-only clusters, because each write results in 3 seeks. +// WA = 2.375. It's not the best, SSD FTL-like redirect-write could probably be lower +// even with defragmentation. But it's fixed and it's still better than in Ceph. :) +// except for HDD-only clusters, because each write results in 3 seeks. // Stabilize big write: // 1) Copy metadata from the journal to the metadata device diff --git a/blockstore_sync.cpp b/blockstore_sync.cpp index d8f79330..133d1ac4 100644 --- a/blockstore_sync.cpp +++ b/blockstore_sync.cpp @@ -41,7 +41,7 @@ int blockstore::continue_sync(blockstore_operation *op) // No big writes, just fsync the journal // FIXME: Add no-fsync mode BS_SUBMIT_GET_SQE(sqe, data); - my_uring_prep_fsync(sqe, journal.fd, 0); + my_uring_prep_fsync(sqe, journal.fd, IORING_FSYNC_DATASYNC); data->iov = { 0 }; data->callback = cb; op->min_used_journal_sector = op->max_used_journal_sector = 0; @@ -53,7 +53,7 @@ int blockstore::continue_sync(blockstore_operation *op) // 1st step: fsync data // FIXME: Add no-fsync mode BS_SUBMIT_GET_SQE(sqe, data); - my_uring_prep_fsync(sqe, data_fd, 0); + my_uring_prep_fsync(sqe, data_fd, IORING_FSYNC_DATASYNC); data->iov = { 0 }; data->callback = cb; op->min_used_journal_sector = op->max_used_journal_sector = 0; @@ -100,7 +100,7 @@ int blockstore::continue_sync(blockstore_operation *op) } op->max_used_journal_sector = 1 + journal.cur_sector; // ... And a journal fsync - my_uring_prep_fsync(sqe[s], journal.fd, 0); + my_uring_prep_fsync(sqe[s], journal.fd, IORING_FSYNC_DATASYNC); struct ring_data_t *data = ((ring_data_t*)sqe[s]->user_data); data->iov = { 0 }; data->callback = cb;