FreeBSD/sys/geom/mirror/g_mirror.c
/*
 * Stop synchronization process.
 * type: 0 - synchronization finished
 *       1 - synchronization stopped
 */
Stop synchronization process.
type: 0 - synchronization finished
1 - synchronization stopped
Stop synchronization process . type : 0 - synchronization finished 1 - synchronization stopped
static void
g_mirror_sync_stop(struct g_mirror_disk *disk, int type)
{
	struct g_mirror_softc *sc;
	struct g_consumer *cp;
	g_topology_assert_not();
	sc = disk->d_softc;
	sx_assert(&sc->sc_lock, SX_LOCKED);
	KASSERT(disk->d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING,
	    ("Wrong disk state (%s, %s).", g_mirror_get_diskname(disk),
	    g_mirror_disk_state2str(disk->d_state)));
	if (disk->d_sync.ds_consumer == NULL)
		return;
	if (type == 0) {
		G_MIRROR_DEBUG(0, "Device %s: rebuilding provider %s finished.",
		    sc->sc_name, g_mirror_get_diskname(disk));
	} else  {
		G_MIRROR_DEBUG(0, "Device %s: rebuilding provider %s stopped.",
		    sc->sc_name, g_mirror_get_diskname(disk));
	}
	free(disk->d_sync.ds_bios, M_MIRROR);
	disk->d_sync.ds_bios = NULL;
	cp = disk->d_sync.ds_consumer;
	disk->d_sync.ds_consumer = NULL;
	disk->d_flags &= ~G_MIRROR_DISK_FLAG_DIRTY;
	sc->sc_sync.ds_ndisks--;
	sx_xunlock(&sc->sc_lock); 
	g_topology_lock();
	g_mirror_kill_consumer(sc, cp);
	g_topology_unlock();
	sx_xlock(&sc->sc_lock);
}
static void g_mirror_sync_stop ( struct g_mirror_disk * disk , int type ) { struct g_mirror_softc * sc ; struct g_consumer * cp ; g_topology_assert_not ( ) ; sc = disk -> d_softc ; sx_assert ( & sc -> sc_lock , SX_LOCKED ) ; KASSERT ( disk -> d_state == G_MIRROR_DISK_STATE_SYNCHRONIZING , ( " " , g_mirror_get_diskname ( disk ) , g_mirror_disk_state2str ( disk -> d_state ) ) ) ; if ( disk -> d_sync . ds_consumer == NULL ) return ; if ( type == 0 ) { G_MIRROR_DEBUG ( 0 , " " , sc -> sc_name , g_mirror_get_diskname ( disk ) ) ; } else { G_MIRROR_DEBUG ( 0 , " " , sc -> sc_name , g_mirror_get_diskname ( disk ) ) ; } free ( disk -> d_sync . ds_bios , M_MIRROR ) ; disk -> d_sync . ds_bios = NULL ; cp = disk -> d_sync . ds_consumer ; disk -> d_sync . ds_consumer = NULL ; disk -> d_flags &= ~ G_MIRROR_DISK_FLAG_DIRTY ; sc -> sc_sync . ds_ndisks -- ; sx_xunlock ( & sc -> sc_lock ) ; g_topology_lock ( ) ; g_mirror_kill_consumer ( sc , cp ) ; g_topology_unlock ( ) ; sx_xlock ( & sc -> sc_lock ) ; }
Stop synchronization process.
Stop synchronization process .
/* if (type == 1) */ /* Avoid recursion on sc_lock. */