FreeBSD/sbin/hastd/activemap.c
/*
 * Function copies the given buffer read from disk to the internal bitmap.
 */
Function copies the given buffer read from disk to the internal bitmap.
Function copies the given buffer read from disk to the internal bitmap .
void
activemap_copyin(struct activemap *amp, const unsigned char *buf, size_t size)
{
	int ext;
	PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC);
	PJDLOG_ASSERT(size >= amp->am_mapsize);
	memcpy(amp->am_diskmap, buf, amp->am_mapsize);
	memcpy(amp->am_memmap, buf, amp->am_mapsize);
	memcpy(amp->am_syncmap, buf, amp->am_mapsize);
	bit_ffs(amp->am_memmap, amp->am_nextents, &ext);
	if (ext == -1) {
		return;
	}
	activemap_sync_rewind(amp);
	amp->am_ndirty = 0;
	for (; ext < amp->am_nextents; ext++) {
		if (bit_test(amp->am_memmap, ext)) {
			amp->am_memtab[ext] = ext2reqs(amp, ext);
			amp->am_ndirty++;
		}
	}
}
void activemap_copyin ( struct activemap * amp , const unsigned char * buf , size_t size ) { int ext ; PJDLOG_ASSERT ( amp -> am_magic == ACTIVEMAP_MAGIC ) ; PJDLOG_ASSERT ( size >= amp -> am_mapsize ) ; memcpy ( amp -> am_diskmap , buf , amp -> am_mapsize ) ; memcpy ( amp -> am_memmap , buf , amp -> am_mapsize ) ; memcpy ( amp -> am_syncmap , buf , amp -> am_mapsize ) ; bit_ffs ( amp -> am_memmap , amp -> am_nextents , & ext ) ; if ( ext == -1 ) { return ; } activemap_sync_rewind ( amp ) ; amp -> am_ndirty = 0 ; for ( ; ext < amp -> am_nextents ; ext ++ ) { if ( bit_test ( amp -> am_memmap , ext ) ) { amp -> am_memtab [ ext ] = ext2reqs ( amp , ext ) ; amp -> am_ndirty ++ ; } } }
Function copies the given buffer read from disk to the internal bitmap.
Function copies the given buffer read from disk to the internal bitmap .
/* There are no dirty extents, so we can leave now. */ /*
	 * Set synchronization offset to the first dirty extent.
	 */ /*
	 * We have dirty extents and we want them to stay that way until
	 * we synchronize, so we set number of pending writes to number
	 * of requests needed to synchronize one extent.
	 */