From ea1a787c65e6fb3f8e23df3b3f8b9ad535b3b7b5 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 23 May 2016 15:16:38 -0400 Subject: [PATCH] os/bluestore: ~0x -> ~ e.g., 0x432da000~1000 instead of 0x432da000~0x1000 I think it's sufficiently clear that the value after ~ should have the same base as the first bit, and it's easier to read. And less text. Signed-off-by: Sage Weil --- src/os/bluestore/BitmapFreelistManager.cc | 10 ++-- src/os/bluestore/BlueStore.cc | 60 +++++++++++------------ src/os/bluestore/KernelDevice.cc | 28 +++++------ src/os/bluestore/bluestore_types.cc | 10 ++-- 4 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/os/bluestore/BitmapFreelistManager.cc b/src/os/bluestore/BitmapFreelistManager.cc index dedc4e35e2362..c51b702aa2cb8 100644 --- a/src/os/bluestore/BitmapFreelistManager.cc +++ b/src/os/bluestore/BitmapFreelistManager.cc @@ -283,7 +283,7 @@ bool BitmapFreelistManager::enumerate_next(uint64_t *offset, uint64_t *length) << dendl; *length = end - *offset; assert((*offset + *length) <= size); - dout(10) << __func__ << std::hex << " 0x" << *offset << "~0x" << *length + dout(10) << __func__ << std::hex << " 0x" << *offset << "~" << *length << std::dec << dendl; return true; } @@ -305,7 +305,7 @@ bool BitmapFreelistManager::enumerate_next(uint64_t *offset, uint64_t *length) end = size; if (enumerate_offset < end) { *length = end - *offset; - dout(10) << __func__ << std::hex << " 0x" << *offset << "~0x" << *length + dout(10) << __func__ << std::hex << " 0x" << *offset << "~" << *length << std::dec << dendl; enumerate_offset = end; assert((*offset + *length) <= size); @@ -321,7 +321,7 @@ void BitmapFreelistManager::dump() enumerate_reset(); uint64_t offset, length; while (enumerate_next(&offset, &length)) { - dout(20) << __func__ << " 0x" << std::hex << offset << "~0x" << length + dout(20) << __func__ << " 0x" << std::hex << offset << "~" << length << std::dec << dendl; } } @@ -451,7 +451,7 @@ void BitmapFreelistManager::allocate( uint64_t offset, uint64_t length, KeyValueDB::Transaction txn) { - dout(10) << __func__ << " 0x" << std::hex << offset << "~0x" << length + dout(10) << __func__ << " 0x" << std::hex << offset << "~" << length << std::dec << dendl; if (g_conf->bluestore_debug_freelist) _verify_range(offset, length, 0); @@ -462,7 +462,7 @@ void BitmapFreelistManager::release( uint64_t offset, uint64_t length, KeyValueDB::Transaction txn) { - dout(10) << __func__ << " 0x" << std::hex << offset << "~0x" << length + dout(10) << __func__ << " 0x" << std::hex << offset << "~" << length << std::dec << dendl; if (g_conf->bluestore_debug_freelist) _verify_range(offset, length, 1); diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 2526ae3d58691..2aaae967a9967 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -1131,7 +1131,7 @@ int BlueStore::_open_fm(bool create) l = ROUND_UP_TO(l, min_alloc_size); uint64_t u = 1 + (uint64_t)(r * (double)l / (1.0 - r)); u = ROUND_UP_TO(u, min_alloc_size); - dout(20) << " free 0x" << std::hex << start << "~0x" << l + dout(20) << " free 0x" << std::hex << start << "~" << l << " use 0x" << u << std::dec << dendl; fm->allocate(start + l, u, t); start += l + u; @@ -2574,7 +2574,7 @@ int BlueStore::fsck() while (fm->enumerate_next(&offset, &length)) { if (used_blocks.intersects(offset, length)) { derr << __func__ << " free extent 0x" << std::hex << offset - << "~0x" << length << std::dec + << "~" << length << std::dec << " intersects allocated blocks" << dendl; interval_set free, overlap; free.insert(offset, length); @@ -2792,7 +2792,7 @@ int BlueStore::read( Collection *c = static_cast(c_.get()); const coll_t &cid = c->get_cid(); dout(15) << __func__ << " " << cid << " " << oid - << " 0x" << std::hex << offset << "~0x" << length << std::dec + << " 0x" << std::hex << offset << "~" << length << std::dec << dendl; if (!c->exists) return -ENOENT; @@ -2815,7 +2815,7 @@ int BlueStore::read( out: dout(10) << __func__ << " " << cid << " " << oid - << " 0x" << std::hex << offset << "~0x" << length << std::dec + << " 0x" << std::hex << offset << "~" << length << std::dec << " = " << r << dendl; return r; } @@ -2844,7 +2844,7 @@ int BlueStore::_do_read( buffered = true; } - dout(20) << __func__ << " 0x" << std::hex << offset << "~0x" << length + dout(20) << __func__ << " 0x" << std::hex << offset << "~" << length << " size 0x" << o->onode.size << " (" << std::dec << o->onode.size << ")" << dendl; bl.clear(); @@ -3087,7 +3087,7 @@ int BlueStore::_read_extent_sparse( if (r < 0) { dout(20) << __func__ << " blob reading 0x" << std::hex << cur->logical_offset << " 0x" - << cur->blob_xoffset << "~0x" << bl.length() + << cur->blob_xoffset << "~" << bl.length() << " csum verification failed" << dendl; return -EIO; } @@ -3227,7 +3227,7 @@ int BlueStore::fiemap( } _dump_onode(o); - dout(20) << __func__ << " 0x" << std::hex << offset << "~0x" << length + dout(20) << __func__ << " 0x" << std::hex << offset << "~" << length << " size 0x" << o->onode.size << std::dec << dendl; map::iterator ep, eend; @@ -3254,7 +3254,7 @@ int BlueStore::fiemap( if (ep != eend && ep->first <= offset) { uint64_t x_off = offset - ep->first; x_len = MIN(x_len, ep->second.length - x_off); - dout(30) << __func__ << " lextent 0x" << std::hex << offset << "~0x" + dout(30) << __func__ << " lextent 0x" << std::hex << offset << "~" << x_len << std::dec << " blob " << ep->second.blob << dendl; m.insert(offset, x_len); length -= x_len; @@ -3274,7 +3274,7 @@ int BlueStore::fiemap( out: ::encode(m, bl); - dout(20) << __func__ << " 0x" << std::hex << offset << "~0x" << length + dout(20) << __func__ << " 0x" << std::hex << offset << "~" << length << " size = 0 (" << m << ")" << std::dec << dendl; return 0; } @@ -4302,7 +4302,7 @@ void BlueStore::_txc_finalize_kv(TransContext *txc, KeyValueDB::Transaction t) p != preleased->end(); ++p) { dout(20) << __func__ << " release 0x" << std::hex << p.get_start() - << "~0x" << p.get_len() << std::dec << dendl; + << "~" << p.get_len() << std::dec << dendl; fm->release(p.get_start(), p.get_len(), t); } @@ -5024,7 +5024,7 @@ int BlueStore::_do_overlay_trim(TransContext *txc, uint64_t length) { dout(10) << __func__ << " " << o->oid << " 0x" - << std::hex << offset << "~0x" << length << std::dec << dendl; + << std::hex << offset << "~" << length << std::dec << dendl; int changed = 0; map::iterator p = @@ -5102,7 +5102,7 @@ int BlueStore::_do_overlay_write(TransContext *txc, _do_overlay_trim(txc, o, offset, length); dout(10) << __func__ << " " << o->oid << " 0x" - << std::hex << offset << "~0x" << length << std::dec << dendl; + << std::hex << offset << "~" << length << std::dec << dendl; bluestore_overlay_t& ov = o->onode.overlay_map[offset] = bluestore_overlay_t(++o->onode.last_overlay_key, 0, length); dout(20) << __func__ << " added 0x" << std::hex << offset << std::dec @@ -5196,7 +5196,7 @@ void BlueStore::_dump_onode(OnodeRef o, int log_level) dout(log_level) << __func__ << " buffer_cache size 0x" << std::hex << o->bc.size << std::dec << dendl; for (auto& i : o->bc.buffer_map) { - dout(log_level) << __func__ << " 0x" << std::hex << i.first << "~0x" + dout(log_level) << __func__ << " 0x" << std::hex << i.first << "~" << i.second->length << std::dec << " seq " << i.second->seq << " " << Buffer::get_state_name(i.second->state) @@ -5233,7 +5233,7 @@ void BlueStore::_pad_zeros( bufferlist *bl, uint64_t *offset, uint64_t *length, uint64_t chunk_size) { - dout(30) << __func__ << " 0x" << std::hex << *offset << "~0x" << *length + dout(30) << __func__ << " 0x" << std::hex << *offset << "~" << *length << " chunk_size 0x" << chunk_size << std::dec << dendl; dout(40) << "before:\n"; bl->hexdump(*_dout); @@ -5277,7 +5277,7 @@ void BlueStore::_pad_zeros( *length += back_pad; } dout(20) << __func__ << " pad 0x" << std::hex << front_pad << " + 0x" - << back_pad << " on front/back, now 0x" << *offset << "~0x" + << back_pad << " on front/back, now 0x" << *offset << "~" << *length << std::dec << dendl; dout(40) << "after:\n"; bl->hexdump(*_dout); @@ -5312,7 +5312,7 @@ void BlueStore::_pad_zeros_head( *offset -= front_pad; *length += front_pad; dout(20) << __func__ << " pad 0x" << std::hex << front_pad - << " on front, now 0x" << *offset << "~0x" << *length << std::dec + << " on front, now 0x" << *offset << "~" << *length << std::dec << dendl; dout(40) << "after:\n"; bl->hexdump(*_dout); @@ -5353,7 +5353,7 @@ void BlueStore::_pad_zeros_tail( bl->append(tail); *length += back_pad; dout(20) << __func__ << " pad 0x" << std::hex << back_pad - << " on back, now 0x" << offset << "~0x" << *length << std::dec + << " on back, now 0x" << offset << "~" << *length << std::dec << dendl; dout(40) << "after:\n"; bl->hexdump(*_dout); @@ -5375,7 +5375,7 @@ void BlueStore::_do_write_small( bufferlist::iterator& blp, WriteContext *wctx) { - dout(10) << __func__ << " 0x" << std::hex << offset << "~0x" << length + dout(10) << __func__ << " 0x" << std::hex << offset << "~" << length << std::dec << dendl; assert(length < min_alloc_size); @@ -5449,7 +5449,7 @@ void BlueStore::_do_write_small( (!b->has_csum_data() || (b_off % b->get_csum_block_size() == 0 && b_len % b->get_csum_block_size() == 0))) { dout(20) << __func__ << " write to unused 0x" << std::hex - << b_off << "~0x" << b_len + << b_off << "~" << b_len << " pad 0x" << head_pad << " + 0x" << tail_pad << std::dec << " of mutable " << blob << ": " << b << dendl; assert(b->is_unreferenced(b_off, b_len)); @@ -5523,7 +5523,7 @@ void BlueStore::_do_write_small( txc->add_deferred_csum(o, blob, b_off, padded); } op->data.claim(padded); - dout(20) << __func__ << " wal write 0x" << std::hex << b_off << "~0x" + dout(20) << __func__ << " wal write 0x" << std::hex << b_off << "~" << b_len << std::dec << " of mutable " << blob << ": " << *b << " at " << op->extents << dendl; o->onode.punch_hole(offset, length, &wctx->lex_old); @@ -5601,7 +5601,7 @@ void BlueStore::_do_write_big( if (wctx->compress) { max_blob_len = MIN(length, wctx->comp_blob_size); } - dout(10) << __func__ << " 0x" << std::hex << offset << "~0x" << length + dout(10) << __func__ << " 0x" << std::hex << offset << "~" << length << " max_blob_len 0x" << max_blob_len << std::dec << dendl; while (length > 0) { @@ -5767,7 +5767,7 @@ int BlueStore::_do_write( dout(20) << __func__ << " " << o->oid - << " 0x" << std::hex << offset << "~0x" << length + << " 0x" << std::hex << offset << "~" << length << " - have 0x" << o->onode.size << " (" << std::dec << o->onode.size << ")" << " bytes in " << o->onode.extent_map.size() << " lextents" @@ -5869,7 +5869,7 @@ int BlueStore::_write(TransContext *txc, uint32_t fadvise_flags) { dout(15) << __func__ << " " << c->cid << " " << o->oid - << " 0x" << std::hex << offset << "~0x" << length << std::dec + << " 0x" << std::hex << offset << "~" << length << std::dec << dendl; o->exists = true; _assign_nid(txc, o); @@ -5877,7 +5877,7 @@ int BlueStore::_write(TransContext *txc, txc->write_onode(o); dout(10) << __func__ << " " << c->cid << " " << o->oid - << " 0x" << std::hex << offset << "~0x" << length << std::dec + << " 0x" << std::hex << offset << "~" << length << std::dec << " = " << r << dendl; return r; } @@ -5888,11 +5888,11 @@ int BlueStore::_zero(TransContext *txc, uint64_t offset, size_t length) { dout(15) << __func__ << " " << c->cid << " " << o->oid - << " 0x" << std::hex << offset << "~0x" << length << std::dec + << " 0x" << std::hex << offset << "~" << length << std::dec << dendl; int r = _do_zero(txc, c, o, offset, length); dout(10) << __func__ << " " << c->cid << " " << o->oid - << " 0x" << std::hex << offset << "~0x" << length << std::dec + << " 0x" << std::hex << offset << "~" << length << std::dec << " = " << r << dendl; return r; } @@ -5903,7 +5903,7 @@ int BlueStore::_do_zero(TransContext *txc, uint64_t offset, size_t length) { dout(15) << __func__ << " " << c->cid << " " << o->oid - << " 0x" << std::hex << offset << "~0x" << length << std::dec + << " 0x" << std::hex << offset << "~" << length << std::dec << dendl; int r = 0; o->exists = true; @@ -5928,7 +5928,7 @@ int BlueStore::_do_zero(TransContext *txc, txc->write_onode(o); dout(10) << __func__ << " " << c->cid << " " << o->oid - << " 0x" << std::hex << offset << "~0x" << length << std::dec + << " 0x" << std::hex << offset << "~" << length << std::dec << " = " << r << dendl; return r; } @@ -6372,7 +6372,7 @@ int BlueStore::_clone_range(TransContext *txc, uint64_t srcoff, uint64_t length, uint64_t dstoff) { dout(15) << __func__ << " " << c->cid << " " << oldo->oid << " -> " - << newo->oid << " from 0x" << std::hex << srcoff << "~0x" << length + << newo->oid << " from 0x" << std::hex << srcoff << "~" << length << " to offset 0x" << dstoff << std::dec << dendl; int r = 0; @@ -6394,7 +6394,7 @@ int BlueStore::_clone_range(TransContext *txc, out: dout(10) << __func__ << " " << c->cid << " " << oldo->oid << " -> " - << newo->oid << " from 0x" << std::hex << srcoff << "~0x" << length + << newo->oid << " from 0x" << std::hex << srcoff << "~" << length << " to offset 0x" << dstoff << std::dec << " = " << r << dendl; return r; diff --git a/src/os/bluestore/KernelDevice.cc b/src/os/bluestore/KernelDevice.cc index 09dc7bc8f69f0..6f35d9870a51d 100644 --- a/src/os/bluestore/KernelDevice.cc +++ b/src/os/bluestore/KernelDevice.cc @@ -291,14 +291,14 @@ void KernelDevice::_aio_log_start( uint64_t offset, uint64_t length) { - dout(20) << __func__ << " 0x" << std::hex << offset << "~0x" << length + dout(20) << __func__ << " 0x" << std::hex << offset << "~" << length << std::dec << dendl; if (g_conf->bdev_debug_inflight_ios) { Mutex::Locker l(debug_lock); if (debug_inflight.intersects(offset, length)) { derr << __func__ << " inflight overlap of 0x" << std::hex - << offset << "~0x" << length << std::dec + << offset << "~" << length << std::dec << " with " << debug_inflight << dendl; assert(0); } @@ -312,7 +312,7 @@ void KernelDevice::_aio_log_finish( uint64_t length) { dout(20) << __func__ << " " << aio << " 0x" - << std::hex << offset << "~0x" << length << std::dec << dendl; + << std::hex << offset << "~" << length << std::dec << dendl; if (g_conf->bdev_debug_inflight_ios) { Mutex::Locker l(debug_lock); debug_inflight.erase(offset, length); @@ -342,7 +342,7 @@ void KernelDevice::aio_submit(IOContext *ioc) FS::aio_t& aio = *p; aio.priv = static_cast(ioc); dout(20) << __func__ << " aio " << &aio << " fd " << aio.fd - << " 0x" << std::hex << aio.offset << "~0x" << aio.length + << " 0x" << std::hex << aio.offset << "~" << aio.length << std::dec << dendl; for (vector::iterator q = aio.iov.begin(); q != aio.iov.end(); ++q) dout(30) << __func__ << " iov " << (void*)q->iov_base @@ -375,7 +375,7 @@ int KernelDevice::aio_write( bool buffered) { uint64_t len = bl.length(); - dout(20) << __func__ << " 0x" << std::hex << off << "~0x" << len << std::dec + dout(20) << __func__ << " 0x" << std::hex << off << "~" << len << std::dec << (buffered ? " (buffered)" : " (direct)") << dendl; assert(off % block_size == 0); @@ -402,7 +402,7 @@ int KernelDevice::aio_write( if (g_conf->bdev_inject_crash && rand() % g_conf->bdev_inject_crash == 0) { derr << __func__ << " bdev_inject_crash: dropping io 0x" << std::hex - << off << "~0x" << len << std::dec + << off << "~" << len << std::dec << dendl; // generate a real io so that aio_wait behaves properly, but make it // a read instead of write, and toss the result. @@ -417,17 +417,17 @@ int KernelDevice::aio_write( aio.bl.claim_append(bl); aio.pwritev(off); } - dout(5) << __func__ << " 0x" << std::hex << off << "~0x" << len + dout(5) << __func__ << " 0x" << std::hex << off << "~" << len << std::dec << " aio " << &aio << dendl; } else #endif { - dout(5) << __func__ << " 0x" << std::hex << off << "~0x" << len + dout(5) << __func__ << " 0x" << std::hex << off << "~" << len << std::dec << " buffered" << dendl; if (g_conf->bdev_inject_crash && rand() % g_conf->bdev_inject_crash == 0) { derr << __func__ << " bdev_inject_crash: dropping io 0x" << std::hex - << off << "~0x" << len << std::dec << dendl; + << off << "~" << len << std::dec << dendl; ++injecting_crash; return 0; } @@ -462,7 +462,7 @@ int KernelDevice::aio_zero( uint64_t len, IOContext *ioc) { - dout(5) << __func__ << " 0x" << std::hex << off << "~0x" << len << std::dec + dout(5) << __func__ << " 0x" << std::hex << off << "~" << len << std::dec << dendl; assert(off % block_size == 0); assert(len % block_size == 0); @@ -486,7 +486,7 @@ int KernelDevice::read(uint64_t off, uint64_t len, bufferlist *pbl, IOContext *ioc, bool buffered) { - dout(5) << __func__ << " 0x" << std::hex << off << "~0x" << len << std::dec + dout(5) << __func__ << " 0x" << std::hex << off << "~" << len << std::dec << (buffered ? " (buffered)" : " (direct)") << dendl; assert(off % block_size == 0); @@ -522,7 +522,7 @@ int KernelDevice::read(uint64_t off, uint64_t len, bufferlist *pbl, int KernelDevice::read_buffered(uint64_t off, uint64_t len, char *buf) { - dout(5) << __func__ << " 0x" << std::hex << off << "~0x" << len << std::dec + dout(5) << __func__ << " 0x" << std::hex << off << "~" << len << std::dec << dendl; assert(len > 0); assert(off < size); @@ -554,14 +554,14 @@ int KernelDevice::read_buffered(uint64_t off, uint64_t len, char *buf) int KernelDevice::invalidate_cache(uint64_t off, uint64_t len) { - dout(5) << __func__ << " 0x" << std::hex << off << "~0x" << len << std::dec + dout(5) << __func__ << " 0x" << std::hex << off << "~" << len << std::dec << dendl; assert(off % block_size == 0); assert(len % block_size == 0); int r = posix_fadvise(fd_buffered, off, len, POSIX_FADV_DONTNEED); if (r < 0) { r = -errno; - derr << __func__ << " 0x" << std::hex << off << "~0x" << len << std::dec + derr << __func__ << " 0x" << std::hex << off << "~" << len << std::dec << " error: " << cpp_strerror(r) << dendl; } return r; diff --git a/src/os/bluestore/bluestore_types.cc b/src/os/bluestore/bluestore_types.cc index f93f8099f9588..4ff5c6b51c65f 100644 --- a/src/os/bluestore/bluestore_types.cc +++ b/src/os/bluestore/bluestore_types.cc @@ -363,7 +363,7 @@ ostream& operator<<(ostream& out, const bluestore_extent_ref_map_t& m) for (auto p = m.ref_map.begin(); p != m.ref_map.end(); ++p) { if (p != m.ref_map.begin()) out << ","; - out << std::hex << "0x" << p->first << "~0x" << p->second.length << std::dec + out << std::hex << "0x" << p->first << "~" << p->second.length << std::dec << "=" << p->second.refs; } out << ")"; @@ -405,7 +405,7 @@ void bluestore_overlay_t::generate_test_instances(list& o) ostream& operator<<(ostream& out, const bluestore_overlay_t& o) { - out << "overlay(0x" << std::hex << o.value_offset << "~0x" << o.length + out << "overlay(0x" << std::hex << o.value_offset << "~" << o.length << std::dec << " key " << o.key << ")"; return out; } @@ -421,9 +421,9 @@ void bluestore_pextent_t::dump(Formatter *f) const ostream& operator<<(ostream& out, const bluestore_pextent_t& o) { if (o.is_valid()) - return out << "0x" << std::hex << o.offset << "~0x" << o.length << std::dec; + return out << "0x" << std::hex << o.offset << "~" << o.length << std::dec; else - return out << "!~0x" << std::hex << o.length << std::dec; + return out << "!~" << std::hex << o.length << std::dec; } void bluestore_pextent_t::generate_test_instances(list& ls) @@ -716,7 +716,7 @@ void bluestore_lextent_t::generate_test_instances(list& ls ostream& operator<<(ostream& out, const bluestore_lextent_t& lb) { - out << "0x" << std::hex << lb.offset << "~0x" << lb.length << std::dec + out << "0x" << std::hex << lb.offset << "~" << lb.length << std::dec << "->" << lb.blob; if (lb.flags) out << ":" << bluestore_lextent_t::get_flags_string(lb.flags); -- 2.39.5