[PATCH 01/23] block: factor out a bvec_set_page helper

Jakub Kicinski kuba at kernel.org
Mon Jan 30 20:47:58 PST 2023


On Mon, 30 Jan 2023 10:21:35 +0100 Christoph Hellwig wrote:
> diff --git a/include/linux/bvec.h b/include/linux/bvec.h
> index 35c25dff651a5e..9e3dac51eb26b6 100644
> --- a/include/linux/bvec.h
> +++ b/include/linux/bvec.h
> @@ -35,6 +35,21 @@ struct bio_vec {
>  	unsigned int	bv_offset;
>  };
>  
> +/**
> + * bvec_set_page - initialize a bvec based off a struct page
> + * @bv:		bvec to initialize
> + * @page:	page the bvec should point to
> + * @len:	length of the bvec
> + * @offset:	offset into the page
> + */
> +static inline void bvec_set_page(struct bio_vec *bv, struct page *page,
> +		unsigned int len, unsigned int offset)
> +{
> +	bv->bv_page = page;
> +	bv->bv_len = len;
> +	bv->bv_offset = offset;
> +}

kinda random thought but since we're touching this area - could we
perhaps move the definition of struct bio_vec and trivial helpers 
like this into a new header? bvec.h pulls in mm.h which is a right
behemoth :S



More information about the Linux-nvme mailing list