Add DBG() to fcsc_next()

... to make it easier to follow the code in fellow_cache_test

motivated by #35
parent 2553385d
......@@ -405,6 +405,10 @@ fcsc_next(struct fcscursor *c)
return (&c->fcsl->segs[c->u++]);
}
#define FCSC_NEXT(c) ( \
DBG("fcsc " #c " %p u=%u nsegs=%u next=%p", c, (c)->u, \
(c)->fdsl->nsegs, (c)->fcsl->next), fcsc_next(c))
/*
* fdo attribues we want to keep our own enum and, consequently, bitfield
* stable. so we define the enum manually and then generate code from the table
......@@ -1460,7 +1464,7 @@ fellow_seglist_regions(const struct fellow_fd *ffd,
fcsc_init(&c, fcsl);
while ((fcs = fcsc_next(&c)) != NULL)
while ((fcs = FCSC_NEXT(&c)) != NULL)
fellow_seg_regions(ffd, fcs, region, &n);
return (n);
}
......@@ -3087,7 +3091,7 @@ fellow_cache_obj_slim(const struct fellow_cache *fc,
AZ(pthread_mutex_lock(&fco->mtx));
/* anything to do at all? */
while ((fcs = fcsc_next(&c)) != NULL)
while ((fcs = FCSC_NEXT(&c)) != NULL)
if (fcs->alloc.ptr)
break;
......@@ -3096,7 +3100,7 @@ fellow_cache_obj_slim(const struct fellow_cache *fc,
fcsc_init(&c, &fco->seglist);
AZ(pthread_mutex_lock(&lru->lru_mtx));
while ((fcs = fcsc_next(&c)) != NULL) {
while ((fcs = FCSC_NEXT(&c)) != NULL) {
if (fcs->alloc.ptr == NULL)
break;
ref = 0;
......@@ -3802,11 +3806,11 @@ fellow_cache_obj_iter(struct fellow_cache *fc, struct fellow_cache_obj *fco,
flags = final ? OBJ_ITER_FLUSH : 0;
flush = 0;
while ((fcs = fcsc_next(&c)) != NULL) {
while ((fcs = FCSC_NEXT(&c)) != NULL) {
if (ra[n % mod] == NULL) {
assert(n == ran);
fcsra = fcsc_next(&rac);
fcsra = FCSC_NEXT(&rac);
assert(fcsra == fcs);
ran++;
......@@ -3817,7 +3821,7 @@ fellow_cache_obj_iter(struct fellow_cache *fc, struct fellow_cache_obj *fco,
raion = 0;
while (ran <= n + readahead) {
fcsra = fcsc_next(&rac);
fcsra = FCSC_NEXT(&rac);
if (fcsra == NULL)
break;
raio[raion++] = fcsra;
......@@ -3867,7 +3871,7 @@ fellow_cache_obj_iter(struct fellow_cache *fc, struct fellow_cache_obj *fco,
*/
AZ(flags & OBJ_ITER_END);
nextc = c;
fcsnext = fcsc_next(&nextc);
fcsnext = FCSC_NEXT(&nextc);
flush = 0;
if (fcs->state == FCS_BUSY)
flush = OBJ_ITER_FLUSH;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment