[sheepdog] [PATCH v9 10/19] sheep: reduce needless remove request during object reclamation
Hitoshi Mitake
mitake.hitoshi at gmail.com
Thu May 22 16:30:28 CEST 2014
From: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
The previous reference decrement operation issued too many (and not
required) remove requests. It harms performance and produces
meaningless error logs. This patch reduces the needless requests.
Cc: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
Cc: Alessandro Bolgia <alessandro at extensys.it>
Tested-by: Valerio Pachera <sirio81 at gmail.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
sheep/ops.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/sheep/ops.c b/sheep/ops.c
index 2d0cc37..6dfe755 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -1120,6 +1120,14 @@ int peer_decref_object(struct request *req)
ledger[generation + 1] += count;
if (is_zero_ledger(ledger)) {
+ struct sd_node *nodes[SD_MAX_COPIES];
+ int nr_copies;
+ uint32_t vid;
+
+ vid = oid_to_vid(ledger_oid);
+ nr_copies = get_vdi_copy_number(vid);
+ memset(nodes, 0, sizeof(nodes));
+
/* reclaim object */
if (exist) {
ret = sd_store->remove_object(ledger_oid, -1);
@@ -1131,10 +1139,16 @@ int peer_decref_object(struct request *req)
sd_mutex_unlock(&lock);
locked = false;
- ret = sd_remove_object(data_oid);
- if (ret != SD_RES_SUCCESS) {
- sd_err("error %s", sd_strerror(ret));
- goto out;
+ oid_to_nodes(ledger_oid, &req->vinfo->vroot, nr_copies,
+ (const struct sd_node **)nodes);
+
+ if (!node_cmp(&sys->this_node, nodes[0])) {
+ /* only first one node needs to remove the object */
+ ret = sd_remove_object(data_oid);
+ if (ret != SD_RES_SUCCESS) {
+ sd_err("error %s", sd_strerror(ret));
+ goto out;
+ }
}
} else {
/* update ledger */
--
1.9.1
More information about the sheepdog
mailing list