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);
+ auto last = m.crbegin();
+ if (m.size() == 1) {
+ ASSERT_EQ(0u, last->first);
+ } else if (m.size() == MAX_EXTENTS) {
+ for (uint64_t i = 0; i < MAX_EXTENTS; i++) {
+ ASSERT_TRUE(m.count(SKIP_STEP * i));
+ }
}
- ASSERT_TRUE((m.size() == 1 &&
- m[0] > SKIP_STEP * (MAX_EXTENTS - 1)) ||
- (m.size() == MAX_EXTENTS && extents_exist));
-
+ ASSERT_GT(last->first + last->second, SKIP_STEP * (MAX_EXTENTS - 1));
+ }
+ {
// fiemap test from SKIP_STEP to SKIP_STEP * (MAX_EXTENTS - 2) + 3
- // reset bufferlist and map
- bl.clear();
- m.clear();
- e.clear();
+ bufferlist bl;
store->fiemap(cid, oid, SKIP_STEP, SKIP_STEP * (MAX_EXTENTS - 2) + 3, bl);
- p = bl.begin();
+ map<uint64_t,uint64_t> m, e;
+ auto p = bl.begin();
::decode(m, p);
cout << " got " << m << std::endl;
ASSERT_TRUE(!m.empty());
-
- // kstore always return [0, object_size] regardless of offset and length
+ // kstore always returns [0, object_size] regardless of offset and length
// FIXME: if fiemap logic in kstore is refined
if (string(GetParam()) != "kstore") {
ASSERT_GE(m[SKIP_STEP], 3u);
+ auto last = m.crbegin();
+ if (m.size() == 1) {
+ ASSERT_EQ(SKIP_STEP, last->first);
+ } else if (m.size() == MAX_EXTENTS - 2) {
+ for (uint64_t i = 1; i < MAX_EXTENTS - 1; i++) {
+ ASSERT_TRUE(m.count(SKIP_STEP*i));
+ }
+ }
+ ASSERT_GT(last->first + last->second, SKIP_STEP * (MAX_EXTENTS - 1));
}
- extents_exist = true;
- if (m.size() == (MAX_EXTENTS - 2)) {
- for (uint64_t i = 1; i < MAX_EXTENTS - 1; i++)
- extents_exist = extents_exist && m.count(SKIP_STEP*i);
- }
- ASSERT_TRUE((m.size() == 1 &&
- m[SKIP_STEP] > SKIP_STEP * (MAX_EXTENTS - 2)) ||
- (m.size() == (MAX_EXTENTS - 1) && extents_exist));
}
{
ObjectStore::Transaction t;
g_ceph_context->_conf->set_val("filestore_op_thread_timeout", "1000");
g_ceph_context->_conf->set_val("filestore_op_thread_suicide_timeout", "10000");
g_ceph_context->_conf->set_val("filestore_debug_disable_sharded_check", "true");
- //g_ceph_context->_conf->set_val("filestore_fiemap", "true");
+ g_ceph_context->_conf->set_val("filestore_fiemap", "true");
g_ceph_context->_conf->set_val("bluestore_fsck_on_mount", "true");
g_ceph_context->_conf->set_val("bluestore_fsck_on_umount", "true");
g_ceph_context->_conf->set_val("bluestore_debug_misc", "true");