From: Ning Yao Date: Thu, 13 Oct 2016 09:25:36 +0000 (+0800) Subject: test: add test for fiemap xfs issue when #extents > 1364 X-Git-Tag: v11.1.0~426^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fb119ac40edf3156b05a6da11b75d489438faf8f;p=ceph.git test: add test for fiemap xfs issue when #extents > 1364 Signed-off-by: Ning Yao --- diff --git a/src/test/objectstore/store_test.cc b/src/test/objectstore/store_test.cc index 6372742f3c2..9451e554f3c 100644 --- a/src/test/objectstore/store_test.cc +++ b/src/test/objectstore/store_test.cc @@ -264,6 +264,8 @@ TEST_P(StoreTest, FiemapEmpty) { TEST_P(StoreTest, FiemapHoles) { ObjectStore::Sequencer osr("test"); + const uint64_t MAX_EXTENTS = 4000; + const uint64_t SKIP_STEP = 65536; coll_t cid; int r = 0; ghobject_t oid(hobject_t(sobject_t("fiemap_object", CEPH_NOSNAP))); @@ -273,27 +275,28 @@ TEST_P(StoreTest, FiemapHoles) { ObjectStore::Transaction t; t.create_collection(cid, 0); t.touch(cid, oid); - t.write(cid, oid, 0, 3, bl); - t.write(cid, oid, 1048576, 3, bl); - t.write(cid, oid, 4194304, 3, bl); + for (uint64_t i = 0; i < MAX_EXTENTS; i++) + t.write(cid, oid, SKIP_STEP * i, 3, bl); r = apply_transaction(store, &osr, std::move(t)); ASSERT_EQ(r, 0); } { bufferlist bl; - store->fiemap(cid, oid, 0, 4194307, bl); + store->fiemap(cid, oid, 0, SKIP_STEP * (MAX_EXTENTS - 1) + 3, bl); map m, e; bufferlist::iterator p = bl.begin(); ::decode(m, p); cout << " got " << m << std::endl; ASSERT_TRUE(!m.empty()); ASSERT_GE(m[0], 3u); + bool extents_exist = true; + if (m.size() == MAX_EXTENTS) { + for (uint64_t i = 0; i < MAX_EXTENTS; i++) + extents_exist = extents_exist && m.count(SKIP_STEP*i); + } ASSERT_TRUE((m.size() == 1 && - m[0] > 4194304u) || - (m.size() == 3 && - m.count(0) && - m.count(1048576) && - m.count(4194304))); + m[0] > SKIP_STEP * (MAX_EXTENTS - 1)) || + (m.size() == MAX_EXTENTS && extents_exist)); } { ObjectStore::Transaction t;