Re: Patch??: linux-2.5.20/fs/bio.c - ll_rw_kio could generate bio's bigger than queue could handle

Andrew Morton
2002-06-06T01:44:11Z

"Adam J. Richter" wrote:
>
> ...
> >***generic_make_request: bio_sectors(bio) = 8, q->max_sectors = 64
> >***generic_make_request: bio_sectors(bio) = 96, q->max_sectors = 64
> >kernel BUG at ll_rw_blk.c:1602!
> [...]
> >>>EIP; c01bb604 <generic_make_request+d4/130> <=====
> >Trace; c01bb6dc <submit_bio+5c/70>
> >Trace; c0152aa1 <mpage_bio_submit+31/40>
> >Trace; c0152dee <do_mpage_readpage+2ee/340>
> >Trace; c019ae75 <radix_tree_insert+15/30>
> >Trace; c012809e <__add_to_page_cache+1e/a0>
> >Trace; c01281bd <add_to_page_cache_unique+3d/60>
> >Trace; c0152eaa <mpage_readpages+6a/b0>
> >Trace; c01620a0 <ext2_get_block+0/400>
> [...]
>
> I think your kernel panic is proably related to the
> same problem that I addressed in ll_rw_kio, but, in fs/mpage.c
> as Andrew Moreton suggested:

Yes, same thing.

It looks like BIO_MAX_FOO needs to become an API function.
Question is: what should it return? Number of sectors, number
of bytes or number of pages?

For my purposes, I'd prefer number of pages. ie: the vector
count which gets passed into bio_alloc:

unsigned bio_max_iovecs(struct block_device *bdev);

nr_iovecs = bio_max_iovecs(bdev);
bio = bio_alloc(GFP_KERNEL, nr_iovecs);

would suit.

And if, via this, we can submit BIOs which are larger than 64k
for the common "it's just a disk" case then that is icing.

-