/* Return the approximate number of pages we can send to this target. There's no guarantee that you will be able to fit this number of pages into a bio, it does not account for dynamic restrictions that vary on offset.  */
int bio_get_nr_vecs(struct block_device *bdev)
/* Return the approximate number of pages we can send to this target. There's no guarantee that you will be able to fit this number of pages into a bio, it does not account for dynamic restrictions that vary on offset.  */
int bio_get_nr_vecs(struct block_device *bdev)
{
	struct request_queue *q = bdev_get_queue(bdev);
	int nr_pages;
	nr_pages = ((queue_max_sectors(q) << 9) + PAGE_SIZE - 1) >> PAGE_SHIFT;
	if (nr_pages > queue_max_phys_segments(q))
		nr_pages = queue_max_phys_segments(q);
	if (nr_pages > queue_max_hw_segments(q))
		nr_pages = queue_max_hw_segments(q);
	return nr_pages;
}