ObjectCacher: more debugging for BufferHeads

This is useful for checking for lost waiters.

Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
This commit is contained in:
Josh Durgin 2012-11-13 10:01:30 -08:00
parent efdb209b0b
commit fd928b9b71

View File

@ -598,7 +598,7 @@ public:
inline ostream& operator<<(ostream& out, ObjectCacher::BufferHead &bh)
{
out << "bh["
out << "bh[ " << &bh << " "
<< bh.start() << "~" << bh.length()
<< " " << bh.ob
<< " (" << bh.bl.length() << ")"
@ -612,6 +612,17 @@ inline ostream& operator<<(ostream& out, ObjectCacher::BufferHead &bh)
if (bh.bl.length() > 0) out << " firstbyte=" << (int)bh.bl[0];
if (bh.error) out << " error=" << bh.error;
out << "]";
out << " waiters = {";
for (map<loff_t, list<Context*> >::const_iterator it = bh.waitfor_read.begin();
it != bh.waitfor_read.end(); ++it) {
out << " " << it->first << "->[";
for (list<Context*>::const_iterator lit = it->second.begin();
lit != it->second.end(); ++lit) {
out << *lit << ", ";
}
out << "]";
}
out << "}";
return out;
}