Skip to content

Commit

Permalink
os/bluestore: merge dump_transaction
Browse files Browse the repository at this point in the history
There are too much code redundancies.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
  • Loading branch information
xiexingguo committed Jun 30, 2016
1 parent b812482 commit 7a7ea58
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions src/os/bluestore/BlueStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5075,17 +5075,22 @@ void BlueStore::_txc_aio_submit(TransContext *txc)
bdev->aio_submit(&txc->ioc);
}

static void dump_transaction(ObjectStore::Transaction *t)
{
JSONFormatter f(true);
f.open_object_section("transaction");
t->dump(&f);
f.close_section();
f.flush(*_dout);
*_dout << dendl;
}

void BlueStore::_txc_add_transaction(TransContext *txc, Transaction *t)
{
Transaction::iterator i = t->begin();

dout(30) << __func__ << " transaction dump:\n";
JSONFormatter f(true);
f.open_object_section("transaction");
t->dump(&f);
f.close_section();
f.flush(*_dout);
*_dout << dendl;
dout(30) << __func__ << " transaction dump:" << dendl;
dump_transaction(t);

vector<CollectionRef> cvec(i.colls.size());
unsigned j = 0;
Expand Down Expand Up @@ -5181,13 +5186,8 @@ void BlueStore::_txc_add_transaction(TransContext *txc, Transaction *t)
dout(0) << " error " << cpp_strerror(r)
<< " not handled on operation " << op->op
<< " (op " << pos << ", counting from 0)" << dendl;
dout(0) << " transaction dump:\n";
JSONFormatter f(true);
f.open_object_section("transaction");
t->dump(&f);
f.close_section();
f.flush(*_dout);
*_dout << dendl;
dout(0) << " transaction dump:" << dendl;
dump_transaction(t);
assert(0 == "unexpected error");
}

Expand Down Expand Up @@ -5427,13 +5427,8 @@ void BlueStore::_txc_add_transaction(TransContext *txc, Transaction *t)
dout(0) << " error " << cpp_strerror(r) << " not handled on operation " << op->op
<< " (op " << pos << ", counting from 0)" << dendl;
dout(0) << msg << dendl;
dout(0) << " transaction dump:\n";
JSONFormatter f(true);
f.open_object_section("transaction");
t->dump(&f);
f.close_section();
f.flush(*_dout);
*_dout << dendl;
dout(0) << " transaction dump:" << dendl;
dump_transaction(t);
assert(0 == "unexpected error");
}
}
Expand Down

0 comments on commit 7a7ea58

Please sign in to comment.