common/PrioritizedQueue: fix remove_by_class() corner case

If i is the first entry, then setting cur = begin() sets us up to point at
something that we are about to delete.  Move the check to the end to avoid
this.

Backport: emperor, dumpling
Signed-off-by: Sage Weil <sage@inktank.com>
common/PrioritizedQueue: constify a few things

Signed-off-by: Sage Weil <sage@inktank.com>
common/PrioritizedQueue: include first item's cost in dump

Signed-off-by: Sage Weil <sage@inktank.com>
osd: fix OpWQ dump locking

The pqueue is protected by the wq lock, not by qlock; for example, see
OpWQ::_enqueue.  qlock protects the pg_for_processing map only.

Fixes: #7735
Signed-off-by: Sage Weil <sage@inktank.com>
osd: dump priority queue state on dequeue at level 30

Signed-off-by: Sage Weil <sage@inktank.com>
Merge pull request #1510 from ceph/wip-pq

osd: some PrioritizedQueue cleanups; dump locking fix; debug pqueue state at high debug level

Reviewed-by: Samuel Just <sam.just@inktank.com>