sys/vfs/hammer2/hammer2_subr.c
int
hammer2_calc_logical(hammer2_inode_t *ip, hammer2_off_t uoff,
		     hammer2_key_t *lbasep, hammer2_key_t *leofp)
{
	hammer2_inode_data_t *ipdata = &ip->chain->data->ipdata;
	int radix;

	*lbasep = uoff & ~HAMMER2_PBUFMASK64;
	*leofp = ipdata->size & ~HAMMER2_PBUFMASK64;
	KKASSERT(*lbasep <= *leofp);
	if (*lbasep == *leofp /*&& *leofp < 1024 * 1024*/) {
		radix = hammer2_allocsize((size_t)(ipdata->size - *leofp));
		if (radix < HAMMER2_MINALLOCRADIX)
			radix = HAMMER2_MINALLOCRADIX;
		*leofp += 1U << radix;
		return (1U << radix);
	} else {
		return (HAMMER2_PBUFSIZE);
	}
}
/*
 * ip must be locked sh/ex
 */
ip must be locked sh/ex
ip must be locked sh / ex
int
hammer2_calc_logical(hammer2_inode_t *ip, hammer2_off_t uoff,
		     hammer2_key_t *lbasep, hammer2_key_t *leofp)
{
	hammer2_inode_data_t *ipdata = &ip->chain->data->ipdata;
	int radix;
	*lbasep = uoff & ~HAMMER2_PBUFMASK64;
	*leofp = ipdata->size & ~HAMMER2_PBUFMASK64;
	KKASSERT(*lbasep <= *leofp);
	if (*lbasep == *leofp ) {
		radix = hammer2_allocsize((size_t)(ipdata->size - *leofp));
		if (radix < HAMMER2_MINALLOCRADIX)
			radix = HAMMER2_MINALLOCRADIX;
		*leofp += 1U << radix;
		return (1U << radix);
	} else {
		return (HAMMER2_PBUFSIZE);
	}
}
int hammer2_calc_logical ( hammer2_inode_t * ip , hammer2_off_t uoff , hammer2_key_t * lbasep , hammer2_key_t * leofp ) { hammer2_inode_data_t * ipdata = & ip -> chain -> data -> ipdata ; int radix ; * lbasep = uoff & ~ HAMMER2_PBUFMASK64 ; * leofp = ipdata -> size & ~ HAMMER2_PBUFMASK64 ; KKASSERT ( * lbasep <= * leofp ) ; if ( * lbasep == * leofp ) { radix = hammer2_allocsize ( ( size_t ) ( ipdata -> size - * leofp ) ) ; if ( radix < HAMMER2_MINALLOCRADIX ) radix = HAMMER2_MINALLOCRADIX ; * leofp += 1U << radix ; return ( 1U << radix ) ; } else { return ( HAMMER2_PBUFSIZE ) ; } }
ip must be locked sh/ex
ip must be locked sh / ex
/*&& *leofp < 1024 * 1024*/