Changeset View
Changeset View
Standalone View
Standalone View
head/sys/geom/mirror/g_mirror.c
Show First 20 Lines • Show All 2,064 Lines • ▼ Show 20 Lines | g_mirror_sync_reinit(const struct g_mirror_disk *disk, struct bio *bp, | ||||
bp->bio_cmd = BIO_READ; | bp->bio_cmd = BIO_READ; | ||||
bp->bio_data = data; | bp->bio_data = data; | ||||
bp->bio_done = g_mirror_sync_done; | bp->bio_done = g_mirror_sync_done; | ||||
bp->bio_from = disk->d_sync.ds_consumer; | bp->bio_from = disk->d_sync.ds_consumer; | ||||
bp->bio_to = disk->d_softc->sc_provider; | bp->bio_to = disk->d_softc->sc_provider; | ||||
bp->bio_caller1 = (void *)(uintptr_t)idx; | bp->bio_caller1 = (void *)(uintptr_t)idx; | ||||
bp->bio_offset = offset; | bp->bio_offset = offset; | ||||
bp->bio_length = MIN(MAXPHYS, | bp->bio_length = MIN(maxphys, | ||||
disk->d_softc->sc_mediasize - bp->bio_offset); | disk->d_softc->sc_mediasize - bp->bio_offset); | ||||
} | } | ||||
static void | static void | ||||
g_mirror_sync_start(struct g_mirror_disk *disk) | g_mirror_sync_start(struct g_mirror_disk *disk) | ||||
{ | { | ||||
struct g_mirror_softc *sc; | struct g_mirror_softc *sc; | ||||
struct g_mirror_disk_sync *sync; | struct g_mirror_disk_sync *sync; | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | g_mirror_sync_start(struct g_mirror_disk *disk) | ||||
* Allocate memory for synchronization bios and initialize them. | * Allocate memory for synchronization bios and initialize them. | ||||
*/ | */ | ||||
sync->ds_bios = malloc(sizeof(struct bio *) * g_mirror_syncreqs, | sync->ds_bios = malloc(sizeof(struct bio *) * g_mirror_syncreqs, | ||||
M_MIRROR, M_WAITOK); | M_MIRROR, M_WAITOK); | ||||
for (i = 0; i < g_mirror_syncreqs; i++) { | for (i = 0; i < g_mirror_syncreqs; i++) { | ||||
bp = g_alloc_bio(); | bp = g_alloc_bio(); | ||||
sync->ds_bios[i] = bp; | sync->ds_bios[i] = bp; | ||||
bp->bio_data = malloc(MAXPHYS, M_MIRROR, M_WAITOK); | bp->bio_data = malloc(maxphys, M_MIRROR, M_WAITOK); | ||||
bp->bio_caller1 = (void *)(uintptr_t)i; | bp->bio_caller1 = (void *)(uintptr_t)i; | ||||
g_mirror_sync_reinit(disk, bp, sync->ds_offset); | g_mirror_sync_reinit(disk, bp, sync->ds_offset); | ||||
sync->ds_offset += bp->bio_length; | sync->ds_offset += bp->bio_length; | ||||
} | } | ||||
/* Increase the number of disks in SYNCHRONIZING state. */ | /* Increase the number of disks in SYNCHRONIZING state. */ | ||||
sc->sc_sync.ds_ndisks++; | sc->sc_sync.ds_ndisks++; | ||||
/* Set the number of in-flight synchronization requests. */ | /* Set the number of in-flight synchronization requests. */ | ||||
▲ Show 20 Lines • Show All 1,443 Lines • Show Last 20 Lines |