decode(n, p);
ls.clear();
while (n--) {
- ceph::shared_ptr<T> v(new T);
+ ceph::shared_ptr<T> v(std::make_shared<T>());
decode(*v, p);
ls.push_back(v);
}
decode(n, p);
v.resize(n);
for (__u32 i=0; i<n; i++) {
- v[i].reset(new T());
+ v[i] = std::make_shared<T>();
decode(*v[i], p);
}
}
}
Iterator get_iterator(const std::string &prefix) {
- return ceph::shared_ptr<IteratorImpl>(
- new IteratorImpl(prefix, get_iterator())
- );
+ return std::make_shared<IteratorImpl>(prefix, get_iterator());
}
WholeSpaceIterator get_snapshot_iterator() {
}
Iterator get_snapshot_iterator(const std::string &prefix) {
- return ceph::shared_ptr<IteratorImpl>(
- new IteratorImpl(prefix, get_snapshot_iterator())
- );
+ return std::make_shared<IteratorImpl>(prefix, get_snapshot_iterator());
}
virtual uint64_t get_estimated_size(std::map<std::string,uint64_t> &extra) = 0;
};
KeyValueDB::Transaction get_transaction() {
- return ceph::shared_ptr< KineticTransactionImpl >(
- new KineticTransactionImpl(this));
+ return std::make_shared<KineticTransactionImpl>(this);
}
int submit_transaction(KeyValueDB::Transaction t);
protected:
WholeSpaceIterator _get_iterator() {
- return ceph::shared_ptr<KeyValueDB::WholeSpaceIteratorImpl>(
- new KineticWholeSpaceIteratorImpl(kinetic_conn.get()));
+ return std::make_shared<KineticWholeSpaceIteratorImpl>(kinetic_conn.get());
}
// TODO: remove snapshots from interface
};
KeyValueDB::Transaction get_transaction() {
- return ceph::shared_ptr< LevelDBTransactionImpl >(
- new LevelDBTransactionImpl(this));
+ return std::make_shared<LevelDBTransactionImpl>(this);
}
int submit_transaction(KeyValueDB::Transaction t);
protected:
WholeSpaceIterator _get_iterator() {
- return ceph::shared_ptr<KeyValueDB::WholeSpaceIteratorImpl>(
- new LevelDBWholeSpaceIteratorImpl(
- db->NewIterator(leveldb::ReadOptions())
- )
- );
+ return std::make_shared<LevelDBWholeSpaceIteratorImpl>(
+ db->NewIterator(leveldb::ReadOptions()));
}
WholeSpaceIterator _get_snapshot_iterator() {
snapshot = db->GetSnapshot();
options.snapshot = snapshot;
- return ceph::shared_ptr<KeyValueDB::WholeSpaceIteratorImpl>(
- new LevelDBSnapshotIteratorImpl(db.get(), snapshot,
- db->NewIterator(options))
- );
+ return std::make_shared<LevelDBSnapshotIteratorImpl>(
+ db.get(), snapshot,
+ db->NewIterator(options));
}
};
RocksDBStore::WholeSpaceIterator RocksDBStore::_get_iterator()
{
- return std::shared_ptr<KeyValueDB::WholeSpaceIteratorImpl>(
- new RocksDBWholeSpaceIteratorImpl(
- db->NewIterator(rocksdb::ReadOptions())
- )
- );
+ return std::make_shared<RocksDBWholeSpaceIteratorImpl>(
+ db->NewIterator(rocksdb::ReadOptions()));
}
RocksDBStore::WholeSpaceIterator RocksDBStore::_get_snapshot_iterator()
snapshot = db->GetSnapshot();
options.snapshot = snapshot;
- return std::shared_ptr<KeyValueDB::WholeSpaceIteratorImpl>(
- new RocksDBSnapshotIteratorImpl(db, snapshot,
- db->NewIterator(options))
- );
+ return std::make_shared<RocksDBSnapshotIteratorImpl>(
+ db, snapshot, db->NewIterator(options));
}
RocksDBStore::RocksDBSnapshotIteratorImpl::~RocksDBSnapshotIteratorImpl()
};
KeyValueDB::Transaction get_transaction() {
- return std::shared_ptr< RocksDBTransactionImpl >(
- new RocksDBTransactionImpl(this));
+ return std::make_shared<RocksDBTransactionImpl>(this);
}
int submit_transaction(KeyValueDB::Transaction t);
Context *oncomplete,
TrackedOpRef op = TrackedOpRef())
{
- RunOnDeleteRef _complete(new RunOnDelete(oncomplete));
+ RunOnDeleteRef _complete (std::make_shared<RunOnDelete>(oncomplete));
Context *_onreadable = new Wrapper<RunOnDeleteRef>(
onreadable, _complete);
Context *_oncommit = new Wrapper<RunOnDeleteRef>(
}
void register_on_complete(Context *c) {
if (!c) return;
- RunOnDeleteRef _complete(new RunOnDelete(c));
+ RunOnDeleteRef _complete (std::make_shared<RunOnDelete>(c));
register_on_applied(new ContainerContext<RunOnDeleteRef>(_complete));
register_on_commit(new ContainerContext<RunOnDeleteRef>(_complete));
}
/// Type of returned paths
typedef ceph::shared_ptr<Path> IndexedPath;
- static IndexedPath get_testing_path(string path, const coll_t& collection) {
- return IndexedPath(new Path(path, collection));
+ static IndexedPath get_testing_path(string path, coll_t collection) {
+ return std::make_shared<Path>(path, collection);
}
static const uint32_t FLAT_INDEX_TAG = 0;
assert(0);
return -EINVAL;
}
- parent_iter.reset(new DBObjectMapIteratorImpl(map, parent));
+ parent_iter = std::make_shared<DBObjectMapIteratorImpl>(map, parent);
}
key_iter = map->db->get_iterator(map->user_prefix(header));
assert(key_iter);
typedef ceph::shared_ptr<DBObjectMapIteratorImpl> DBObjectMapIterator;
DBObjectMapIterator _get_iterator(Header header) {
- return DBObjectMapIterator(new DBObjectMapIteratorImpl(this, header));
+ return std::make_shared<DBObjectMapIteratorImpl>(this, header);
}
/// sys
if (r < 0)
goto out;
string full_path = get_full_path(path, short_name);
- *out_path = IndexedPath(new Path(full_path, this));
+ *out_path = std::make_shared<Path>(full_path, this);
r = 0;
);
}
coll_t(),
make_snapmapper_oid());
- ceph::shared_ptr<ObjectStore::Sequencer> osr(
- new ObjectStore::Sequencer("rm"));
+ ceph::shared_ptr<ObjectStore::Sequencer> osr (std::make_shared<
+ ObjectStore::Sequencer>("rm"));
ObjectStore::Transaction t;
SnapMapper mapper(&driver, 0, 0, 0, pgid.shard);
cmd_getval(cct, cmdmap, "object_size", osize, (int64_t)0);
cmd_getval(cct, cmdmap, "object_num", onum, (int64_t)0);
- ceph::shared_ptr<ObjectStore::Sequencer> osr(
- new ObjectStore::Sequencer("bench"));
+ ceph::shared_ptr<ObjectStore::Sequencer> osr (std::make_shared<
+ ObjectStore::Sequencer>("bench"));
uint32_t duration = g_conf->osd_bench_duration;
flags(0),
num_osd(0), num_up_osd(0), num_in_osd(0),
max_osd(0),
- osd_addrs(new addrs_s),
- pg_temp(new map<pg_t,vector<int32_t> >),
- primary_temp(new map<pg_t,int32_t>),
- osd_uuid(new vector<uuid_d>),
+ osd_addrs(std::make_shared<addrs_s>()),
+ pg_temp(std::make_shared<map<pg_t,vector<int32_t>>>()),
+ primary_temp(std::make_shared<map<pg_t,int32_t>>()),
+ osd_uuid(std::make_shared<vector<uuid_d>>()),
cluster_snapshot_epoch(0),
new_blacklist_entries(false),
cached_up_osd_features(0),
crc_defined(false), crc(0),
- crush(new CrushWrapper) {
+ crush(std::make_shared<CrushWrapper>()) {
memset(&fsid, 0, sizeof(fsid));
}
queue_peering_event(
CephPeeringEvtRef(
- new CephPeeringEvt(
+ std::make_shared<CephPeeringEvt>(
get_osdmap()->get_epoch(),
get_osdmap()->get_epoch(),
AllReplicasActivated())));
dirty_big_info = true;
write_if_dirty(t);
- ceph::shared_ptr<ObjectStore::Sequencer> osr(
- new ObjectStore::Sequencer("upgrade"));
+ ceph::shared_ptr<ObjectStore::Sequencer> osr (std::make_shared<
+ ObjectStore::Sequencer>("upgrade"));
int r = store->apply_transaction(osr.get(), std::move(t));
if (r != 0) {
derr << __func__ << ": apply_transaction returned "
if (has_error) {
queue_peering_event(
CephPeeringEvtRef(
- new CephPeeringEvt(
+ std::make_shared<CephPeeringEvt>(
get_osdmap()->get_epoch(),
get_osdmap()->get_epoch(),
DoRecovery())));
list<Context *> *on_safe)
{
// flush in progress ops
- FlushStateRef flush_trigger(
- new FlushState(this, get_osdmap()->get_epoch()));
+ FlushStateRef flush_trigger (std::make_shared<FlushState>(
+ this, get_osdmap()->get_epoch()));
t->nop();
flushes_in_progress++;
on_applied->push_back(new ContainerContext<FlushStateRef>(flush_trigger));
{
dout(10) << "null" << dendl;
queue_peering_event(
- CephPeeringEvtRef(new CephPeeringEvt(msg_epoch, query_epoch,
+ CephPeeringEvtRef(std::make_shared<CephPeeringEvt>(msg_epoch, query_epoch,
NullEvt())));
}
{
dout(10) << "flushed" << dendl;
queue_peering_event(
- CephPeeringEvtRef(new CephPeeringEvt(e, e,
+ CephPeeringEvtRef(std::make_shared<CephPeeringEvt>(e, e,
FlushedEvt())));
}
{
dout(10) << "handle_query " << q << " from replica " << from << dendl;
queue_peering_event(
- CephPeeringEvtRef(new CephPeeringEvt(msg_epoch, query_epoch,
+ CephPeeringEvtRef(std::make_shared<CephPeeringEvt>(msg_epoch, query_epoch,
MQuery(from, q, query_epoch))));
}
op->mark_started();
- RepModifyRef rm(new RepModify);
+ RepModifyRef rm(std::make_shared<RepModify>());
rm->op = op;
rm->ackerosd = ackerosd;
rm->last_complete = get_info().last_complete;
dout(10) << __func__ << " Start proxy read for " << *m << dendl;
- ProxyReadOpRef prdop(new ProxyReadOp(op, soid, m->ops));
+ ProxyReadOpRef prdop(std::make_shared<ProxyReadOp>(op, soid, m->ops));
ObjectOperation obj_op;
obj_op.dup(prdop->ops);
unsigned flags = CEPH_OSD_FLAG_IGNORE_CACHE | CEPH_OSD_FLAG_IGNORE_OVERLAY;
dout(10) << __func__ << " Start proxy write for " << *m << dendl;
- ProxyWriteOpRef pwop(new ProxyWriteOp(op, soid, m->ops, m->get_reqid()));
+ ProxyWriteOpRef pwop(std::make_shared<ProxyWriteOp>(op, soid, m->ops, m->get_reqid()));
pwop->ctx = new OpContext(op, m->get_reqid(), pwop->ops, this);
pwop->mtime = m->get_mtime();
<< ratio << ", which exceeds " << full_ratio << dendl;
queue_peering_event(
CephPeeringEvtRef(
- new CephPeeringEvt(
+ std::make_shared<CephPeeringEvt>(
get_osdmap()->get_epoch(),
get_osdmap()->get_epoch(),
BackfillTooFull())));
osd->send_message_osd_cluster(reply, m->get_connection());
queue_peering_event(
CephPeeringEvtRef(
- new CephPeeringEvt(
+ std::make_shared<CephPeeringEvt>(
get_osdmap()->get_epoch(),
get_osdmap()->get_epoch(),
RecoveryDone())));
cancel_copy(cop, false);
}
- CopyOpRef cop(new CopyOp(cb, obc, src, oloc, version, flags,
+ CopyOpRef cop(std::make_shared<CopyOp>(cb, obc, src, oloc, version, flags,
mirror_snapset, src_obj_fadvise_flags,
dest_obj_fadvise_flags));
copy_ops[dest] = cop;
NULL /* no callback, we'll rely on the ordering w.r.t the next op */);
}
- FlushOpRef fop(new FlushOp);
+ FlushOpRef fop(std::make_shared<FlushOp>());
fop->obc = obc;
fop->flushed_version = oi.user_version;
fop->blocking = blocking;
dout(10) << "activate not all replicas are up-to-date, queueing recovery" << dendl;
queue_peering_event(
CephPeeringEvtRef(
- new CephPeeringEvt(
+ std::make_shared<CephPeeringEvt>(
get_osdmap()->get_epoch(),
get_osdmap()->get_epoch(),
DoRecovery())));
dout(10) << "activate queueing backfill" << dendl;
queue_peering_event(
CephPeeringEvtRef(
- new CephPeeringEvt(
+ std::make_shared<CephPeeringEvt>(
get_osdmap()->get_epoch(),
get_osdmap()->get_epoch(),
RequestBackfill())));
dout(10) << "activate all replicas clean, no recovery" << dendl;
queue_peering_event(
CephPeeringEvtRef(
- new CephPeeringEvt(
+ std::make_shared<CephPeeringEvt>(
get_osdmap()->get_epoch(),
get_osdmap()->get_epoch(),
AllReplicasRecovered())));
backfill_reserving = true;
queue_peering_event(
CephPeeringEvtRef(
- new CephPeeringEvt(
+ std::make_shared<CephPeeringEvt>(
get_osdmap()->get_epoch(),
get_osdmap()->get_epoch(),
RequestBackfill())));
dout(10) << "recovery done, queuing backfill" << dendl;
queue_peering_event(
CephPeeringEvtRef(
- new CephPeeringEvt(
+ std::make_shared<CephPeeringEvt>(
get_osdmap()->get_epoch(),
get_osdmap()->get_epoch(),
RequestBackfill())));
dout(10) << "recovery done, no backfill" << dendl;
queue_peering_event(
CephPeeringEvtRef(
- new CephPeeringEvt(
+ std::make_shared<CephPeeringEvt>(
get_osdmap()->get_epoch(),
get_osdmap()->get_epoch(),
AllReplicasRecovered())));
dout(10) << "recovery done, backfill done" << dendl;
queue_peering_event(
CephPeeringEvtRef(
- new CephPeeringEvt(
+ std::make_shared<CephPeeringEvt>(
get_osdmap()->get_epoch(),
get_osdmap()->get_epoch(),
Backfilled())));
results.mirror_snapset = mirror_snapset;
}
};
- typedef boost::shared_ptr<CopyOp> CopyOpRef;
+ typedef ceph::shared_ptr<CopyOp> CopyOpRef;
/**
* The CopyCallback class defines an interface for completions to the
user_version(0), data_offset(0),
canceled(false) { }
};
- typedef boost::shared_ptr<ProxyReadOp> ProxyReadOpRef;
+ typedef ceph::shared_ptr<ProxyReadOp> ProxyReadOpRef;
struct ProxyWriteOp {
OpContext *ctx;
sent_ack(false), canceled(false),
reqid(_reqid) { }
};
- typedef boost::shared_ptr<ProxyWriteOp> ProxyWriteOpRef;
+ typedef ceph::shared_ptr<ProxyWriteOp> ProxyWriteOpRef;
struct FlushOp {
ObjectContextRef obc; ///< obc we are flushing
on_flush(NULL) {}
~FlushOp() { assert(!on_flush); }
};
- typedef boost::shared_ptr<FlushOp> FlushOpRef;
+ typedef ceph::shared_ptr<FlushOp> FlushOpRef;
boost::scoped_ptr<PGBackend> pgbackend;
PGBackend *get_pgbackend() {