]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
FileJournal: Remove obsolete _check_disk_write_cache function
authorBrad Hubbard <bhubbard@redhat.com>
Wed, 14 Sep 2016 06:09:15 +0000 (16:09 +1000)
committerBrad Hubbard <bhubbard@redhat.com>
Wed, 14 Sep 2016 09:51:10 +0000 (19:51 +1000)
_check_disk_write_cache issues a warning about a bug that existed in the linux
kernel prior to version 2.6.33. This check/warning should be obsolete in master.

Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
src/os/filestore/FileJournal.cc
src/os/filestore/FileJournal.h

index 4375a9731dabe4fec0e5f8cd8b9b48ebf87efc05..f581828121dd0f7bd458779fdba3ce03ecd34b83 100644 (file)
@@ -164,89 +164,8 @@ int FileJournal::_open_block_device()
     discard = block_device_support_discard(fn.c_str());
     dout(10) << fn << " support discard: " << (int)discard << dendl;
   }
-  _check_disk_write_cache();
-  return 0;
-}
-
-void FileJournal::_check_disk_write_cache() const
-{
-#if !defined(__linux__)
-    dout(10) << "_check_disk_write_cache: not linux, NOT checking disk write "
-      << "cache on raw block device " << fn << dendl;
-    return;
-#else
-  ostringstream hdparm_cmd;
-  FILE *fp = NULL;
-
-  if (geteuid() != 0) {
-    dout(10) << "_check_disk_write_cache: not root, NOT checking disk write "
-      << "cache on raw block device " << fn << dendl;
-    goto done;
-  }
-
-  hdparm_cmd << "/sbin/hdparm -W " << fn;
-  fp = popen(hdparm_cmd.str().c_str(), "r");
-  if (!fp) {
-    dout(10) << "_check_disk_write_cache: failed to run /sbin/hdparm: NOT "
-      << "checking disk write cache on raw block device " << fn << dendl;
-    goto done;
-  }
-
-  while (true) {
-    char buf[256];
-    memset(buf, 0, sizeof(buf));
-    char *line = fgets(buf, sizeof(buf) - 1, fp);
-    if (!line) {
-      if (ferror(fp)) {
-       int ret = -errno;
-       derr << "_check_disk_write_cache: fgets error: " << cpp_strerror(ret)
-            << dendl;
-       goto close_f;
-      }
-      else {
-       // EOF.
-       break;
-      }
-    }
-
-    int on;
-    if (sscanf(line, " write-caching =  %d", &on) != 1)
-      continue;
-    if (!on) {
-      dout(10) << "_check_disk_write_cache: disk write cache is off (good) on "
-              << fn << dendl;
-      break;
-    }
-
-    // is our kernel new enough?
-    int ver = get_linux_version();
-    if (ver == 0) {
-      dout(10) << "_check_disk_write_cache: get_linux_version failed" << dendl;
-    } else if (ver >= KERNEL_VERSION(2, 6, 33)) {
-      dout(20) << "_check_disk_write_cache: disk write cache is on, but your "
-              << "kernel is new enough to handle it correctly. (fn:"
-              << fn << ")" << dendl;
-      break;
-    }
-    derr << TEXT_RED
-        << " ** WARNING: disk write cache is ON on " << fn << ".\n"
-        << "    Journaling will not be reliable on kernels prior to 2.6.33\n"
-        << "    (recent kernels are safe).  You can disable the write cache with\n"
-        << "    'hdparm -W 0 " << fn << "'"
-        << TEXT_NORMAL
-        << dendl;
-    break;
-  }
 
-close_f:
-  if (pclose(fp)) {
-    int ret = -errno;
-    derr << "_check_disk_write_cache: pclose failed: " << cpp_strerror(ret)
-        << dendl;
-  }
-done:
-  ;
-#endif // __linux__
+  return 0;
 }
 
 int FileJournal::_open_file(int64_t oldsize, blksize_t blksize,
index 0c50e89133cc2eb2febecb6990e298d93c4cda27..1d3d6fb5d3248744151e41c2c4a0991b93f5e283 100644 (file)
@@ -327,7 +327,6 @@ private:
   int _open(bool wr, bool create=false);
   int _open_block_device();
   void _close(int fd) const;
-  void _check_disk_write_cache() const;
   int _open_file(int64_t oldsize, blksize_t blksize, bool create);
   int _dump(ostream& out, bool simple);
   void print_header(const header_t &hdr) const;