From: Brad Hubbard Date: Wed, 14 Sep 2016 06:09:15 +0000 (+1000) Subject: FileJournal: Remove obsolete _check_disk_write_cache function X-Git-Tag: v11.0.1~149^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=53660d1c1efe52d77d048098361514cd8f3625e9;p=ceph.git FileJournal: Remove obsolete _check_disk_write_cache function _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 --- diff --git a/src/os/filestore/FileJournal.cc b/src/os/filestore/FileJournal.cc index 4375a9731da..f581828121d 100644 --- a/src/os/filestore/FileJournal.cc +++ b/src/os/filestore/FileJournal.cc @@ -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, diff --git a/src/os/filestore/FileJournal.h b/src/os/filestore/FileJournal.h index 0c50e89133c..1d3d6fb5d32 100644 --- a/src/os/filestore/FileJournal.h +++ b/src/os/filestore/FileJournal.h @@ -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;