FreeBSD/sbin/hastd/activemap.c
/*
 * Function should be called after receiving write confirmation. It updates
 * internal structures and returns true if on-disk metadata should be updated.
 */
Function should be called after receiving write confirmation. It updates
internal structures and returns true if on-disk metadata should be updated.
Function should be called after receiving write confirmation . It updates internal structures and returns true if on - disk metadata should be updated .
bool
activemap_write_complete(struct activemap *amp, off_t offset, off_t length)
{
	bool modified;
	off_t end;
	int ext;
	PJDLOG_ASSERT(amp->am_magic == ACTIVEMAP_MAGIC);
	PJDLOG_ASSERT(length > 0);
	modified = false;
	end = offset + length - 1;
	for (ext = off2ext(amp, offset); ext <= off2ext(amp, end); ext++) {
		PJDLOG_ASSERT(amp->am_memtab[ext] > 0);
		PJDLOG_ASSERT(bit_test(amp->am_memmap, ext));
		if (--amp->am_memtab[ext] == 0) {
			bit_clear(amp->am_memmap, ext);
			amp->am_ndirty--;
			if (keepdirty_find(amp, ext) == NULL)
				modified = true;
		}
	}
	return (modified);
}
bool activemap_write_complete ( struct activemap * amp , off_t offset , off_t length ) { bool modified ; off_t end ; int ext ; PJDLOG_ASSERT ( amp -> am_magic == ACTIVEMAP_MAGIC ) ; PJDLOG_ASSERT ( length > 0 ) ; modified = false ; end = offset + length - 1 ; for ( ext = off2ext ( amp , offset ) ; ext <= off2ext ( amp , end ) ; ext ++ ) { PJDLOG_ASSERT ( amp -> am_memtab [ ext ] > 0 ) ; PJDLOG_ASSERT ( bit_test ( amp -> am_memmap , ext ) ) ; if ( -- amp -> am_memtab [ ext ] == 0 ) { bit_clear ( amp -> am_memmap , ext ) ; amp -> am_ndirty -- ; if ( keepdirty_find ( amp , ext ) == NULL ) modified = true ; } } return ( modified ) ; }
Function should be called after receiving write confirmation.
Function should be called after receiving write confirmation .
/*
		 * If the number of pending writes goes down to 0, we have to
		 * mark the extent as clean also in on-disk bitmap.
		 * By returning true we inform the caller that on-disk bitmap
		 * was modified and has to be flushed to disk.
		 */