Re: [PATCH 07/19] block: simplify bio_map_kern

Christoph Hellwig <[email protected]>
Newsgroups org.kernel.vger.linux-bcache,dev.linux.lists.dm-devel,dev.linux.lists.gfs2,org.kernel.vger.linux-block,org.kernel.vger.linux-btrfs,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-pm,org.kernel.vger.linux-xfs
Message-ID <[email protected]>
On Fri, May 02, 2025 at 03:56:08AM +0900, Damien Le Moal wrote:
> > -	unsigned long kaddr = (unsigned long)data;
> > -	unsigned long end = (kaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT;
> > -	unsigned long start = kaddr >> PAGE_SHIFT;
> > -	const int nr_pages = end - start;
> > -	bool is_vmalloc = is_vmalloc_addr(data);
> > -	struct page *page;
> > -	int offset, i;
> > +	unsigned int nr_vecs = bio_add_max_vecs(data, len);
> >  	struct bio *bio;
> >  
> > -	bio = bio_kmalloc(nr_pages, gfp_mask);
> > +	bio = bio_kmalloc(nr_vecs, gfp_mask);
> 
> This may also fail if nr_vecs is larger than UIO_MAXIOV, in which case, the
> ENOMEM error may not really be appropriate. I guess we can sort this out
> separately though.

Yeah.  It's also existing behavior, so no real change here.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.