FreeBSD/sbin/hastd/activemap.c
/*
 * Function should be called before we handle write requests. It updates
 * internal structures and returns true if on-disk metadata should be updated.
 */
Function should be called before we handle write requests. It updates
internal structures and returns true if on-disk metadata should be updated.
Function should be called before we handle write requests . It updates internal structures and returns true if on - disk metadata should be updated .
bool
activemap_write_start(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++) {
		if (amp->am_memtab[ext]++ == 0) {
			PJDLOG_ASSERT(!bit_test(amp->am_memmap, ext));
			bit_set(amp->am_memmap, ext);
			amp->am_ndirty++;
		}
		if (keepdirty_add(amp, ext))
			modified = true;
	}
	return (modified);
}
bool activemap_write_start ( 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 ++ ) { if ( amp -> am_memtab [ ext ] ++ == 0 ) { PJDLOG_ASSERT ( ! bit_test ( amp -> am_memmap , ext ) ) ; bit_set ( amp -> am_memmap , ext ) ; amp -> am_ndirty ++ ; } if ( keepdirty_add ( amp , ext ) ) modified = true ; } return ( modified ) ; }
Function should be called before we handle write requests.
Function should be called before we handle write requests .
/*
		 * If the number of pending writes is increased from 0,
		 * we have to mark the extent as dirty 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.
		 */