From 7d1d689a62ff47d866bb3597d1b33a5e981bb629 Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Thu, 8 Sep 2016 19:40:41 +0800 Subject: [PATCH] os/bluestore/BlueFS: For logs of rocksdb & bluefs only use directio. Now it use bluefs_buffered_io to control whether use buffer or directio when write. But in fact for logs of rocksdb & bluefs, whether bluefs_buffer_io is true or false, the logs only need directio. Signed-off-by: Jianpeng Ma --- src/os/bluestore/BlueFS.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/os/bluestore/BlueFS.cc b/src/os/bluestore/BlueFS.cc index 0e665ee507146..99eb31e205e73 100644 --- a/src/os/bluestore/BlueFS.cc +++ b/src/os/bluestore/BlueFS.cc @@ -1375,6 +1375,12 @@ int BlueFS::_flush_range(FileWriter *h, uint64_t offset, uint64_t length) assert(!h->file->deleted); assert(h->file->num_readers.load() == 0); + bool buffered; + if (h->file->fnode.ino == 1 || h->writer_type == WRITER_WAL) + buffered = false; + else + buffered = g_conf->bluefs_buffered_io; + if (offset + length <= h->pos) return 0; if (offset < h->pos) { @@ -1506,8 +1512,7 @@ int BlueFS::_flush_range(FileWriter *h, uint64_t offset, uint64_t length) h->tail_block.substr_of(bl, bl.length() - tail, tail); t.append_zero(super.block_size - tail); } - bdev[p->bdev]->aio_write(p->offset + x_off, t, h->iocv[p->bdev], - g_conf->bluefs_buffered_io); + bdev[p->bdev]->aio_write(p->offset + x_off, t, h->iocv[p->bdev], buffered); bloff += x_len; length -= x_len; ++p; -- 2.39.5