]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
fixed crush bug with forcefeeding
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Mon, 19 Nov 2007 21:36:37 +0000 (21:36 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Mon, 19 Nov 2007 21:36:37 +0000 (21:36 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@2086 29311d96-e01e-0410-9327-a35deaab8ce9

trunk/ceph/crush/Makefile
trunk/ceph/crush/mapper.c

index 72d1b676bdb32069b82b90c72320f28ff4eb41f9..b5deb36dc20198f7f4e35d6d6645d463d29e4f55 100644 (file)
@@ -2,7 +2,7 @@
 CC = gcc
 CFLAGS = -Wall
 CFLAGS += -g
-CFLAGS += -O3
+#CFLAGS += -O3
 LD = ld
 RM = rm
 
index 36341a272a656311007cec00e44a33a5b28d75f9..fe1fd19ce1b68cfce13cced5bf0dfa38a157be58 100644 (file)
@@ -131,7 +131,7 @@ crush_bucket_straw_choose(struct crush_bucket_straw *bucket, int x, int r)
 static int crush_choose(struct crush_map *map,
                        struct crush_bucket *bucket,
                        int x, int numrep, int type,
-                       int *out, int firstn)
+                       int *out, int outpos, int firstn)
 {
        int rep;
        int ftotal, flocal;
@@ -141,12 +141,9 @@ static int crush_choose(struct crush_map *map,
        int i;
        int item;
        int itemtype;
-       int outpos;
        int collide, bad;
        
-       outpos = 0;
-
-       for (rep = 0; rep < numrep; rep++) {
+       for (rep = outpos; rep < numrep; rep++) {
                /* keep trying until we get a non-out, non-colliding item */
                ftotal = 0;
                skip_rep = 0;
@@ -265,7 +262,7 @@ int crush_do_rule(struct crush_map *map,
        int *tmp;
        struct crush_rule *rule;
        int step;
-       int i;
+       int i,j;
        int numrep;
        
        rule = map->rules[ruleno];
@@ -312,16 +309,17 @@ int crush_do_rule(struct crush_map *map,
                        
                        for (i = 0; i < wsize; i++) {
                                numrep = rule->steps[step].arg1;
-                               if (force_pos >= 0) {
+                               j = 0;
+                               if (osize == 0 && force_pos >= 0) {
                                        o[osize++] = force_stack[force_pos];
                                        force_pos--;
-                                       numrep--;
+                                       j++;
+                                       if (j == numrep) continue;  /* apparently numrep == 1 */
                                }
-                               if (!numrep) continue;
                                osize += crush_choose(map,
                                                      map->buckets[-1-w[i]],
                                                      x, numrep, rule->steps[step].arg2,
-                                                     o+osize, rule->steps[step].op == CRUSH_RULE_CHOOSE_FIRSTN);
+                                                     o+osize-j, j, rule->steps[step].op == CRUSH_RULE_CHOOSE_FIRSTN);
                        }
                        
                        /* swap t and w arrays */