Skip to content

Commit

Permalink
Merge remote-tracking branch 'gh/firefly'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sage Weil committed Feb 23, 2014
2 parents 57eeebe + 24c89bf commit 0e50f7a
Show file tree
Hide file tree
Showing 56 changed files with 1,070 additions and 741 deletions.
2 changes: 1 addition & 1 deletion ceph-object-corpus
Submodule ceph-object-corpus updated from 84a153 to d9870c
8 changes: 4 additions & 4 deletions src/client/Client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2272,7 +2272,7 @@ void Client::put_cap_ref(Inode *in, int cap)
if (last) {
if (in->snapid == CEPH_NOSNAP) {
if ((cap & CEPH_CAP_FILE_WR) &&
in->cap_snaps.size() &&
!in->cap_snaps.empty() &&
in->cap_snaps.rbegin()->second->writing) {
ldout(cct, 10) << "put_cap_ref finishing pending cap_snap on " << *in << dendl;
in->cap_snaps.rbegin()->second->writing = 0;
Expand Down Expand Up @@ -2455,7 +2455,7 @@ void Client::check_caps(Inode *in, bool is_delayed)
if (in->caps.empty())
return; // guard if at end of func

if (in->cap_snaps.size())
if (!in->cap_snaps.empty())
flush_snaps(in);

if (!is_delayed)
Expand Down Expand Up @@ -2983,7 +2983,7 @@ void Client::remove_cap(Cap *cap)

void Client::remove_all_caps(Inode *in)
{
while (in->caps.size())
while (!in->caps.empty())
remove_cap(in->caps.begin()->second);
}

Expand Down Expand Up @@ -6818,7 +6818,7 @@ int Client::ll_lookup(Inode *parent, const char *name, struct stat *attr,
Inode *in;
int r = 0;

r = _lookup(parent, dname.c_str(), &in);
r = _lookup(parent, dname, &in);
if (r < 0) {
attr->st_ino = 0;
goto out;
Expand Down
4 changes: 2 additions & 2 deletions src/client/barrier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ void BarrierContext::write_barrier(C_Block_Sync &cbs)
{
Mutex::Locker locker(lock);
barrier_interval &iv = cbs.iv;
bool done = false;

{ /* find blocking commit--intrusive no help here */
BarrierList::iterator iter;
bool done = false;
for (iter = active_commits.begin();
!done && (iter != active_commits.end());
++iter) {
Expand Down Expand Up @@ -131,7 +131,7 @@ void BarrierContext::commit_barrier(barrier_interval &civ)
barrier->span.insert(iv);
/* avoid iter invalidate */
} else {
iter++;
++iter;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/common/ceph_argparse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void env_to_vec(std::vector<const char*>& args, const char *name)
get_str_vec(p, " ", str_vec);
for (vector<string>::iterator i = str_vec.begin();
i != str_vec.end();
i++)
++i)
args.push_back(i->c_str());
}

Expand Down
2 changes: 1 addition & 1 deletion src/common/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ bool md_config_t::expand_meta(std::string &origval,
*oss << "expansion stack: " << std::endl;
for (list<config_option *>::iterator j = stack.begin();
j != stack.end();
j++) {
++j) {
*oss << (*j)->name << "=" << *(string *)(*j)->conf_ptr(this) << std::endl;
}
return false;
Expand Down
7 changes: 7 additions & 0 deletions src/common/config_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,13 @@ OPTION(journal_dio, OPT_BOOL, true)
OPTION(journal_aio, OPT_BOOL, true)
OPTION(journal_force_aio, OPT_BOOL, false)

OPTION(keyvaluestore_queue_max_ops, OPT_INT, 50)
OPTION(keyvaluestore_queue_max_bytes, OPT_INT, 100 << 20)
OPTION(keyvaluestore_debug_check_backend, OPT_BOOL, 0) // Expensive debugging check on sync
OPTION(keyvaluestore_op_threads, OPT_INT, 2)
OPTION(keyvaluestore_op_thread_timeout, OPT_INT, 60)
OPTION(keyvaluestore_op_thread_suicide_timeout, OPT_INT, 180)

// max bytes to search ahead in journal searching for corruption
OPTION(journal_max_corrupt_search, OPT_U64, 10<<20)
OPTION(journal_block_align, OPT_BOOL, true)
Expand Down
5 changes: 0 additions & 5 deletions src/common/hobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ struct hobject_t {
return ret;
}

/// @return true if object is snapdir
bool is_snapdir() const {
return snap == CEPH_SNAPDIR;
}

/// @return snapdir version of this hobject_t
hobject_t get_snapdir() const {
hobject_t ret(*this);
Expand Down
2 changes: 1 addition & 1 deletion src/common/str_map.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int get_str_map(const string &str,

list<string> pairs;
get_str_list(str, "\t\n ", pairs);
for (list<string>::iterator i = pairs.begin(); i != pairs.end(); i++) {
for (list<string>::iterator i = pairs.begin(); i != pairs.end(); ++i) {
size_t equal = i->find('=');
if (equal == string::npos)
(*str_map)[*i] = string();
Expand Down
4 changes: 2 additions & 2 deletions src/crush/CrushWrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1409,9 +1409,9 @@ bool CrushWrapper::is_valid_crush_name(const string& s)
}

bool CrushWrapper::is_valid_crush_loc(CephContext *cct,
const map<string,string> loc)
const map<string,string>& loc)
{
for (map<string,string>::const_iterator l = loc.begin(); l != loc.end(); l++) {
for (map<string,string>::const_iterator l = loc.begin(); l != loc.end(); ++l) {
if (!is_valid_crush_name(l->first) ||
!is_valid_crush_name(l->second)) {
ldout(cct, 1) << "loc["
Expand Down
2 changes: 1 addition & 1 deletion src/crush/CrushWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ class CrushWrapper {

static bool is_valid_crush_name(const string& s);
static bool is_valid_crush_loc(CephContext *cct,
const map<string,string> loc);
const map<string,string>& loc);
};
WRITE_CLASS_ENCODER(CrushWrapper)

Expand Down
3 changes: 3 additions & 0 deletions src/include/rados/librados.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ namespace librados
ObjectIterator() {}
ObjectIterator(ObjListCtx *ctx_);
~ObjectIterator();
ObjectIterator(const ObjectIterator &rhs);
ObjectIterator& operator=(const ObjectIterator& rhs);

bool operator==(const ObjectIterator& rhs) const;
bool operator!=(const ObjectIterator& rhs) const;
const std::pair<std::string, std::string>& operator*() const;
Expand Down
15 changes: 4 additions & 11 deletions src/init-ceph.in
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ fi
for name in $what; do
type=`echo $name | cut -c 1-3` # e.g. 'mon', if $item is 'mon1'
id=`echo $name | cut -c 4- | sed 's/^\\.//'`
cluster=`echo $conf | awk -F'/' '{print $(NF)}' | cut -d'.' -f 1`
num=$id
name="$type.$id"

Expand Down Expand Up @@ -269,7 +270,7 @@ for name in $what; do
[ -n "$wrap" ] && runmode="-f &" && runarg="-f"
[ -n "$max_open_files" ] && files="ulimit -n $max_open_files;"

cmd="$files $wrap $cmd $runmode"
cmd="$files $wrap $cmd --cluster $cluster $runmode"

if [ $dofsmount -eq 1 ] && [ -n "$fs_devs" ]; then
get_conf pre_mount "true" "pre mount command"
Expand Down Expand Up @@ -322,17 +323,9 @@ for name in $what; do
get_conf osd_location_hook "$BINDIR/ceph-crush-location" "osd crush location hook"
osd_location=`$osd_location_hook --cluster ceph --id $id --type osd`
get_conf osd_weight "" "osd crush initial weight"
defaultweight="$(do_cmd "df -P -k $osd_data/. | tail -1 | awk '{ d= \$2/1073741824 ; r = sprintf(\"%.2f\", d); print r }'")"
defaultweight="$(df -P -k $osd_data/. | tail -1 | awk '{ d=$2/1073741824 ; r = sprintf(\"%.2f\", d); print r }')"
get_conf osd_keyring "$osd_data/keyring" "keyring"
do_cmd "timeout 10 $BINDIR/ceph \
-c $conf \
--name=osd.$id \
--keyring=$osd_keyring \
osd crush create-or-move \
-- \
$id \
${osd_weight:-${defaultweight:-1}} \
$osd_location"
do_cmd "timeout 10 $BINDIR/ceph -c $conf --name=osd.$id --keyring=$osd_keyring osd crush create-or-move -- $id ${osd_weight:-${defaultweight:-1}} $osd_location"
fi
fi

Expand Down
28 changes: 23 additions & 5 deletions src/librados/librados.cc
Original file line number Diff line number Diff line change
Expand Up @@ -480,12 +480,31 @@ librados::ObjectIterator::~ObjectIterator()
ctx.reset();
}

librados::ObjectIterator::ObjectIterator(const ObjectIterator &rhs)
{
*this = rhs;
}

librados::ObjectIterator& librados::ObjectIterator::operator=(const librados::ObjectIterator &rhs)
{
if (&rhs == this)
return *this;
Objecter::ListContext *list_ctx = new Objecter::ListContext(*rhs.ctx->lc);
ctx.reset(new ObjListCtx(rhs.ctx->ctx, list_ctx));
cur_obj = rhs.cur_obj;
return *this;
}

bool librados::ObjectIterator::operator==(const librados::ObjectIterator& rhs) const {
return (ctx.get() == rhs.ctx.get());
if (ctx.get() == NULL)
return rhs.ctx.get() == NULL || rhs.ctx->lc->at_end();
if (rhs.ctx.get() == NULL)
return ctx.get() == NULL || ctx->lc->at_end();
return ctx.get() == rhs.ctx.get();
}

bool librados::ObjectIterator::operator!=(const librados::ObjectIterator& rhs) const {
return (ctx.get() != rhs.ctx.get());
return !(*this == rhs);
}

const pair<std::string, std::string>& librados::ObjectIterator::operator*() const {
Expand Down Expand Up @@ -519,10 +538,10 @@ uint32_t librados::ObjectIterator::seek(uint32_t pos)
void librados::ObjectIterator::get_next()
{
const char *entry, *key;
if (ctx->lc->at_end())
return;
int ret = rados_objects_list_next(ctx.get(), &entry, &key);
if (ret == -ENOENT) {
ctx.reset();
*this = __EndObjectIterator;
return;
}
else if (ret) {
Expand Down Expand Up @@ -1227,7 +1246,6 @@ librados::ObjectIterator librados::IoCtx::objects_begin(uint32_t pos)
rados_objects_list_open(io_ctx_impl, &listh);
ObjectIterator iter((ObjListCtx*)listh);
iter.seek(pos);
iter.get_next();
return iter;
}

Expand Down
2 changes: 1 addition & 1 deletion src/mds/MDCache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11641,7 +11641,7 @@ void MDCache::_fragment_stored(MDRequest *mdr)
// freshly replicate new dirs to peers
for (list<CDir*>::iterator q = info.resultfrags.begin();
q != info.resultfrags.end();
q++)
++q)
replicate_dir(*q, p->first, notify->basebl);

mds->send_message_mds(notify, p->first);
Expand Down
4 changes: 2 additions & 2 deletions src/mon/MonClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -962,15 +962,15 @@ int MonClient::start_mon_command(const vector<string>& cmd,
return 0;
}

int MonClient::start_mon_command(string name,
int MonClient::start_mon_command(const string &mon_name,
const vector<string>& cmd,
const bufferlist& inbl,
bufferlist *outbl, string *outs,
Context *onfinish)
{
Mutex::Locker l(monc_lock);
MonCommand *r = new MonCommand(++last_mon_command_tid);
r->target_name = name;
r->target_name = mon_name;
r->cmd = cmd;
r->inbl = inbl;
r->poutbl = outbl;
Expand Down
2 changes: 1 addition & 1 deletion src/mon/MonClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ class MonClient : public Dispatcher {
const vector<string>& cmd, const bufferlist& inbl,
bufferlist *outbl, string *outs,
Context *onfinish);
int start_mon_command(const string mon_name, ///< mon name, with mon. prefix
int start_mon_command(const string &mon_name, ///< mon name, with mon. prefix
const vector<string>& cmd, const bufferlist& inbl,
bufferlist *outbl, string *outs,
Context *onfinish);
Expand Down
2 changes: 1 addition & 1 deletion src/mon/Monitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2021,7 +2021,7 @@ const MonCommand *Monitor::_get_moncommand(const string &cmd_prefix,

bool Monitor::_allowed_command(MonSession *s, string &module, string &prefix,
const map<string,cmd_vartype>& cmdmap,
const map<string,string> param_str_map,
const map<string,string>& param_str_map,
const MonCommand *this_cmd) {

bool cmd_r = (this_cmd->req_perms.find('r') != string::npos);
Expand Down
2 changes: 1 addition & 1 deletion src/mon/Monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ class Monitor : public Dispatcher {
MonCommand *cmds, int cmds_size);
bool _allowed_command(MonSession *s, string &module, string &prefix,
const map<string,cmd_vartype>& cmdmap,
const map<string,string> param_str_map,
const map<string,string>& param_str_map,
const MonCommand *this_cmd);
void _mon_status(Formatter *f, ostream& ss);
void _quorum_status(Formatter *f, ostream& ss);
Expand Down
4 changes: 2 additions & 2 deletions src/mon/OSDMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ bool OSDMonitor::should_propose(double& delay)
return true;

// adjust osd weights?
if (osd_weight.size() > 0 &&
if (!osd_weight.empty() &&
osd_weight.size() == (unsigned)osdmap.get_max_osd()) {
dout(0) << " adjusting osd weights based on " << osd_weight << dendl;
osdmap.adjust_osd_weights(osd_weight, pending_inc);
Expand Down Expand Up @@ -2786,7 +2786,7 @@ int OSDMonitor::check_cluster_features(uint64_t features,
set<int32_t> up_osds;
osdmap.get_up_osds(up_osds);
for (set<int32_t>::iterator it = up_osds.begin();
it != up_osds.end(); it ++) {
it != up_osds.end(); ++it) {
const osd_xinfo_t &xi = osdmap.get_xinfo(*it);
if (!(xi.features & features)) {
if (unsupported_count > 0)
Expand Down
2 changes: 1 addition & 1 deletion src/mon/PGMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ bool PGMonitor::preprocess_command(MMonCommand *m)
r = -ENOENT;
goto reply;
}
if (pg_map.pg_stat[pgid].acting_primary != -1) {
if (pg_map.pg_stat[pgid].acting_primary == -1) {
ss << "pg " << pgid << " has no primary osd";
r = -EAGAIN;
goto reply;
Expand Down
2 changes: 1 addition & 1 deletion src/os/DBObjectMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ int DBObjectMap::clear_keys_header(const ghobject_t &oid,
// create new header
Header newheader = generate_new_header(oid, Header());
set_map_header(oid, *newheader, t);
if (attrs.size())
if (!attrs.empty())
t->set(xattr_prefix(newheader), attrs);
return db->submit_transaction(t);
}
Expand Down
2 changes: 1 addition & 1 deletion src/os/FileStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3632,7 +3632,7 @@ int FileStore::_setattrs(coll_t cid, const ghobject_t& oid, map<string,bufferptr
inline_to_set.insert(*p);
}

if (spill_out != 1 && omap_set.size()) {
if (spill_out != 1 && !omap_set.empty()) {
chain_fsetxattr(**fd, XATTR_SPILL_OUT_NAME, XATTR_SPILL_OUT,
sizeof(XATTR_SPILL_OUT));
}
Expand Down
27 changes: 0 additions & 27 deletions src/os/FileStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,33 +63,6 @@ static const __SWORD_TYPE XFS_SUPER_MAGIC(0x58465342);
static const __SWORD_TYPE ZFS_SUPER_MAGIC(0x2fc12fc1);
#endif

enum {
l_os_first = 84000,
l_os_jq_max_ops,
l_os_jq_ops,
l_os_j_ops,
l_os_jq_max_bytes,
l_os_jq_bytes,
l_os_j_bytes,
l_os_j_lat,
l_os_j_wr,
l_os_j_wr_bytes,
l_os_oq_max_ops,
l_os_oq_ops,
l_os_ops,
l_os_oq_max_bytes,
l_os_oq_bytes,
l_os_bytes,
l_os_apply_lat,
l_os_committing,
l_os_commit,
l_os_commit_len,
l_os_commit_lat,
l_os_j_full,
l_os_queue_lat,
l_os_last,
};


enum fs_types {
FS_TYPE_NONE = 0,
Expand Down
Loading

0 comments on commit 0e50f7a

Please sign in to comment.