osd,common: avoid casting useless casts

no need to cast a variable of type `Foo` to `Foo`, for example, 2.000 is
of type `double`, so (double)2.000 does not make sense.

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2017-10-06 18:11:46 +08:00
parent 69f48f4663
commit aa3ea0b244
8 changed files with 12 additions and 12 deletions

View File

@ -21,7 +21,7 @@ using namespace rados::cls::lock;
static void generate_lock_id(locker_id_t& i, int n, const string& cookie)
{
i.locker = entity_name_t(entity_name_t::CLIENT(n));
i.locker = entity_name_t::CLIENT(n);
i.cookie = cookie;
}
@ -77,7 +77,7 @@ void cls_lock_break_op::generate_test_instances(list<cls_lock_break_op*>& o)
cls_lock_break_op *i = new cls_lock_break_op;
i->name = "name";
i->cookie = "cookie";
i->locker = entity_name_t(entity_name_t::CLIENT(1));
i->locker = entity_name_t::CLIENT(1);
o.push_back(i);
o.push_back(new cls_lock_break_op);
}

View File

@ -20,7 +20,7 @@ using namespace rados::cls::lock;
static void generate_lock_id(locker_id_t& i, int n, const string& cookie)
{
i.locker = entity_name_t(entity_name_t::CLIENT(n));
i.locker = entity_name_t::CLIENT(n);
i.cookie = cookie;
}

View File

@ -62,7 +62,7 @@ class Finisher {
struct FinisherThread : public Thread {
Finisher *fin;
explicit FinisherThread(Finisher *f) : fin(f) {}
void* entry() override { return (void*)fin->finisher_thread_entry(); }
void* entry() override { return fin->finisher_thread_entry(); }
} finisher_thread;
public:

View File

@ -79,7 +79,7 @@ public:
}
void set_from_double(double d) {
tv.tv_sec = (__u32)trunc(d);
tv.tv_nsec = (__u32)((d - (double)tv.tv_sec) * (double)1000000000.0);
tv.tv_nsec = (__u32)((d - (double)tv.tv_sec) * 1000000000.0);
}
real_time to_real_time() const {
@ -404,7 +404,7 @@ inline utime_t& operator+=(utime_t& l, const utime_t& r) {
}
inline utime_t& operator+=(utime_t& l, double f) {
double fs = trunc(f);
double ns = (f - fs) * (double)1000000000.0;
double ns = (f - fs) * 1000000000.0;
l.sec_ref() += (long)fs;
l.nsec_ref() += (long)ns;
l.normalize();
@ -427,7 +427,7 @@ inline utime_t& operator-=(utime_t& l, const utime_t& r) {
}
inline utime_t& operator-=(utime_t& l, double f) {
double fs = trunc(f);
double ns = (f - fs) * (double)1000000000.0;
double ns = (f - fs) * 1000000000.0;
l.sec_ref() -= (long)fs;
long nsl = (long)ns;
if (nsl) {

View File

@ -351,7 +351,7 @@ int FileJournal::create()
goto free_buf;
}
needed_space = ((int64_t)cct->_conf->osd_max_write_size) << 20;
needed_space = cct->_conf->osd_max_write_size << 20;
needed_space += (2 * sizeof(entry_header_t)) + get_top();
if (header.max_size - header.start < needed_space) {
derr << "FileJournal::create: OSD journal is not large enough to hold "

View File

@ -353,7 +353,7 @@ public:
return (double)fpp_micro / 1000000.0;
}
void set_fpp(double f) {
fpp_micro = (unsigned)(llrintl(f * (double)1000000.0));
fpp_micro = (unsigned)(llrintl(f * 1000000.0));
}
void encode(bufferlist& bl) const override {
@ -424,7 +424,7 @@ public:
}
void seal() override {
// aim for a density of .5 (50% of bit set)
double pc = (double)bloom.density() * 2.0;
double pc = bloom.density() * 2.0;
if (pc < 1.0)
bloom.compress(pc);
}

View File

@ -1159,7 +1159,7 @@ public:
void get_pool_ids_by_rule(int rule_id, set<int64_t> *pool_ids) const {
assert(pool_ids);
for (auto &p: pools) {
if ((int)p.second.get_crush_rule() == rule_id) {
if (p.second.get_crush_rule() == rule_id) {
pool_ids->insert(p.first);
}
}

View File

@ -2097,7 +2097,7 @@ void Objecter::_linger_ops_resend(map<uint64_t, LingerOp *>& lresend,
op->put();
lresend.erase(lresend.begin());
}
ul = unique_lock(sul.release_to_unique());
ul = sul.release_to_unique();
}
void Objecter::start_tick()