FreeBSD/sbin/hastd/primary.c
/*
 * Acknowledge write completion to the kernel, but don't update activemap yet.
 */
Acknowledge write completion to the kernel, but don't update activemap yet.
Acknowledge write completion to the kernel but don ' t update activemap yet .
static void
write_complete(struct hast_resource *res, struct hio *hio)
{
	struct g_gate_ctl_io *ggio;
	unsigned int ncomp;
	PJDLOG_ASSERT(!hio->hio_done);
	ggio = &hio->hio_ggio;
	PJDLOG_ASSERT(ggio->gctl_cmd == BIO_WRITE);
	ncomp = 1;
	rw_rlock(&hio_remote_lock[ncomp]);
	if (!ISCONNECTED(res, ncomp)) {
		mtx_lock(&metadata_lock);
		if (res->hr_primary_localcnt == res->hr_secondary_remotecnt) {
			res->hr_primary_localcnt++;
			pjdlog_debug(1, "Increasing localcnt to %ju.",
			    (uintmax_t)res->hr_primary_localcnt);
			(void)metadata_write(res);
		}
		mtx_unlock(&metadata_lock);
	}
	rw_unlock(&hio_remote_lock[ncomp]);
	if (ioctl(res->hr_ggatefd, G_GATE_CMD_DONE, ggio) == -1)
		primary_exit(EX_OSERR, "G_GATE_CMD_DONE failed");
	hio->hio_done = true;
}
static void write_complete ( struct hast_resource * res , struct hio * hio ) { struct g_gate_ctl_io * ggio ; unsigned int ncomp ; PJDLOG_ASSERT ( ! hio -> hio_done ) ; ggio = & hio -> hio_ggio ; PJDLOG_ASSERT ( ggio -> gctl_cmd == BIO_WRITE ) ; ncomp = 1 ; rw_rlock ( & hio_remote_lock [ ncomp ] ) ; if ( ! ISCONNECTED ( res , ncomp ) ) { mtx_lock ( & metadata_lock ) ; if ( res -> hr_primary_localcnt == res -> hr_secondary_remotecnt ) { res -> hr_primary_localcnt ++ ; pjdlog_debug ( 1 , " " , ( uintmax_t ) res -> hr_primary_localcnt ) ; ( void ) metadata_write ( res ) ; } mtx_unlock ( & metadata_lock ) ; } rw_unlock ( & hio_remote_lock [ ncomp ] ) ; if ( ioctl ( res -> hr_ggatefd , G_GATE_CMD_DONE , ggio ) == -1 ) primary_exit ( EX_OSERR , " " ) ; hio -> hio_done = true ; }
Acknowledge write completion to the kernel, but don't update activemap yet.
Acknowledge write completion to the kernel but don ' t update activemap yet .
/*
	 * Bump local count if this is first write after
	 * connection failure with remote node.
	 */