[sheepdog] [PATCH] recovery: check whether the object is already scheduled at first

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Fri May 17 16:42:22 CEST 2013


We can do the check before finding the target nodes.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/recovery.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sheep/recovery.c b/sheep/recovery.c
index fb2df3b..d331012 100644
--- a/sheep/recovery.c
+++ b/sheep/recovery.c
@@ -700,6 +700,10 @@ static void screen_object_list(struct recovery_list_work *rlw,
 	int i, j;
 
 	for (i = 0; i < nr_oids; i++) {
+		if (xbsearch(&oids[i], rlw->oids, old_count, obj_cmp))
+			/* the object is already scheduled to be recovered */
+			continue;
+
 		nr_objs = get_obj_copy_number(oids[i], rw->cur_vinfo->nr_zones);
 		if (!nr_objs) {
 			sd_eprintf("ERROR: can not find copy number for object"
@@ -711,8 +715,6 @@ static void screen_object_list(struct recovery_list_work *rlw,
 		for (j = 0; j < nr_objs; j++) {
 			if (!vnode_is_local(vnodes[j]))
 				continue;
-			if (xbsearch(&oids[i], rlw->oids, old_count, obj_cmp))
-				continue;
 
 			rlw->oids[rlw->count++] = oids[i];
 			/* enlarge the list buffer if full */
-- 
1.8.1.3.566.gaa39828




More information about the sheepdog mailing list