mirror of
https://github.com/ceph/ceph
synced 2025-01-15 07:23:16 +00:00
Merge pull request #11539 from liewegas/wip-bluestore-gc
os/bluestore: no garbage collection for uncompressed blobs Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
commit
dcbe9f05d4
@ -2209,18 +2209,20 @@ bool BlueStore::ExtentMap::do_write_check_depth(
|
||||
auto hp = seek_lextent(start_offset);
|
||||
if (hp != extent_map.end() &&
|
||||
hp->logical_offset < start_offset &&
|
||||
start_offset < hp->logical_offset + hp->length) {
|
||||
depth = hp->blob_depth;
|
||||
head_overlap = true;
|
||||
start_offset < (hp->logical_offset + hp->length) &&
|
||||
hp->blob->get_blob().is_compressed()) {
|
||||
depth = hp->blob_depth;
|
||||
head_overlap = true;
|
||||
}
|
||||
|
||||
auto tp = seek_lextent(end_offset);
|
||||
if (tp != extent_map.end() &&
|
||||
tp->logical_offset < end_offset &&
|
||||
end_offset < tp->logical_offset + tp->length) {
|
||||
tail_overlap = true;
|
||||
if (depth < tp->blob_depth) {
|
||||
depth = tp->blob_depth;
|
||||
end_offset < (tp->logical_offset + tp->length) &&
|
||||
tp->blob->get_blob().is_compressed()) {
|
||||
tail_overlap = true;
|
||||
if (depth < tp->blob_depth) {
|
||||
depth = tp->blob_depth;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -937,10 +937,19 @@ TEST_P(StoreTest, garbageCollection) {
|
||||
int64_t waste1, waste2;
|
||||
coll_t cid;
|
||||
int buf_len = 256 * 1024;
|
||||
int overlap_offset = 64 * 1024;
|
||||
int write_offset = buf_len;
|
||||
if (string(GetParam()) != "bluestore")
|
||||
return;
|
||||
|
||||
g_conf->set_val("bluestore_compression", "force");
|
||||
#define WRITE_AT(offset, length) {\
|
||||
ObjectStore::Transaction t;\
|
||||
t.write(cid, hoid, offset, length, bl);\
|
||||
r = apply_transaction(store, &osr, std::move(t));\
|
||||
ASSERT_EQ(r, 0);\
|
||||
}
|
||||
g_conf->set_val("bluestore_compression", "none");
|
||||
//g_conf->set_val("bluestore_compression", "force");
|
||||
g_conf->set_val("bluestore_merge_gc_data", "true");
|
||||
g_ceph_context->_conf->apply_changes(NULL);
|
||||
|
||||
@ -981,33 +990,18 @@ TEST_P(StoreTest, garbageCollection) {
|
||||
data[i] = 'R';
|
||||
|
||||
bl.append(data);
|
||||
|
||||
WRITE_AT(0, buf_len);
|
||||
WRITE_AT(write_offset - 3 * overlap_offset, buf_len);
|
||||
WRITE_AT(write_offset - 2 * overlap_offset, buf_len);
|
||||
{
|
||||
ObjectStore::Transaction t;
|
||||
t.write(cid, hoid, 0, bl.length(), bl);
|
||||
r = apply_transaction(store, &osr, std::move(t));
|
||||
ASSERT_EQ(r, 0);
|
||||
}
|
||||
{
|
||||
ObjectStore::Transaction t;
|
||||
t.write(cid, hoid, buf_len - 4096, bl.length(), bl);
|
||||
r = apply_transaction(store, &osr, std::move(t));
|
||||
ASSERT_EQ(r, 0);
|
||||
}
|
||||
{
|
||||
ObjectStore::Transaction t;
|
||||
t.write(cid, hoid, 2 * (buf_len - 4096), bl.length(), bl);
|
||||
r = apply_transaction(store, &osr, std::move(t));
|
||||
ASSERT_EQ(r, 0);
|
||||
struct store_statfs_t statfs;
|
||||
int r = store->statfs(&statfs);
|
||||
ASSERT_EQ(r, 0);
|
||||
waste1 = statfs.allocated - statfs.stored;
|
||||
}
|
||||
WRITE_AT(write_offset - overlap_offset, buf_len);
|
||||
{
|
||||
ObjectStore::Transaction t;
|
||||
t.write(cid, hoid, 3 * (buf_len - 4096), bl.length(), bl);
|
||||
r = apply_transaction(store, &osr, std::move(t));
|
||||
ASSERT_EQ(r, 0);
|
||||
struct store_statfs_t statfs;
|
||||
int r = store->statfs(&statfs);
|
||||
ASSERT_EQ(r, 0);
|
||||
@ -1042,36 +1036,16 @@ TEST_P(StoreTest, garbageCollection) {
|
||||
data[i] = i % 256;
|
||||
bl.append(data);
|
||||
|
||||
{
|
||||
ObjectStore::Transaction t;
|
||||
t.write(cid, hoid, 3 * (buf_len - 4096), bl.length(), bl);
|
||||
r = apply_transaction(store, &osr, std::move(t));
|
||||
ASSERT_EQ(r, 0);
|
||||
}
|
||||
{
|
||||
ObjectStore::Transaction t;
|
||||
t.write(cid, hoid, 2 * (buf_len - 4096), bl.length(), bl);
|
||||
r = apply_transaction(store, &osr, std::move(t));
|
||||
ASSERT_EQ(r, 0);
|
||||
}
|
||||
{
|
||||
ObjectStore::Transaction t;
|
||||
t.write(cid, hoid, buf_len - 4096, bl.length(), bl);
|
||||
r = apply_transaction(store, &osr, std::move(t));
|
||||
ASSERT_EQ(r, 0);
|
||||
}
|
||||
WRITE_AT(write_offset - overlap_offset, buf_len);
|
||||
WRITE_AT(write_offset - 2 * overlap_offset, buf_len);
|
||||
WRITE_AT(write_offset - 3 * overlap_offset, buf_len);
|
||||
{
|
||||
struct store_statfs_t statfs;
|
||||
int r = store->statfs(&statfs);
|
||||
ASSERT_EQ(r, 0);
|
||||
waste1 = statfs.allocated - statfs.stored;
|
||||
}
|
||||
{
|
||||
ObjectStore::Transaction t;
|
||||
t.write(cid, hoid, 50 * 1024, bl.length(), bl);
|
||||
r = apply_transaction(store, &osr, std::move(t));
|
||||
ASSERT_EQ(r, 0);
|
||||
}
|
||||
WRITE_AT(0, buf_len);
|
||||
{
|
||||
struct store_statfs_t statfs;
|
||||
int r = store->statfs(&statfs);
|
||||
@ -1106,48 +1080,10 @@ TEST_P(StoreTest, garbageCollection) {
|
||||
data[i] = i % 256;
|
||||
bl.append(data);
|
||||
|
||||
{
|
||||
ObjectStore::Transaction t;
|
||||
t.write(cid, hoid, 5 * (buf_len - 4096), bl.length(), bl);
|
||||
r = apply_transaction(store, &osr, std::move(t));
|
||||
ASSERT_EQ(r, 0);
|
||||
}
|
||||
{
|
||||
ObjectStore::Transaction t;
|
||||
t.write(cid, hoid, 4 * (buf_len - 4096), bl.length(), bl);
|
||||
r = apply_transaction(store, &osr, std::move(t));
|
||||
ASSERT_EQ(r, 0);
|
||||
}
|
||||
{
|
||||
ObjectStore::Transaction t;
|
||||
t.write(cid, hoid, 3 * (buf_len - 4096), bl.length(), bl);
|
||||
r = apply_transaction(store, &osr, std::move(t));
|
||||
ASSERT_EQ(r, 0);
|
||||
}
|
||||
{
|
||||
ObjectStore::Transaction t;
|
||||
t.write(cid, hoid, buf_len - 4096, bl.length(), bl);
|
||||
r = apply_transaction(store, &osr, std::move(t));
|
||||
ASSERT_EQ(r, 0);
|
||||
}
|
||||
{
|
||||
ObjectStore::Transaction t;
|
||||
t.write(cid, hoid, 40 * 1024, bl.length(), bl);
|
||||
r = apply_transaction(store, &osr, std::move(t));
|
||||
ASSERT_EQ(r, 0);
|
||||
}
|
||||
{
|
||||
struct store_statfs_t statfs;
|
||||
int r = store->statfs(&statfs);
|
||||
ASSERT_EQ(r, 0);
|
||||
waste1 = statfs.allocated - statfs.stored;
|
||||
}
|
||||
{
|
||||
ObjectStore::Transaction t;
|
||||
t.write(cid, hoid, 5 * (buf_len - 3 * 4096), bl.length(), bl);
|
||||
r = apply_transaction(store, &osr, std::move(t));
|
||||
ASSERT_EQ(r, 0);
|
||||
}
|
||||
WRITE_AT(2 * write_offset - 5 * overlap_offset, buf_len);
|
||||
WRITE_AT(2 * write_offset - 4 * overlap_offset, buf_len);
|
||||
WRITE_AT(2 * write_offset - 3 * overlap_offset, buf_len);
|
||||
WRITE_AT(2 * overlap_offset, buf_len);
|
||||
{
|
||||
struct store_statfs_t statfs;
|
||||
int r = store->statfs(&statfs);
|
||||
@ -5790,9 +5726,6 @@ int main(int argc, char **argv) {
|
||||
g_ceph_context->_conf->set_val("bluestore_buffer_cache_size", "2000000");
|
||||
g_ceph_context->_conf->set_val("bluestore_onode_cache_size", "500");
|
||||
|
||||
// use a large enough block device that we'll exceed 32 bit LBAs
|
||||
g_ceph_context->_conf->set_val("bluestore_block_size", "1024000000000");
|
||||
|
||||
g_ceph_context->_conf->set_val(
|
||||
"enable_experimental_unrecoverable_data_corrupting_features", "*");
|
||||
g_ceph_context->_conf->apply_changes(NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user