osd: cleanups

Signed-off-by: Yan Jun <yan.jun8@zte.com.cn>
This commit is contained in:
Yan Jun 2017-07-12 14:20:33 +08:00
parent 7550bde5da
commit 0cfd05db57
4 changed files with 16 additions and 13 deletions

View File

@ -711,11 +711,11 @@ void md_config_t::call_all_observers()
expand_all_meta();
for (obs_map_t::iterator r = observers.begin(); r != observers.end(); ++r) {
for (auto r = observers.begin(); r != observers.end(); ++r) {
obs[r->second].insert(r->first);
}
}
for (std::map<md_config_obs_t*,std::set<std::string> >::iterator p = obs.begin();
for (auto p = obs.begin();
p != obs.end();
++p) {
p->first->handle_conf_change(this, p->second);

View File

@ -114,7 +114,7 @@ void global_pre_init(std::vector < const char * > *alt_def_args,
dout_emergency(oss.str());
_exit(1);
} else {
derr <<"did not load config file, using default settings." << dendl;
derr << "did not load config file, using default settings." << dendl;
}
}
}

View File

@ -820,7 +820,7 @@ int FileStore::mkfs()
basedir_fd = ::open(basedir.c_str(), O_RDONLY);
if (basedir_fd < 0) {
ret = -errno;
derr << "mkfs failed to open base dir " << basedir << ": " << cpp_strerror(ret) << dendl;
derr << __FUNC__ << ": failed to open base dir " << basedir << ": " << cpp_strerror(ret) << dendl;
return ret;
}
@ -829,7 +829,7 @@ int FileStore::mkfs()
fsid_fd = ::open(fsid_fn, O_RDWR|O_CREAT, 0644);
if (fsid_fd < 0) {
ret = -errno;
derr << "mkfs: failed to open " << fsid_fn << ": " << cpp_strerror(ret) << dendl;
derr << __FUNC__ << ": failed to open " << fsid_fn << ": " << cpp_strerror(ret) << dendl;
goto close_basedir_fd;
}
@ -841,9 +841,9 @@ int FileStore::mkfs()
if (read_fsid(fsid_fd, &old_fsid) < 0 || old_fsid.is_zero()) {
if (fsid.is_zero()) {
fsid.generate_random();
dout(1) << "mkfs generated fsid " << fsid << dendl;
dout(1) << __FUNC__ << ": generated fsid " << fsid << dendl;
} else {
dout(1) << "mkfs using provided fsid " << fsid << dendl;
dout(1) << __FUNC__ << ": using provided fsid " << fsid << dendl;
}
fsid.print(fsid_str);
@ -867,7 +867,7 @@ int FileStore::mkfs()
<< cpp_strerror(ret) << dendl;
goto close_fsid_fd;
}
dout(10) << "mkfs fsid is " << fsid << dendl;
dout(10) << __FUNC__ << ": fsid is " << fsid << dendl;
} else {
if (!fsid.is_zero() && fsid != old_fsid) {
derr << __FUNC__ << ": on-disk fsid " << old_fsid << " != provided " << fsid << dendl;
@ -907,7 +907,7 @@ int FileStore::mkfs()
#if defined(__linux__)
if (basefs.f_type == BTRFS_SUPER_MAGIC &&
!g_ceph_context->check_experimental_feature_enabled("btrfs")) {
derr <<__FUNC__ << ": deprecated btrfs support is not enabled" << dendl;
derr << __FUNC__ << ": deprecated btrfs support is not enabled" << dendl;
goto close_fsid_fd;
}
#endif

View File

@ -1717,7 +1717,8 @@ int OSD::mkfs(CephContext *cct, ObjectStore *store, const string &dev,
ret = store->mkfs();
if (ret) {
derr << "OSD::mkfs: ObjectStore::mkfs failed with error " << ret << dendl;
derr << "OSD::mkfs: ObjectStore::mkfs failed with error "
<< cpp_strerror(ret) << dendl;
goto free_store;
}
@ -1725,7 +1726,8 @@ int OSD::mkfs(CephContext *cct, ObjectStore *store, const string &dev,
ret = store->mount();
if (ret) {
derr << "OSD::mkfs: couldn't mount ObjectStore: error " << ret << dendl;
derr << "OSD::mkfs: couldn't mount ObjectStore: error "
<< cpp_strerror(ret) << dendl;
goto free_store;
}
@ -1764,7 +1766,7 @@ int OSD::mkfs(CephContext *cct, ObjectStore *store, const string &dev,
ret = store->apply_transaction(osr.get(), std::move(t));
if (ret) {
derr << "OSD::mkfs: error while writing OSD_SUPERBLOCK_GOBJECT: "
<< "apply_transaction returned " << ret << dendl;
<< "apply_transaction returned " << cpp_strerror(ret) << dendl;
goto umount_store;
}
}
@ -1775,7 +1777,8 @@ int OSD::mkfs(CephContext *cct, ObjectStore *store, const string &dev,
ret = write_meta(store, sb.cluster_fsid, sb.osd_fsid, whoami);
if (ret) {
derr << "OSD::mkfs: failed to write fsid file: error " << ret << dendl;
derr << "OSD::mkfs: failed to write fsid file: error "
<< cpp_strerror(ret) << dendl;
goto umount_store;
}