#include "include/types.h"
#include "include/utime.h"
+#include "common/errno.h"
#include "WorkQueue.h"
#include "common/config.h"
_stop(false),
_pause(0),
_draining(0),
+ ioprio_class(-1),
+ ioprio_priority(-1),
_num_threads(n),
last_work_queue(0),
processing(0)
WorkThread *wt = new WorkThread(this);
ldout(cct, 10) << "start_threads creating and starting " << wt << dendl;
_threads.insert(wt);
+
+ int r = wt->set_ioprio(ioprio_class, ioprio_priority);
+ if (r < 0)
+ lderr(cct) << " set_ioprio got " << cpp_strerror(r) << dendl;
+
wt->create();
}
}
_lock.Unlock();
}
+void ThreadPool::set_ioprio(int cls, int priority)
+{
+ Mutex::Locker l(_lock);
+ ioprio_class = cls;
+ ioprio_priority = priority;
+ for (set<WorkThread*>::iterator p = _threads.begin();
+ p != _threads.end();
+ ++p) {
+ int r = (*p)->set_ioprio(cls, priority);
+ if (r < 0)
+ lderr(cct) << " set_ioprio got " << cpp_strerror(r) << dendl;
+ }
+}
int _pause;
int _draining;
Cond _wait_cond;
+ int ioprio_class, ioprio_priority;
public:
class TPHandle {
void unpause();
/// wait for all work to complete
void drain(WorkQueue_* wq = 0);
+
+ /// set io priority
+ void set_ioprio(int cls, int priority);
};
class GenContextWQ :