]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os: do not attempt to detect discard by default
authorLoic Dachary <ldachary@redhat.com>
Thu, 11 Dec 2014 17:30:07 +0000 (18:30 +0100)
committerLoic Dachary <ldachary@redhat.com>
Thu, 11 Dec 2014 17:35:06 +0000 (18:35 +0100)
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 <ldachary@redhat.com>
src/os/FileJournal.cc

index 388190f18800c7f576967550c158fb30070684d6..034ee7e268edfb13d8202e7b069bf59f8a3c1818 100644 (file)
@@ -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);