@@ -74,19 +74,19 @@ static bool is_sparse_read_supported(librados::IoCtx &ioctx,
7474 const std::string &oid) {
7575 EXPECT_EQ (0 , ioctx.create (oid, true ));
7676 bufferlist inbl;
77- inbl.append (std::string (1 , ' X' ));
78- EXPECT_EQ (0 , ioctx.write (oid, inbl, inbl.length (), 1 ));
79- EXPECT_EQ (0 , ioctx.write (oid, inbl, inbl.length (), 3 ));
77+ inbl.append (std::string (4096 , ' X' ));
78+ EXPECT_EQ (0 , ioctx.write (oid, inbl, inbl.length (), 4096 ));
79+ EXPECT_EQ (0 , ioctx.write (oid, inbl, inbl.length (), 4096 * 3 ));
8080
8181 std::map<uint64_t , uint64_t > m;
8282 bufferlist outbl;
83- int r = ioctx.sparse_read (oid, m, outbl, 4 , 0 );
83+ int r = ioctx.sparse_read (oid, m, outbl, 4096 * 4 , 0 );
8484 ioctx.remove (oid);
8585
8686 int expected_r = 2 ;
87- std::map<uint64_t , uint64_t > expected_m = {{1 , 1 }, {3 , 1 }};
87+ std::map<uint64_t , uint64_t > expected_m = {{4096 , 4096 }, {4096 * 3 , 4096 }};
8888 bufferlist expected_outbl;
89- expected_outbl.append (std::string (2 , ' X' ));
89+ expected_outbl.append (std::string (4096 * 2 , ' X' ));
9090
9191 return (r == expected_r && m == expected_m &&
9292 outbl.contents_equal (expected_outbl));
@@ -205,7 +205,7 @@ TEST_F(TestClsRbd, sparse_copyup)
205205 // create some data to write
206206 inbl.append (std::string (4096 , ' 1' ));
207207 inbl.append (std::string (4096 , ' 2' ));
208- m = {{1024 , 4096 }, {8192 , 4096 }};
208+ m = {{4096 , 4096 }, {4096 * 3 , 4096 }};
209209
210210 // copyup to nonexistent object should create new object
211211 ioctx.remove (oid);
@@ -214,9 +214,9 @@ TEST_F(TestClsRbd, sparse_copyup)
214214 // and its contents should match
215215 bufferlist outbl;
216216 bufferlist expected_outbl;
217- expected_outbl.append (std::string (1024 , ' \0 ' ));
217+ expected_outbl.append (std::string (4096 , ' \0 ' ));
218218 expected_outbl.append (std::string (4096 , ' 1' ));
219- expected_outbl.append (std::string (8192 - 4096 - 1024 , ' \0 ' ));
219+ expected_outbl.append (std::string (4096 , ' \0 ' ));
220220 expected_outbl.append (std::string (4096 , ' 2' ));
221221 ASSERT_EQ ((int )expected_outbl.length (),
222222 ioctx.read (oid, outbl, expected_outbl.length () + 1 , 0 ));
0 commit comments