From 188e46be3aa055dcdf026abd34a84269be9e6b14 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 8 Dec 2020 09:59:53 -0500 Subject: [PATCH] test/librados_test_stub: additional debug logging Allow actual IOs to be seen in the debug logs next to the client debug logs issuing the IOs. Signed-off-by: Jason Dillaman --- .../librados_test_stub/TestMemIoCtxImpl.cc | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/test/librados_test_stub/TestMemIoCtxImpl.cc b/src/test/librados_test_stub/TestMemIoCtxImpl.cc index 6c004af007b..6ad3ce3861a 100644 --- a/src/test/librados_test_stub/TestMemIoCtxImpl.cc +++ b/src/test/librados_test_stub/TestMemIoCtxImpl.cc @@ -11,6 +11,11 @@ #include #include +#define dout_subsys ceph_subsys_rados +#undef dout_prefix +#define dout_prefix *_dout << "TestMemIoCtxImpl: " << this << " " << __func__ \ + << ": " << oid << " " + static void to_vector(const interval_set &set, std::vector > *vec) { vec->clear(); @@ -73,6 +78,9 @@ int TestMemIoCtxImpl::append(const std::string& oid, const bufferlist &bl, return -EBLOCKLISTED; } + auto cct = m_client->cct(); + ldout(cct, 20) << "length=" << bl.length() << ", snapc=" << snapc << dendl; + TestMemCluster::SharedFile file; { std::unique_lock l{m_pool->file_lock}; @@ -127,6 +135,9 @@ int TestMemIoCtxImpl::create(const std::string& oid, bool exclusive, return -EBLOCKLISTED; } + auto cct = m_client->cct(); + ldout(cct, 20) << "snapc=" << snapc << dendl; + std::unique_lock l{m_pool->file_lock}; if (exclusive) { TestMemCluster::SharedFile file = get_file(oid, false, CEPH_NOSNAP, {}); @@ -140,6 +151,9 @@ int TestMemIoCtxImpl::create(const std::string& oid, bool exclusive, } int TestMemIoCtxImpl::list_snaps(const std::string& oid, snap_set_t *out_snaps) { + auto cct = m_client->cct(); + ldout(cct, 20) << dendl; + if (m_client->is_blocklisted()) { return -EBLOCKLISTED; } @@ -206,6 +220,23 @@ int TestMemIoCtxImpl::list_snaps(const std::string& oid, snap_set_t *out_snaps) out_snaps->clones.push_back(head_clone); } } + + ldout(cct, 20) << "seq=" << out_snaps->seq << ", " + << "clones=["; + bool first_clone = true; + for (auto& clone : out_snaps->clones) { + *_dout << "{" + << "cloneid=" << clone.cloneid << ", " + << "snaps=" << clone.snaps << ", " + << "overlap=" << clone.overlap << ", " + << "size=" << clone.size << "}"; + if (!first_clone) { + *_dout << ", "; + } else { + first_clone = false; + } + } + *_dout << "]" << dendl; return 0; } @@ -359,6 +390,9 @@ int TestMemIoCtxImpl::remove(const std::string& oid, const SnapContext &snapc) { return -EBLOCKLISTED; } + auto cct = m_client->cct(); + ldout(cct, 20) << "snapc=" << snapc << dendl; + std::unique_lock l{m_pool->file_lock}; TestMemCluster::SharedFile file = get_file(oid, false, CEPH_NOSNAP, snapc); if (file == NULL) { @@ -556,6 +590,9 @@ int TestMemIoCtxImpl::truncate(const std::string& oid, uint64_t size, return -EBLOCKLISTED; } + auto cct = m_client->cct(); + ldout(cct, 20) << "size=" << size << ", snapc=" << snapc << dendl; + TestMemCluster::SharedFile file; { std::unique_lock l{m_pool->file_lock}; @@ -594,6 +631,10 @@ int TestMemIoCtxImpl::write(const std::string& oid, bufferlist& bl, size_t len, return -EBLOCKLISTED; } + auto cct = m_client->cct(); + ldout(cct, 20) << "extent=" << off << "~" << len << ", snapc=" << snapc + << dendl; + TestMemCluster::SharedFile file; { std::unique_lock l{m_pool->file_lock}; @@ -621,6 +662,9 @@ int TestMemIoCtxImpl::write_full(const std::string& oid, bufferlist& bl, return -EBLOCKLISTED; } + auto cct = m_client->cct(); + ldout(cct, 20) << "length=" << bl.length() << ", snapc=" << snapc << dendl; + TestMemCluster::SharedFile file; { std::unique_lock l{m_pool->file_lock}; @@ -742,6 +786,10 @@ int TestMemIoCtxImpl::zero(const std::string& oid, uint64_t off, uint64_t len, return -EBLOCKLISTED; } + auto cct = m_client->cct(); + ldout(cct, 20) << "extent=" << off << "~" << len << ", snapc=" << snapc + << dendl; + bool truncate_redirect = false; TestMemCluster::SharedFile file; { -- 2.47.3