if (!path)
path = &path2;
int r, exist;
- assert(NULL != index.index);
+ assert(index.index);
r = (index.index)->lookup(oid, path, &exist);
if (r < 0) {
assert(!m_filestore_fail_eio || r != -EIO);
if (r < 0)
return r;
- assert(NULL != index.index);
+ assert(index.index);
RWLock::RLocker l((index.index)->access_lock);
r = lfn_find(oid, index, &path);
}
int fd, exist;
- assert(NULL != (*index).index);
+ assert((*index).index);
if (need_lock) {
((*index).index)->access_lock.get_write();
}
return r;
}
- assert(NULL != index_old.index);
- assert(NULL != index_new.index);
+ assert(index_old.index);
+ assert(index_new.index);
if (!index_same) {
return r;
}
- assert(NULL != index.index);
+ assert(index.index);
RWLock::WLocker l((index.index)->access_lock);
{
blk_size(0),
fsid_fd(-1), op_fd(-1),
basedir_fd(-1), current_fd(-1),
- backend(NULL),
+ backend(nullptr),
index_manager(cct, do_update),
lock("FileStore::lock"),
force_sync(false),
op_tp(cct, "FileStore::op_tp", "tp_fstore_op", cct->_conf->filestore_op_threads, "filestore_op_threads"),
op_wq(this, cct->_conf->filestore_op_thread_timeout,
cct->_conf->filestore_op_thread_suicide_timeout, &op_tp),
- logger(NULL),
+ logger(nullptr),
trace_endpoint("0.0.0.0", 0, "FileStore"),
read_error_lock("FileStore::read_error_lock"),
m_filestore_commit_timeout(cct->_conf->filestore_commit_timeout),
{
for (vector<Finisher*>::iterator it = ondisk_finishers.begin(); it != ondisk_finishers.end(); ++it) {
delete *it;
- *it = NULL;
+ *it = nullptr;
}
for (vector<Finisher*>::iterator it = apply_finishers.begin(); it != apply_finishers.end(); ++it) {
delete *it;
- *it = NULL;
+ *it = nullptr;
}
cct->_conf->remove_observer(this);
cct->get_perfcounters_collection()->remove(logger);
if (journal)
- journal->logger = NULL;
+ journal->logger = nullptr;
delete logger;
+ logger = nullptr;
if (m_filestore_do_dump) {
dump_stop();
FileJournal *journal = new FileJournal(cct, fsid, &finisher, &sync_cond, journalpath.c_str(), m_journal_dio);
r = journal->dump(out);
delete journal;
+ journal = nullptr;
return r;
}
{
m_fs_type = f_type;
- assert(backend == NULL);
+ assert(!backend);
backend = FileStoreBackend::create(f_type, this);
dout(0) << "backend " << backend->get_name()
assert(current_fd >= 0);
char s[NAME_MAX];
snprintf(s, sizeof(s), COMMIT_SNAP_ITEM, 1ull);
- ret = backend->create_checkpoint(s, NULL);
+ ret = backend->create_checkpoint(s, nullptr);
VOID_TEMP_FAILURE_RETRY(::close(current_fd));
if (ret < 0 && ret != -EEXIST) {
VOID_TEMP_FAILURE_RETRY(::close(fd));
close_basedir_fd:
VOID_TEMP_FAILURE_RETRY(::close(basedir_fd));
delete backend;
- backend = NULL;
+ backend = nullptr;
return ret;
}
dout(0) << __FUNC__ << ": created journal on " << journalpath << dendl;
}
delete journal;
- journal = 0;
+ journal = nullptr;
}
return ret;
}
create_backend(st.f_type);
rotational = backend->is_rotational();
delete backend;
- backend = NULL;
+ backend = nullptr;
}
dout(10) << __func__ << " " << (int)rotational << dendl;
return rotational;
create_backend(st.f_type);
journal_rotational = backend->is_journal_rotational();
delete backend;
- backend = NULL;
+ backend = nullptr;
}
dout(10) << __func__ << " " << (int)journal_rotational << dendl;
return journal_rotational;
KeyValueDB * omap_store = KeyValueDB::create(cct,
superblock.omap_backend,
omap_dir);
- if (omap_store == NULL)
+ if (!omap_store)
{
derr << __FUNC__ << ": Error creating " << superblock.omap_backend << dendl;
ret = -1;
stringstream err;
if (omap_store->create_and_open(err)) {
delete omap_store;
+ omap_store = nullptr;
derr << __FUNC__ << ": Error initializing " << superblock.omap_backend
<< " : " << err.str() << dendl;
ret = -1;
ret = dbomap->init(do_update);
if (ret < 0) {
delete dbomap;
+ dbomap = nullptr;
derr << __FUNC__ << ": Error initializing DBObjectMap: " << ret << dendl;
goto close_current_fd;
}
if (cct->_conf->filestore_debug_omap_check && !dbomap->check(err2)) {
derr << err2.str() << dendl;
delete dbomap;
+ dbomap = nullptr;
ret = -EINVAL;
goto close_current_fd;
}
<< " with error: " << ret << dendl;
goto close_current_fd;
}
- assert(NULL != index.index);
+ assert(index.index);
RWLock::WLocker l((index.index)->access_lock);
index->cleanup();
done:
assert(!m_filestore_fail_eio || ret != -EIO);
delete backend;
- backend = NULL;
+ backend = nullptr;
object_map.reset();
return ret;
}
force_sync = false;
delete backend;
- backend = NULL;
+ backend = nullptr;
object_map.reset();
apply_finishers[osr->id % m_apply_finisher_num]->queue(to_queue);
}
delete o;
+ o = nullptr;
}
dout(0) << __FUNC__ << ": objectstore_blackhole = TRUE, dropping transaction"
<< dendl;
delete ondisk;
+ ondisk = nullptr;
delete onreadable;
+ onreadable = nullptr;
delete onreadable_sync;
+ onreadable_sync = nullptr;
return 0;
}
_op_journal_transactions(tbl, orig_len, op, ondisk, osd_op);
} else {
delete ondisk;
+ ondisk = nullptr;
}
// start on_readable finisher after we queue journal item, as on_readable callback
map<uint64_t, uint64_t> *m)
{
uint64_t i;
- struct fiemap_extent *extent = NULL;
- struct fiemap *fiemap = NULL;
+ struct fiemap_extent *extent = nullptr;
+ struct fiemap *fiemap = nullptr;
int r = 0;
more:
if (r < 0) {
goto out2;
}
- assert(NULL != (index.index));
+ assert(index.index);
RWLock::WLocker l((index.index)->access_lock);
r = lfn_open(cid, newoid, true, &n, &index);
loff_t dstpos = dstoff;
while (pos < end) {
int l = MIN(end-pos, buflen);
- r = safe_splice(from, &pos, pipefd[1], NULL, l, SPLICE_F_NONBLOCK);
+ r = safe_splice(from, &pos, pipefd[1], nullptr, l, SPLICE_F_NONBLOCK);
dout(10) << " safe_splice read from " << pos << "~" << l << " got " << r << dendl;
if (r < 0) {
derr << __FUNC__ << ": safe_splice read error at " << pos << "~" << len
break;
}
- r = safe_splice(pipefd[0], NULL, to, &dstpos, r, 0);
+ r = safe_splice(pipefd[0], nullptr, to, &dstpos, r, 0);
dout(10) << " safe_splice write to " << to << " len " << r
<< " got " << r << dendl;
if (r < 0) {
bt->print(*_dout);
*_dout << dendl;
delete bt;
+ bt = nullptr;
ceph_abort();
}
private:
char s[NAME_MAX];
snprintf(s, sizeof(s), CLUSTER_SNAP_ITEM, name.c_str());
- int r = backend->create_checkpoint(s, NULL);
+ int r = backend->create_checkpoint(s, nullptr);
if (r) {
derr << __FUNC__ << ": " << name << " failed: " << cpp_strerror(r) << dendl;
}
return r;
}
- assert(NULL != index.index);
+ assert(index.index);
RWLock::RLocker l((index.index)->access_lock);
vector<ghobject_t> ls;
r = index->collection_list_partial(ghobject_t(), ghobject_t::get_max(),
- 1, &ls, NULL);
+ 1, &ls, nullptr);
if (r < 0) {
derr << __FUNC__ << ": collection_list_partial returned: "
<< cpp_strerror(r) << dendl;
if (r < 0)
return r;
- assert(NULL != index.index);
+ assert(index.index);
RWLock::RLocker l((index.index)->access_lock);
r = index->collection_list_partial(start, end, max, ls, next);
if (r < 0)
return r;
{
- assert(NULL != index.index);
+ assert(index.index);
RWLock::RLocker l((index.index)->access_lock);
r = lfn_find(hoid, index);
if (r < 0)
if (r < 0)
return r;
{
- assert(NULL != index.index);
+ assert(index.index);
RWLock::RLocker l((index.index)->access_lock);
r = lfn_find(hoid, index);
if (r < 0)
if (r < 0)
return r;
{
- assert(NULL != index.index);
+ assert(index.index);
RWLock::RLocker l((index.index)->access_lock);
r = lfn_find(hoid, index);
if (r < 0)
goto out;
}
{
- assert(NULL != index.index);
+ assert(index.index);
RWLock::RLocker l((index.index)->access_lock);
r = lfn_find(hoid, index);
if (r < 0) {
if (r < 0)
return r;
{
- assert(NULL != index.index);
+ assert(index.index);
RWLock::RLocker l((index.index)->access_lock);
r = lfn_find(hoid, index);
if (r < 0)
return ObjectMap::ObjectMapIterator();
}
{
- assert(NULL != index.index);
+ assert(index.index);
RWLock::RLocker l((index.index)->access_lock);
r = lfn_find(hoid, index);
if (r < 0) {
r = get_index(c, &from);
if (r < 0)
goto out;
- assert(NULL != from.index);
+ assert(from.index);
RWLock::WLocker l((from.index)->access_lock);
r = from->prep_delete();
if (r < 0)
return r;
{
- assert(NULL != index.index);
+ assert(index.index);
RWLock::RLocker l((index.index)->access_lock);
r = lfn_find(hoid, index);
if (r < 0)
return r;
}
{
- assert(NULL != index.index);
+ assert(index.index);
RWLock::RLocker l((index.index)->access_lock);
r = lfn_find(hoid, index);
if (r < 0) {
if (r < 0)
return r;
{
- assert(NULL != index.index);
+ assert(index.index);
RWLock::RLocker l((index.index)->access_lock);
r = lfn_find(hoid, index);
if (r < 0)
if (r < 0)
return r;
{
- assert(NULL != index.index);
+ assert(index.index);
RWLock::RLocker l((index.index)->access_lock);
r = lfn_find(hoid, index);
if (r < 0)
r = get_index(dest, &to);
if (!r) {
- assert(NULL != from.index);
+ assert(from.index);
RWLock::WLocker l1((from.index)->access_lock);
- assert(NULL != to.index);
+ assert(to.index);
RWLock::WLocker l2((to.index)->access_lock);
r = from->split(rem, bits, to.index);