]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
blk/kernel: Only use file hint capabilities if available. 42040/head
authorWillem Jan Withagen <wjw@digiware.nl>
Wed, 7 Jul 2021 09:50:50 +0000 (11:50 +0200)
committerWillem Jan Withagen <wjw@digiware.nl>
Wed, 7 Jul 2021 09:50:50 +0000 (11:50 +0200)
Without WRITE_LIFE capabilities, only one file is used.
And rocksdb sets this value also to > 0, so we need to catch this here
instead of trusting rocksdb to set write_hint.

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
src/blk/kernel/KernelDevice.cc

index 0592f571b8f406bfd1f9d155c234d5c886aa6fba..304bcd732d43a9b70ae9222fc0e95af9c9df15e3 100644 (file)
@@ -414,9 +414,15 @@ bool KernelDevice::get_thin_utilization(uint64_t *total, uint64_t *avail) const
 
 int KernelDevice::choose_fd(bool buffered, int write_hint) const
 {
-assert(write_hint >= WRITE_LIFE_NOT_SET && write_hint < WRITE_LIFE_MAX);
+#if defined(F_SET_FILE_RW_HINT)
   if (!enable_wrt)
     write_hint = WRITE_LIFE_NOT_SET;
+#else
+  // Without WRITE_LIFE capabilities, only one file is used.
+  // And rocksdb sets this value also to > 0, so we need to catch this here
+  // instead of trusting rocksdb to set write_hint.
+  write_hint = WRITE_LIFE_NOT_SET;
+#endif
   return buffered ? fd_buffereds[write_hint] : fd_directs[write_hint];
 }