Skip to content

Commit 0f73780

Browse files
Merge pull request ceph#59979 from rzarzynski/wip-os-simplify-ostxn
os: simplify os::Transaction -- get rid of the Transaction::decode_bp()
2 parents 3786407 + e3a6680 commit 0f73780

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/os/Transaction.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -711,10 +711,6 @@ class Transaction {
711711
decode(s, data_bl_p);
712712
return s;
713713
}
714-
void decode_bp(ceph::buffer::ptr& bp) {
715-
using ceph::decode;
716-
decode(bp, data_bl_p);
717-
}
718714
void decode_bl(ceph::buffer::list& bl) {
719715
using ceph::decode;
720716
decode(bl, data_bl_p);

src/os/bluestore/BlueStore.cc

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15785,9 +15785,9 @@ void BlueStore::_txc_add_transaction(TransContext *txc, Transaction *t)
1578515785
case Transaction::OP_SETATTR:
1578615786
{
1578715787
string name = i.decode_string();
15788-
bufferptr bp;
15789-
i.decode_bp(bp);
15790-
r = _setattr(txc, c, o, name, bp);
15788+
bufferlist bl;
15789+
i.decode_bl(bl);
15790+
r = _setattr(txc, c, o, name, bl);
1579115791
}
1579215792
break;
1579315793

@@ -17828,18 +17828,22 @@ int BlueStore::_setattr(TransContext *txc,
1782817828
CollectionRef& c,
1782917829
OnodeRef& o,
1783017830
const string& name,
17831-
bufferptr& val)
17831+
bufferlist& val)
1783217832
{
1783317833
dout(15) << __func__ << " " << c->cid << " " << o->oid
1783417834
<< " " << name << " (" << val.length() << " bytes)"
1783517835
<< dendl;
1783617836
int r = 0;
17837-
if (val.is_partial()) {
17838-
auto& b = o->onode.attrs[name.c_str()] = bufferptr(val.c_str(),
17839-
val.length());
17837+
if (!val.length()) {
17838+
auto& b = o->onode.attrs[name.c_str()] = bufferptr("", 0);
1784017839
b.reassign_to_mempool(mempool::mempool_bluestore_cache_meta);
17841-
} else {
17842-
auto& b = o->onode.attrs[name.c_str()] = val;
17840+
} else if (!val.is_contiguous()) {
17841+
val.rebuild();
17842+
auto& b = o->onode.attrs[name.c_str()] = val.front();
17843+
b.reassign_to_mempool(mempool::mempool_bluestore_cache_meta);
17844+
} else if (val.front().is_partial()) {
17845+
val.rebuild();
17846+
auto& b = o->onode.attrs[name.c_str()] = val.front();
1784317847
b.reassign_to_mempool(mempool::mempool_bluestore_cache_meta);
1784417848
}
1784517849
txc->write_onode(o);

src/os/bluestore/BlueStore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3878,7 +3878,7 @@ class BlueStore : public ObjectStore,
38783878
CollectionRef& c,
38793879
OnodeRef& o,
38803880
const std::string& name,
3881-
ceph::buffer::ptr& val);
3881+
ceph::buffer::list& val);
38823882
int _setattrs(TransContext *txc,
38833883
CollectionRef& c,
38843884
OnodeRef& o,

0 commit comments

Comments
 (0)