OPTION(bluestore_bitmapallocator_span_size, OPT_INT, 1024) // must be power of 2 aligned, e.g., 512, 1024, 2048...
OPTION(bluestore_rocksdb_options, OPT_STR, "compression=kNoCompression,max_write_buffer_number=4,min_write_buffer_number_to_merge=1,recycle_log_file_num=4,write_buffer_size=268435456")
OPTION(bluestore_fsck_on_mount, OPT_BOOL, false)
+OPTION(bluestore_fsck_on_mount_deep, OPT_BOOL, true)
OPTION(bluestore_fsck_on_umount, OPT_BOOL, false)
+OPTION(bluestore_fsck_on_umount_deep, OPT_BOOL, true)
OPTION(bluestore_fsck_on_mkfs, OPT_BOOL, true)
+OPTION(bluestore_fsck_on_mkfs_deep, OPT_BOOL, false)
OPTION(bluestore_sync_submit_transaction, OPT_BOOL, true) // submit kv txn in queueing thread (not kv_sync_thread)
OPTION(bluestore_sync_wal_apply, OPT_BOOL, true) // perform initial wal work synchronously (possibly in combination with aio so we only *queue* ios)
OPTION(bluestore_wal_threads, OPT_INT, 4)
OPTION(kstore_backend, OPT_STR, "rocksdb")
OPTION(kstore_rocksdb_options, OPT_STR, "compression=kNoCompression")
OPTION(kstore_fsck_on_mount, OPT_BOOL, false)
+OPTION(kstore_fsck_on_mount_deep, OPT_BOOL, true)
OPTION(kstore_nid_prealloc, OPT_U64, 1024)
OPTION(kstore_sync_transaction, OPT_BOOL, false)
OPTION(kstore_sync_submit_transaction, OPT_BOOL, false)
virtual bool test_mount_in_use() = 0;
virtual int mount() = 0;
virtual int umount() = 0;
- virtual int fsck() {
+ virtual int fsck(bool deep) {
return -EOPNOTSUPP;
}
if (r == 0) {
dout(1) << __func__ << " already created" << dendl;
if (g_conf->bluestore_fsck_on_mkfs) {
- r = fsck();
+ r = fsck(g_conf->bluestore_fsck_on_mkfs_deep);
if (r < 0) {
derr << __func__ << " fsck found fatal error: " << cpp_strerror(r)
<< dendl;
if (r == 0 &&
g_conf->bluestore_fsck_on_mkfs) {
- int rc = fsck();
+ int rc = fsck(g_conf->bluestore_fsck_on_mkfs_deep);
if (rc < 0)
return rc;
if (rc > 0) {
}
if (g_conf->bluestore_fsck_on_mount) {
- int rc = fsck();
+ int rc = fsck(g_conf->bluestore_fsck_on_mount_deep);
if (rc < 0)
return rc;
if (rc > 0) {
_close_path();
if (g_conf->bluestore_fsck_on_umount) {
- int rc = fsck();
+ int rc = fsck(g_conf->bluestore_fsck_on_umount_deep);
if (rc < 0)
return rc;
if (rc > 0) {
const vector<bluestore_pextent_t>& extents,
bool compressed,
boost::dynamic_bitset<> &used_blocks,
- store_statfs_t& expected_statfs)
+ store_statfs_t& expected_statfs,
+ bool deep)
{
dout(30) << __func__ << " oid " << oid << " extents " << extents << dendl;
int errors = 0;
return errors;
}
-int BlueStore::fsck()
+int BlueStore::fsck(bool deep)
{
- dout(1) << __func__ << " start" << dendl;
+ dout(1) << __func__ << (deep ? " (deep)" : " (shallow)") << " start" << dendl;
int errors = 0;
set<uint64_t> used_nids;
set<uint64_t> used_omap_head;
errors += _fsck_check_extents(oid, blob.extents,
blob.is_compressed(),
used_blocks,
- expected_statfs);
+ expected_statfs,
+ deep);
}
}
// omap
extents.emplace_back(bluestore_pextent_t(r.first, r.second.length));
}
errors += _fsck_check_extents(p->second.oids.front(),
- extents,
- p->second.compressed,
- used_blocks, expected_statfs);
+ extents,
+ p->second.compressed,
+ used_blocks, expected_statfs, deep);
sb_info.erase(p);
}
}
const vector<bluestore_pextent_t>& extents,
bool compressed,
boost::dynamic_bitset<> &used_blocks,
- store_statfs_t& expected_statfs);
+ store_statfs_t& expected_statfs,
+ bool deep);
void _buffer_cache_write(
TransContext *txc,
int umount() override;
void _sync();
- int fsck() override;
+ int fsck(bool deep) override;
void set_cache_shards(unsigned num) override;
dout(1) << __func__ << " path " << path << dendl;
if (g_conf->kstore_fsck_on_mount) {
- int rc = fsck();
+ int rc = fsck(g_conf->kstore_fsck_on_mount_deep);
if (rc < 0)
return rc;
}
return 0;
}
-int KStore::fsck()
+int KStore::fsck(bool deep)
{
dout(1) << __func__ << dendl;
int errors = 0;
int umount();
void _sync();
- int fsck();
+ int fsck(bool deep) override;
int validate_hobject_key(const hobject_t &obj) const override {
return status;
}
- void fsck() {
+ void fsck(bool deep) {
Mutex::Locker locker(lock);
EnterExit ee("fsck");
while (in_flight)
cond.Wait(lock);
store->umount();
- store->fsck();
+ store->fsck(deep);
store->mount();
}
boost::uniform_int<> true_false(0, 999);
int val = true_false(rng);
if (val > 998) {
- test_obj.fsck();
+ test_obj.fsck(true);
+ } else if (val > 997) {
+ test_obj.fsck(false);
} else if (val > 970) {
test_obj.scan();
} else if (val > 950) {
}
if (op == "fsck") {
- int r = fs->fsck();
+ int r = fs->fsck(false);
+ if (r < 0) {
+ cerr << "fsck failed: " << cpp_strerror(r) << std::endl;
+ myexit(1);
+ }
+ if (r > 0) {
+ cerr << "fsck found " << r << " errors" << std::endl;
+ myexit(1);
+ }
+ cout << "fsck found no errors" << std::endl;
+ exit(0);
+ }
+ if (op == "fsck-deep") {
+ int r = fs->fsck(true);
if (r < 0) {
cerr << "fsck failed: " << cpp_strerror(r) << std::endl;
myexit(1);