]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: cap reads issued during deep fsck 26170/head
authorIgor Fedotov <ifedotov@suse.com>
Mon, 28 Jan 2019 15:17:52 +0000 (18:17 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Mon, 28 Jan 2019 16:19:21 +0000 (19:19 +0300)
Fixes: https://tracker.ceph.com/issues/38065
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/common/legacy_config_opts.h
src/common/options.cc
src/os/bluestore/BlueStore.cc

index 2ebc67ce5140271cf4eedb5ea83ecfce49743a3d..9053a50cb6c39e49a2008324399a1b538028cda3 100644 (file)
@@ -1039,6 +1039,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 c7568bde8f2ccb0c5fe1f4455548b6f09ad861eb..01c46d36b2177a110f738c809be011afaf7373b4 100644 (file)
@@ -4468,6 +4468,11 @@ 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_SIZE, Option::LEVEL_ADVANCED)
+    .set_default(64_M)
+    .set_flag(Option::FLAG_RUNTIME)
+    .set_description("Maximum bytes read at once by deep fsck"),
+
     Option("bluestore_throttle_bytes", Option::TYPE_SIZE, Option::LEVEL_ADVANCED)
     .set_default(64_M)
     .set_flag(Option::FLAG_RUNTIME)
index 39d7e48e206f7cd4ba5fe42ecd8676d330f1ace6..f2b39990bcaa10bffbfdc2c0011484d4593244e4 100644 (file)
@@ -7182,13 +7182,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()) {