From 6ec3fd9c62ffd4bf1c150b169089b94453622a91 Mon Sep 17 00:00:00 2001 From: Xuehan Xu Date: Wed, 6 Mar 2024 15:42:58 +0800 Subject: [PATCH] test/cls_rbd/test_cls_rbd: change to check for 4KB-aligned sparse read SeaStore::fiemap() can only supported 4096-aligned sparse read. Co-authored-by: Ilya Dryomov Signed-off-by: Xuehan Xu --- src/test/cls_rbd/test_cls_rbd.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/test/cls_rbd/test_cls_rbd.cc b/src/test/cls_rbd/test_cls_rbd.cc index 2f553a0f4338..21311302711a 100644 --- a/src/test/cls_rbd/test_cls_rbd.cc +++ b/src/test/cls_rbd/test_cls_rbd.cc @@ -74,19 +74,19 @@ static bool is_sparse_read_supported(librados::IoCtx &ioctx, const std::string &oid) { EXPECT_EQ(0, ioctx.create(oid, true)); bufferlist inbl; - inbl.append(std::string(1, 'X')); - EXPECT_EQ(0, ioctx.write(oid, inbl, inbl.length(), 1)); - EXPECT_EQ(0, ioctx.write(oid, inbl, inbl.length(), 3)); + inbl.append(std::string(4096, 'X')); + EXPECT_EQ(0, ioctx.write(oid, inbl, inbl.length(), 4096)); + EXPECT_EQ(0, ioctx.write(oid, inbl, inbl.length(), 4096 * 3)); std::map m; bufferlist outbl; - int r = ioctx.sparse_read(oid, m, outbl, 4, 0); + int r = ioctx.sparse_read(oid, m, outbl, 4096 * 4, 0); ioctx.remove(oid); int expected_r = 2; - std::map expected_m = {{1, 1}, {3, 1}}; + std::map expected_m = {{4096, 4096}, {4096 * 3, 4096}}; bufferlist expected_outbl; - expected_outbl.append(std::string(2, 'X')); + expected_outbl.append(std::string(4096 * 2, 'X')); return (r == expected_r && m == expected_m && outbl.contents_equal(expected_outbl)); @@ -205,7 +205,7 @@ TEST_F(TestClsRbd, sparse_copyup) // create some data to write inbl.append(std::string(4096, '1')); inbl.append(std::string(4096, '2')); - m = {{1024, 4096}, {8192, 4096}}; + m = {{4096, 4096}, {4096 * 3, 4096}}; // copyup to nonexistent object should create new object ioctx.remove(oid); @@ -214,9 +214,9 @@ TEST_F(TestClsRbd, sparse_copyup) // and its contents should match bufferlist outbl; bufferlist expected_outbl; - expected_outbl.append(std::string(1024, '\0')); + expected_outbl.append(std::string(4096, '\0')); expected_outbl.append(std::string(4096, '1')); - expected_outbl.append(std::string(8192 - 4096 - 1024, '\0')); + expected_outbl.append(std::string(4096, '\0')); expected_outbl.append(std::string(4096, '2')); ASSERT_EQ((int)expected_outbl.length(), ioctx.read(oid, outbl, expected_outbl.length() + 1, 0)); -- 2.47.3