Skip to content

Commit

Permalink
os/bluestore: pass containers by ptr in FSCK_ObjectCtx
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Fedotov <[email protected]>
  • Loading branch information
ifed01 committed Sep 11, 2019
1 parent c6ab317 commit 799d541
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 34 deletions.
32 changes: 18 additions & 14 deletions src/os/bluestore/BlueStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7102,7 +7102,7 @@ BlueStore::OnodeRef BlueStore::_fsck_check_objects_shallow(
auto& num_blobs = ctx.num_blobs;
auto& num_sharded_objects = ctx.num_sharded_objects;
auto& num_spanning_blobs = ctx.num_spanning_blobs;
auto& used_blocks = ctx.used_blocks;
auto used_blocks = ctx.used_blocks;
auto& sb_info = ctx.sb_info;
auto repairer = ctx.repairer;

Expand Down Expand Up @@ -7240,9 +7240,10 @@ BlueStore::OnodeRef BlueStore::_fsck_check_objects_shallow(
}
}
} else if (depth != FSCK_SHALLOW) {
ceph_assert(used_blocks);
errors += _fsck_check_extents(c->cid, oid, blob.get_extents(),
blob.is_compressed(),
used_blocks,
*used_blocks,
fm->get_alloc_size(),
repairer,
onode_statfs,
Expand All @@ -7264,9 +7265,9 @@ void BlueStore::_fsck_check_objects(FSCKDepth depth,
{
auto& errors = ctx.errors;
auto& warnings = ctx.warnings;
auto& used_omap_head = ctx.used_omap_head;
auto& used_per_pool_omap_head = ctx.used_per_pool_omap_head;
auto& used_pgmeta_omap_head = ctx.used_pgmeta_omap_head;
auto* used_omap_head = ctx.used_omap_head;
auto* used_per_pool_omap_head = ctx.used_per_pool_omap_head;
auto* used_pgmeta_omap_head = ctx.used_pgmeta_omap_head;
auto repairer = ctx.repairer;

uint64_t_btree_t used_nids;
Expand Down Expand Up @@ -7453,16 +7454,19 @@ void BlueStore::_fsck_check_objects(FSCKDepth depth,
}
// omap
if (o->onode.has_omap()) {
auto& m =
ceph_assert(used_omap_head);
ceph_assert(used_per_pool_omap_head);
ceph_assert(used_pgmeta_omap_head);
auto m =
o->onode.is_pgmeta_omap() ? used_pgmeta_omap_head :
(o->onode.is_perpool_omap() ? used_per_pool_omap_head : used_omap_head);
if (m.count(o->onode.nid)) {
if (m->count(o->onode.nid)) {
derr << "fsck error: " << oid << " omap_head " << o->onode.nid
<< " already in use" << dendl;
++errors;
}
else {
m.insert(o->onode.nid);
m->insert(o->onode.nid);
}
if (!o->onode.is_perpool_omap() && !o->onode.is_pgmeta_omap()) {
if (per_pool_omap) {
Expand All @@ -7489,8 +7493,8 @@ void BlueStore::_fsck_check_objects(FSCKDepth depth,
!o->onode.is_perpool_omap() &&
!o->oid.is_pgmeta()) {
derr << "fsck converting " << oid << " omap to per-pool" << dendl;
used_omap_head.erase(o->onode.nid);
used_per_pool_omap_head.insert(o->onode.nid);
used_omap_head->erase(o->onode.nid);
used_per_pool_omap_head->insert(o->onode.nid);
bufferlist h;
map<string, bufferlist> kv;
int r = _omap_get(c.get(), oid, &h, &kv);
Expand Down Expand Up @@ -7782,10 +7786,10 @@ int BlueStore::_fsck(BlueStore::FSCKDepth depth, bool repair)
num_blobs,
num_sharded_objects,
num_spanning_blobs,
used_blocks,
used_omap_head,
used_per_pool_omap_head,
used_pgmeta_omap_head,
&used_blocks,
&used_omap_head,
&used_per_pool_omap_head,
&used_pgmeta_omap_head,
sb_info,
expected_store_statfs,
expected_pool_statfs,
Expand Down
39 changes: 19 additions & 20 deletions src/os/bluestore/BlueStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -3087,32 +3087,31 @@ class BlueStore : public ObjectStore,
uint64_t& num_sharded_objects;
uint64_t& num_spanning_blobs;

mempool_dynamic_bitset& used_blocks;
uint64_t_btree_t& used_omap_head;
uint64_t_btree_t& used_per_pool_omap_head;
uint64_t_btree_t& used_pgmeta_omap_head;
mempool_dynamic_bitset* used_blocks;
uint64_t_btree_t* used_omap_head;
uint64_t_btree_t* used_per_pool_omap_head;
uint64_t_btree_t* used_pgmeta_omap_head;
sb_info_map_t& sb_info;

store_statfs_t& expected_store_statfs;
per_pool_statfs& expected_pool_statfs;
BlueStoreRepairer* repairer;

FSCK_ObjectCtx(
int64_t& e,
int64_t& w,
uint64_t& _num_objects,
uint64_t& _num_extents,
uint64_t& _num_blobs,
uint64_t& _num_sharded_objects,
uint64_t& _num_spanning_blobs,
mempool_dynamic_bitset& _ub,
uint64_t_btree_t& _used_omap_head,
uint64_t_btree_t& _used_per_pool_omap_head,
uint64_t_btree_t& _used_pgmeta_omap_head,
sb_info_map_t& _sb_info,
store_statfs_t& _store_statfs,
per_pool_statfs& _pool_statfs,
BlueStoreRepairer* _repairer) :
FSCK_ObjectCtx(int64_t& e,
int64_t& w,
uint64_t& _num_objects,
uint64_t& _num_extents,
uint64_t& _num_blobs,
uint64_t& _num_sharded_objects,
uint64_t& _num_spanning_blobs,
mempool_dynamic_bitset* _ub,
uint64_t_btree_t* _used_omap_head,
uint64_t_btree_t* _used_per_pool_omap_head,
uint64_t_btree_t* _used_pgmeta_omap_head,
sb_info_map_t& _sb_info,
store_statfs_t& _store_statfs,
per_pool_statfs& _pool_statfs,
BlueStoreRepairer* _repairer) :
errors(e),
warnings(w),
num_objects(_num_objects),
Expand Down

0 comments on commit 799d541

Please sign in to comment.