FreeBSD/sys/geom/mirror/g_mirror.c
/*
 * Return TRUE if the given request is colliding with a in-progress
 * synchronization request.
 */
Return TRUE if the given request is colliding with a in-progress
synchronization request.
Return TRUE if the given request is colliding with a in - progress synchronization request .
static int
g_mirror_sync_collision(struct g_mirror_softc *sc, struct bio *bp)
{
	struct g_mirror_disk *disk;
	struct bio *sbp;
	off_t rstart, rend, sstart, send;
	u_int i;
	if (sc->sc_sync.ds_ndisks == 0)
		return (0);
	rstart = bp->bio_offset;
	rend = bp->bio_offset + bp->bio_length;
	LIST_FOREACH(disk, &sc->sc_disks, d_next) {
		if (disk->d_state != G_MIRROR_DISK_STATE_SYNCHRONIZING)
			continue;
		for (i = 0; i < g_mirror_syncreqs; i++) {
			sbp = disk->d_sync.ds_bios[i];
			if (sbp == NULL)
				continue;
			sstart = sbp->bio_offset;
			send = sbp->bio_offset + sbp->bio_length;
			if (rend > sstart && rstart < send)
				return (1);
		}
	}
	return (0);
}
static int g_mirror_sync_collision ( struct g_mirror_softc * sc , struct bio * bp ) { struct g_mirror_disk * disk ; struct bio * sbp ; off_t rstart , rend , sstart , send ; u_int i ; if ( sc -> sc_sync . ds_ndisks == 0 ) return ( 0 ) ; rstart = bp -> bio_offset ; rend = bp -> bio_offset + bp -> bio_length ; LIST_FOREACH ( disk , & sc -> sc_disks , d_next ) { if ( disk -> d_state != G_MIRROR_DISK_STATE_SYNCHRONIZING ) continue ; for ( i = 0 ; i < g_mirror_syncreqs ; i ++ ) { sbp = disk -> d_sync . ds_bios [ i ] ; if ( sbp == NULL ) continue ; sstart = sbp -> bio_offset ; send = sbp -> bio_offset + sbp -> bio_length ; if ( rend > sstart && rstart < send ) return ( 1 ) ; } } return ( 0 ) ; }
Return TRUE if the given request is colliding with a in-progress
 synchronization request.
Return TRUE if the given request is colliding with a in - progress synchronization request .