]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: cap reads issued during deep fsck 26387/head
authorIgor Fedotov <ifedotov@suse.com>
Mon, 28 Jan 2019 15:17:52 +0000 (18:17 +0300)
committerNathan Cutler <ncutler@suse.com>
Tue, 12 Feb 2019 15:29:37 +0000 (16:29 +0100)
Fixes: https://tracker.ceph.com/issues/38065
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
(cherry picked from commit ced308000aef6050ca1fdbdfe3b4b63a887a1706)

Conflicts:
src/common/options.cc
- use TYPE_UINT instead of TYPE_SIZE for new bluestore_fsck_read_bytes_cap
  option
- drop .set_flag(Option::FLAG_RUNTIME) because no .set_flag in luminous

src/common/legacy_config_opts.h
src/common/options.cc
src/os/bluestore/BlueStore.cc

index 828697758124093a1071e6209fb33bff8ee87a5a..5a36e6bd49bc9206bb0b6ae1cb29f7c89c98cb6e 100644 (file)
@@ -1099,6 +1099,7 @@ OPTION(bluestore_fsck_on_umount_deep, OPT_BOOL)
 OPTION(bluestore_fsck_on_mkfs, OPT_BOOL)
 OPTION(bluestore_fsck_on_mkfs_deep, OPT_BOOL)
 OPTION(bluestore_sync_submit_transaction, OPT_BOOL) // submit kv txn in queueing thread (not kv_sync_thread)
+OPTION(bluestore_fsck_read_bytes_cap, OPT_U64)
 OPTION(bluestore_throttle_bytes, OPT_U64)
 OPTION(bluestore_throttle_deferred_bytes, OPT_U64)
 OPTION(bluestore_throttle_cost_per_io_hdd, OPT_U64)
index 1c474f3047a199416e44b334f19505ccaa8791e8..fc759287d2a3e4867dc6cb1445f9169ea0bad0a1 100644 (file)
@@ -3691,6 +3691,10 @@ std::vector<Option> get_global_options() {
     .set_default(false)
     .set_description("Try to submit metadata transaction to rocksdb in queuing thread context"),
 
+    Option("bluestore_fsck_read_bytes_cap", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
+    .set_default(64_M)
+    .set_description("Maximum bytes read at once by deep fsck"),
+
     Option("bluestore_throttle_bytes", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(64_M)
     .set_safe()
index b957428ea8f11e26e23d446d63cbc48ec72949eb..dda28e0cfac6c78a9f7957252dc2e5235b565010 100644 (file)
@@ -6184,13 +6184,23 @@ int BlueStore::_fsck(bool deep, bool repair)
       }
       if (deep) {
        bufferlist bl;
-       int r = _do_read(c.get(), o, 0, o->onode.size, bl,
-         CEPH_OSD_OP_FLAG_FADVISE_NOCACHE);
-       if (r < 0) {
-         ++errors;
-         derr << "fsck error: " << oid << " error during read: "
-              << cpp_strerror(r) << dendl;
-       }
+       uint64_t max_read_block = cct->_conf->bluestore_fsck_read_bytes_cap;
+       uint64_t offset = 0;
+       do {
+         uint64_t l = std::min(uint64_t(o->onode.size - offset), max_read_block);
+         int r = _do_read(c.get(), o, offset, l, bl,
+           CEPH_OSD_OP_FLAG_FADVISE_NOCACHE);
+         if (r < 0) {
+           ++errors;
+           derr << "fsck error: " << oid << std::hex
+                << " error during read: "
+                << " " << offset << "~" << l
+                << " " << cpp_strerror(r) << std::dec
+                << dendl;
+           break;
+         }
+         offset += l;
+       } while (offset < o->onode.size);
       }
       // omap
       if (o->onode.has_omap()) {