ctx->snapset_obc->obs.oi.version;
ctx->snapset_obc->obs.oi.version = ctx->at_version;
+ map <string, bufferlist> attrs;
bl.clear();
::encode(snapset, bl);
- setattr_maybe_cache(ctx->snapset_obc, ctx, t, SS_ATTR, bl);
+ attrs[SS_ATTR].claim(bl);
bl.clear();
::encode(ctx->snapset_obc->obs.oi, bl);
- setattr_maybe_cache(ctx->snapset_obc, ctx, t, OI_ATTR, bl);
+ attrs[OI_ATTR].claim(bl);
+ setattrs_maybe_cache(ctx->snapset_obc, ctx, t, attrs);
if (pool.info.require_rollback()) {
set<string> changing;
ctx->snapset_obc->obs.oi.mtime = ctx->mtime;
ctx->snapset_obc->obs.oi.local_mtime = now;
+ map<string, bufferlist> attrs;
bufferlist bv(sizeof(ctx->new_obs.oi));
::encode(ctx->snapset_obc->obs.oi, bv);
ctx->op_t->touch(snapoid);
- setattr_maybe_cache(ctx->snapset_obc, ctx, ctx->op_t, OI_ATTR, bv);
- setattr_maybe_cache(ctx->snapset_obc, ctx, ctx->op_t, SS_ATTR, bss);
+ attrs[OI_ATTR].claim(bv);
+ attrs[SS_ATTR].claim(bss);
+ setattrs_maybe_cache(ctx->snapset_obc, ctx, ctx->op_t, attrs);
if (pool.info.require_rollback()) {
map<string, boost::optional<bufferlist> > to_set;
to_set[SS_ATTR];
dout(10) << " mtime unchanged at " << ctx->new_obs.oi.mtime << dendl;
}
+ map <string, bufferlist> attrs;
bufferlist bv(sizeof(ctx->new_obs.oi));
::encode(ctx->new_obs.oi, bv);
- setattr_maybe_cache(ctx->obc, ctx, ctx->op_t, OI_ATTR, bv);
+ attrs[OI_ATTR].claim(bv);
if (soid.snap == CEPH_NOSNAP) {
dout(10) << " final snapset " << ctx->new_snapset
<< " in " << soid << dendl;
- setattr_maybe_cache(ctx->obc, ctx, ctx->op_t, SS_ATTR, bss);
+ attrs[SS_ATTR].claim(bss);
} else {
dout(10) << " no snapset (this is a clone)" << dendl;
}
+ setattrs_maybe_cache(ctx->obc, ctx, ctx->op_t, attrs);
if (pool.info.require_rollback()) {
set<string> changing;
::encode(ctx->new_obs.oi, boi);
ctx->op_t->append(oid, 0, bl.length(), bl, 0);
- setattr_maybe_cache(ctx->obc, ctx, ctx->op_t, OI_ATTR, boi);
- setattr_maybe_cache(ctx->obc, ctx, ctx->op_t, SS_ATTR, bss);
+ map <string, bufferlist> attrs;
+ attrs[OI_ATTR].claim(boi);
+ attrs[SS_ATTR].claim(bss);
+ setattrs_maybe_cache(ctx->obc, ctx, ctx->op_t, attrs);
ctx->log.push_back(
pg_log_entry_t(
pg_log_entry_t::MODIFY,
t->setattr(obc->obs.oi.soid, key, val);
}
+void ReplicatedPG::setattrs_maybe_cache(
+ ObjectContextRef obc,
+ OpContext *op,
+ PGBackend::PGTransaction *t,
+ map<string, bufferlist> &attrs)
+{
+ if (pool.info.require_rollback()) {
+ for (map<string, bufferlist>::iterator it = attrs.begin();
+ it != attrs.end(); it++ ) {
+ op->pending_attrs[obc][it->first] = it->second;
+ }
+ }
+ t->setattrs(obc->obs.oi.soid, attrs);
+}
+
void ReplicatedPG::rmattr_maybe_cache(
ObjectContextRef obc,
OpContext *op,