[dm-devel] [PATCH 1/5] block: factor out a chunk_size_left helper

Bart Van Assche bvanassche at acm.org
Tue Oct 12 16:50:11 UTC 2021


On 10/12/21 9:36 AM, Christoph Hellwig wrote:
> +/*
> + * Return how much of the chunk sectors is left to be used for an I/O at the
> + * given offset.
> + */
> +static inline unsigned int chunk_size_left(sector_t offset,
> +		unsigned int chunk_sectors)
> +{
> +	if (unlikely(!is_power_of_2(chunk_sectors)))
> +		return chunk_sectors - sector_div(offset, chunk_sectors);
> +	return chunk_sectors - (offset & (chunk_sectors - 1));
> +}

No "blk_" prefix for the function name? I think most other functions 
declared or defined in this header file have such a prefix.

Thanks,

Bart.




More information about the dm-devel mailing list