FreeBSD/sys/geom/vinum/geom_vinum_raid5.c
/*
 * Check if the stripe that the work packet wants is already being used by
 * some other work packet.
 */
Check if the stripe that the work packet wants is already being used by
some other work packet.
Check if the stripe that the work packet wants is already being used by some other work packet .
int
gv_stripe_active(struct gv_plex *p, struct bio *bp)
{
	struct gv_raid5_packet *wp, *owp;
	int overlap;
	wp = bp->bio_caller2;
	if (wp->lockbase == -1)
		return (0);
	overlap = 0;
	TAILQ_FOREACH(owp, &p->packets, list) {
		if (owp == wp)
			break;
		if ((wp->lockbase >= owp->lockbase) &&
		    (wp->lockbase <= owp->lockbase + owp->length)) {
			overlap++;
			break;
		}
		if ((wp->lockbase <= owp->lockbase) &&
		    (wp->lockbase + wp->length >= owp->lockbase)) {
			overlap++;
			break;
		}
	}
	return (overlap);
}
int gv_stripe_active ( struct gv_plex * p , struct bio * bp ) { struct gv_raid5_packet * wp , * owp ; int overlap ; wp = bp -> bio_caller2 ; if ( wp -> lockbase == -1 ) return ( 0 ) ; overlap = 0 ; TAILQ_FOREACH ( owp , & p -> packets , list ) { if ( owp == wp ) break ; if ( ( wp -> lockbase >= owp -> lockbase ) && ( wp -> lockbase <= owp -> lockbase + owp -> length ) ) { overlap ++ ; break ; } if ( ( wp -> lockbase <= owp -> lockbase ) && ( wp -> lockbase + wp -> length >= owp -> lockbase ) ) { overlap ++ ; break ; } } return ( overlap ) ; }
Check if the stripe that the work packet wants is already being used by
 some other work packet.
Check if the stripe that the work packet wants is already being used by some other work packet .