From a2fdfc3acefb4d0da68771edd59cd66fd3705be5 Mon Sep 17 00:00:00 2001 From: sageweil Date: Tue, 12 Dec 2006 22:55:55 +0000 Subject: [PATCH] turn off clone() by default git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@996 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/config.cc | 3 +++ ceph/config.h | 1 + ceph/ebofs/Allocator.cc | 11 ++++++++--- ceph/ebofs/Ebofs.cc | 11 ++++++++--- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ceph/config.cc b/ceph/config.cc index f50ed4135e765..fe7261f703cf0 100644 --- a/ceph/config.cc +++ b/ceph/config.cc @@ -219,6 +219,7 @@ md_config_t g_conf = { // --- ebofs --- ebofs: 1, + ebofs_cloneable: false, ebofs_verify: false, ebofs_commit_ms: 2000, // 0 = no forced commit timeout (for debugging/tracing) ebofs_idle_commit_ms: 100, // 0 = no idle detection. use this -or- bdev_idle_kick_after_ms @@ -575,6 +576,8 @@ void parse_config_options(std::vector& args) else if (strcmp(args[i], "--ebofs") == 0) g_conf.ebofs = 1; + else if (strcmp(args[i], "--ebofs_cloneable") == 0) + g_conf.ebofs_cloneable = atoi(args[++i]); else if (strcmp(args[i], "--ebofs_verify") == 0) g_conf.ebofs_verify = atoi(args[++i]); else if (strcmp(args[i], "--ebofs_commit_ms") == 0) diff --git a/ceph/config.h b/ceph/config.h index 4a36fde87f1a9..b3a9d73ee433a 100644 --- a/ceph/config.h +++ b/ceph/config.h @@ -205,6 +205,7 @@ struct md_config_t { // ebofs int ebofs; + bool ebofs_cloneable; bool ebofs_verify; int ebofs_commit_ms; int ebofs_idle_commit_ms; diff --git a/ceph/ebofs/Allocator.cc b/ceph/ebofs/Allocator.cc index 901a541449016..f16d7bb4c28d6 100644 --- a/ceph/ebofs/Allocator.cc +++ b/ceph/ebofs/Allocator.cc @@ -160,7 +160,8 @@ int Allocator::allocate(Extent& ex, block_t num, block_t near) dout(20) << "allocate " << ex << " near " << near << endl; last_pos = ex.end(); dump_freelist(); - alloc_inc(ex); + if (g_conf.ebofs_cloneable) + alloc_inc(ex); return num; } } @@ -181,7 +182,8 @@ int Allocator::allocate(Extent& ex, block_t num, block_t near) last_pos = ex.end(); dout(20) << "allocate partial " << ex << " (wanted " << num << ") near " << near << endl; dump_freelist(); - alloc_inc(ex); + if (g_conf.ebofs_cloneable) + alloc_inc(ex); return ex.length; } } @@ -204,7 +206,10 @@ int Allocator::_release_into_limbo(Extent& ex) int Allocator::release(Extent& ex) { - return alloc_dec(ex); + if (g_conf.ebofs_cloneable) + return alloc_dec(ex); + + _release_into_limbo(ex); } int Allocator::commit_limbo() diff --git a/ceph/ebofs/Ebofs.cc b/ceph/ebofs/Ebofs.cc index 2f1ecf6eb396d..520a9c7a00e92 100644 --- a/ceph/ebofs/Ebofs.cc +++ b/ceph/ebofs/Ebofs.cc @@ -160,9 +160,11 @@ int Ebofs::mkfs() left.length = num_blocks - left.start; dout(10) << "mkfs: free data blocks at " << left << endl; allocator._release_into_limbo( left ); - allocator.alloc_inc(nr); - allocator.alloc_inc(nodepool.usemap_even); - allocator.alloc_inc(nodepool.usemap_odd); + if (g_conf.ebofs_cloneable) { + allocator.alloc_inc(nr); + allocator.alloc_inc(nodepool.usemap_even); + allocator.alloc_inc(nodepool.usemap_odd); + } allocator.commit_limbo(); // -> limbo_tab allocator.release_limbo(); // -> free_tab @@ -2375,6 +2377,9 @@ int Ebofs::_clone(object_t from, object_t to) { dout(7) << "_clone " << from << " -> " << to << endl; + if (!g_conf.ebofs_cloneable) + return -1; // no! + Onode *fon = get_onode(from); if (!fon) return -ENOENT; Onode *ton = get_onode(to); -- 2.39.5