/* * This function uses an alternate strategy for tracking the bytes * that the user requests to be logged. This can then be used * in conjunction with the bli_orig array in the buf log item to * catch bugs in our callers' code. * * We also double check the bits set in xfs_buf_item_log using a * simple algorithm to check that every byte is accounted for. */ STATIC void xfs_buf_item_log_debug( xfs_buf_log_item_t *bip, uint first, uint last) { uint x; uint byte; uint nbytes; uint chunk_num; uint word_num; uint bit_num; uint bit_set; uint *wordp; ASSERT(bip->bli_logged != NULL); byte = first; nbytes = last - first + 1; bfset(bip->bli_logged, first, nbytes); for (x = 0; x < nbytes; x++) { chunk_num = byte >> XFS_BLF_SHIFT; word_num = chunk_num >> BIT_TO_WORD_SHIFT; bit_num = chunk_num & (NBWORD - 1); wordp = &(bip->__bli_format.blf_data_map[word_num]); bit_set = *wordp & (1 << bit_num); ASSERT(bit_set); byte++; } }
/* * This function is called when we flush something into a buffer without * logging it. This happens for things like inodes which are logged * separately from the buffer. */ void xfs_buf_item_flush_log_debug( xfs_buf_t *bp, uint first, uint last) { xfs_buf_log_item_t *bip = bp->b_fspriv; uint nbytes; if (bip == NULL || (bip->bli_item.li_type != XFS_LI_BUF)) return; ASSERT(bip->bli_logged != NULL); nbytes = last - first + 1; bfset(bip->bli_logged, first, nbytes); }
/* * This function is called when we flush something into a buffer without * logging it. This happens for things like inodes which are logged * separately from the buffer. */ void xfs_buf_item_flush_log_debug( xfs_buf_t *bp, uint first, uint last) { xfs_buf_log_item_t *bip; uint nbytes; bip = XFS_BUF_FSPRIVATE(bp, xfs_buf_log_item_t*); if ((bip == NULL) || (bip->bli_item.li_type != XFS_LI_BUF)) { return; } ASSERT(bip->bli_logged != NULL); nbytes = last - first + 1; bfset(bip->bli_logged, first, nbytes); }