From 9c5fd8c20a5ef7b7c3b7da1d39a86c2abd6e952e Mon Sep 17 00:00:00 2001 From: Loic Dachary Date: Thu, 11 Dec 2014 18:30:07 +0100 Subject: [PATCH] os: do not attempt to detect discard by default If the journal_discard option is false, the journal should no try to guess if the device has discard capabilities. http://tracker.ceph.com/issues/10296 Refs: #10296 Signed-off-by: Loic Dachary --- src/os/FileJournal.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index 388190f1880..034ee7e268e 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -156,8 +156,10 @@ int FileJournal::_open_block_device() /* block devices have to write in blocks of CEPH_PAGE_SIZE */ block_size = CEPH_PAGE_SIZE; - discard = block_device_support_discard(fn.c_str()); - dout(10) << fn << " support discard: " << (int)discard << dendl; + if (g_conf->journal_discard) { + discard = block_device_support_discard(fn.c_str()); + dout(10) << fn << " support discard: " << (int)discard << dendl; + } _check_disk_write_cache(); return 0; } @@ -1586,7 +1588,7 @@ void FileJournal::committed_thru(uint64_t seq) header.start_seq = seq + 1; } - if (g_conf->journal_discard && discard) { + if (discard) { dout(10) << __func__ << " will trim (" << old_start << ", " << header.start << ")" << dendl; if (old_start < header.start) do_discard(old_start, header.start - 1);