]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: cap reads issued during deep fsck 26291/head
authorIgor Fedotov <ifedotov@suse.com>
Mon, 28 Jan 2019 15:17:52 +0000 (18:17 +0300)
committerPrashant D <pdhange@redhat.com>
Tue, 5 Feb 2019 21:48:20 +0000 (16:48 -0500)
Fixes: https://tracker.ceph.com/issues/38065
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
(cherry picked from commit ced308000aef6050ca1fdbdfe3b4b63a887a1706)

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

index 4dc62a2e8b41f417a08dc429e699705f173f92a9..a664e9b18f468634127de9b5dad19791f52c22b5 100644 (file)
@@ -1042,6 +1042,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 3bcf3a5ef5a7fe85bc3fc05675b3e76a05e3eb67..5cdb1f33259a40d4fe2f48e48627ee8630c83f8a 100644 (file)
@@ -4190,6 +4190,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 72fde7309b768c026cae1cfc8bb6c6b49cf8fc0a..fe1c7d885b93a593a9fe2cd7a50f548f7ac0aed8 100644 (file)
@@ -6432,13 +6432,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()) {