Skip to content

Commit

Permalink
common,osd: remove _process(T *t) to silence warnings
Browse files Browse the repository at this point in the history
* and mark the WorkQueue::_process(T *, TPHandle&) a pure virtual
  method. so we must override it
* and mark all override methods with the "override" specifier.

Signed-off-by: Kefu Chai <kchai@redhat.com>
  • Loading branch information
tchaikov committed Jan 31, 2016
1 parent f8adf40 commit ef94d68
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 35 deletions.
19 changes: 5 additions & 14 deletions src/common/WorkQueue.h
Expand Up @@ -126,10 +126,7 @@ class ThreadPool : public md_config_obs_t {
}

protected:
virtual void _process(const list<T*> &) { assert(0); }
virtual void _process(const list<T*> &items, TPHandle &handle) {
_process(items);
}
virtual void _process(const list<T*> &items, TPHandle &handle) = 0;

public:
BatchWorkQueue(string n, time_t ti, time_t sti, ThreadPool* p)
Expand Down Expand Up @@ -257,10 +254,7 @@ class ThreadPool : public md_config_obs_t {
void unlock() {
pool->unlock();
}
virtual void _process(U) { assert(0); }
virtual void _process(U u, TPHandle &) {
_process(u);
}
virtual void _process(U u, TPHandle &) = 0;
};

/** @brief Template by-pointer work queue.
Expand Down Expand Up @@ -293,10 +287,7 @@ class ThreadPool : public md_config_obs_t {

protected:
/// Process a work item. Called from the worker threads.
virtual void _process(T *t) { assert(0); }
virtual void _process(T *t, TPHandle &) {
_process(t);
}
virtual void _process(T *t, TPHandle &) = 0;

public:
WorkQueue(string n, time_t ti, time_t sti, ThreadPool* p) : WorkQueue_(n, ti, sti), pool(p) {
Expand Down Expand Up @@ -555,8 +546,8 @@ class GenContextWQ :
_queue.pop_front();
return c;
}
using ThreadPool::WorkQueueVal<GenContext<ThreadPool::TPHandle&>*>::_process;
void _process(GenContext<ThreadPool::TPHandle&> *c, ThreadPool::TPHandle &tp) {
void _process(GenContext<ThreadPool::TPHandle&> *c,
ThreadPool::TPHandle &tp) override {
c->complete(tp);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/compressor/AsyncCompressor.h
Expand Up @@ -85,7 +85,7 @@ class AsyncCompressor {
}
return item;
}
void _process(Job *item, ThreadPool::TPHandle &handle) {
void _process(Job *item, ThreadPool::TPHandle &) override {
assert(item->status.read() == WORKING);
bufferlist out;
int r;
Expand Down
3 changes: 1 addition & 2 deletions src/os/bluestore/BlueStore.h
Expand Up @@ -427,11 +427,10 @@ class BlueStore : public ObjectStore {
i->osr->wal_apply_lock.Lock();
return i;
}
void _process(TransContext *i, ThreadPool::TPHandle &handle) {
void _process(TransContext *i, ThreadPool::TPHandle &) override {
store->_wal_apply(i);
i->osr->wal_apply_lock.Unlock();
}
using ThreadPool::WorkQueue<TransContext>::_process;
void _clear() {
assert(wal_queue.empty());
}
Expand Down
15 changes: 5 additions & 10 deletions src/osd/OSD.h
Expand Up @@ -1783,15 +1783,14 @@ class OSD : public Dispatcher,
void _dequeue(list<PG*> *out);
void _process(
const list<PG *> &pgs,
ThreadPool::TPHandle &handle) {
ThreadPool::TPHandle &handle) override {
osd->process_peering_events(pgs, handle);
for (list<PG *>::const_iterator i = pgs.begin();
i != pgs.end();
++i) {
(*i)->put("PeeringWQ");
}
}
using ThreadPool::BatchWorkQueue<PG>::_process;
void _process_finish(const list<PG *> &pgs) {
for (list<PG*>::const_iterator i = pgs.begin();
i != pgs.end();
Expand Down Expand Up @@ -2135,7 +2134,7 @@ class OSD : public Dispatcher,
osd->command_queue.pop_front();
return c;
}
void _process(Command *c) {
void _process(Command *c, ThreadPool::TPHandle &) override {
osd->osd_lock.Lock();
if (osd->is_stopping()) {
osd->osd_lock.Unlock();
Expand All @@ -2146,9 +2145,6 @@ class OSD : public Dispatcher,
osd->osd_lock.Unlock();
delete c;
}
void _process(Command *c, ThreadPool::TPHandle &tp) {
_process(c);
}
void _clear() {
while (!osd->command_queue.empty()) {
Command *c = osd->command_queue.front();
Expand Down Expand Up @@ -2200,11 +2196,10 @@ class OSD : public Dispatcher,
osd->recovery_queue.push_front(&pg->recovery_item);
}
}
void _process(PG *pg, ThreadPool::TPHandle &handle) {
void _process(PG *pg, ThreadPool::TPHandle &handle) override {
osd->do_recovery(pg, handle);
pg->put("RecoveryWQ");
}
using ThreadPool::WorkQueue<PG>::_process;
void _clear() {
while (!osd->recovery_queue.empty()) {
PG *pg = osd->recovery_queue.front();
Expand Down Expand Up @@ -2259,8 +2254,8 @@ class OSD : public Dispatcher,
remove_queue.pop_front();
return item;
}
using ThreadPool::WorkQueueVal<pair<PGRef, DeletingStateRef> >::_process;
void _process(pair<PGRef, DeletingStateRef>, ThreadPool::TPHandle &);
void _process(pair<PGRef, DeletingStateRef>,
ThreadPool::TPHandle &) override;
void _clear() {
remove_queue.clear();
}
Expand Down
3 changes: 1 addition & 2 deletions src/rgw/rgw_main.cc
Expand Up @@ -215,8 +215,7 @@ class RGWProcess {
perfcounter->inc(l_rgw_qlen, -1);
return req;
}
using ThreadPool::WorkQueue<RGWRequest>::_process;
void _process(RGWRequest *req) {
void _process(RGWRequest *req, ThreadPool::TPHandle &) override {
perfcounter->inc(l_rgw_qactive);
process->handle_request(req);
process->req_throttle.put(1);
Expand Down
3 changes: 1 addition & 2 deletions src/test/bench/dumb_backend.h
Expand Up @@ -84,8 +84,7 @@ class DumbBackend : public Backend {
bool _empty() {
return item_queue.empty();
}
using ThreadPool::WorkQueue<write_item>::_process;
void _process(write_item *item) {
void _process(write_item *item, ThreadPool::TPHandle &) override {
return backend->_write(
item->oid,
item->offset,
Expand Down
3 changes: 1 addition & 2 deletions src/test/bench/tp_bench.cc
Expand Up @@ -93,8 +93,7 @@ class PassAlong : public ThreadPool::WorkQueue<unsigned> {
q.pop_front();
return val;
}
using ThreadPool::WorkQueue<unsigned>::_process;
void _process(unsigned *item) {
void _process(unsigned *item, ThreadPool::TPHandle &) override {
next->queue(item);
}
void _clear() { q.clear(); }
Expand Down
3 changes: 1 addition & 2 deletions src/test/msgr/perf_msgr_server.cc
Expand Up @@ -58,8 +58,7 @@ class ServerDispatcher : public Dispatcher {
messages.pop_front();
return m;
}
using ThreadPool::WorkQueue<Message>::_process;
void _process(Message *m, ThreadPool::TPHandle &handle) {
void _process(Message *m, ThreadPool::TPHandle &handle) override {
MOSDOp *osd_op = static_cast<MOSDOp*>(m);
MOSDOpReply *reply = new MOSDOpReply(osd_op, 0, 0, 0, false);
m->get_connection()->send_message(reply);
Expand Down

0 comments on commit ef94d68

Please sign in to comment.