From d3d58524dcb16fcbbbb1b5f5b127a48ad22f2e9b Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Thu, 13 Nov 2014 13:21:32 +0800 Subject: [PATCH] FileJournal: add journal_discard to control ssd whether support discard Signed-off-by: Jianpeng Ma --- src/common/config_opts.h | 1 + src/os/FileJournal.cc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index be9cb1311a8d1..9060d8eb1a1fe 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -779,6 +779,7 @@ OPTION(journal_align_min_size, OPT_INT, 64 << 10) // align data payloads >= thi OPTION(journal_replay_from, OPT_INT, 0) OPTION(journal_zero_on_create, OPT_BOOL, false) OPTION(journal_ignore_corruption, OPT_BOOL, false) // assume journal is not corrupt +OPTION(journal_discard, OPT_BOOL, false) //using ssd disk as journal, whether support discard nouse journal-data. OPTION(rados_mon_op_timeout, OPT_DOUBLE, 0) // how many seconds to wait for a response from the monitor before returning an error from a rados operation. 0 means on limit. OPTION(rados_osd_op_timeout, OPT_DOUBLE, 0) // how many seconds to wait for a response from osds before returning an error from a rados operation. 0 means no limit. diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index 53ed03f291f65..b77e85306846a 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -1580,7 +1580,7 @@ void FileJournal::committed_thru(uint64_t seq) header.start_seq = seq + 1; } - if (discard) { + if (g_conf->journal_discard && discard) { dout(10) << __func__ << " will trim (" << old_start << ", " << header.start << ")" << dendl; if (old_start < header.start) do_discard(old_start, header.start - 1); -- 2.47.3