/* Return Value: On success, pointer to the struct bio is returned. On error, NULL is returned.  */
static struct bio* nilfs_alloc_seg_bio(struct the_nilfs *nilfs, sector_t start, int nr_vecs)
/* Return Value: On success, pointer to the struct bio is returned. On error, NULL is returned.  */
static struct bio* nilfs_alloc_seg_bio(struct the_nilfs *nilfs, sector_t start, int nr_vecs)
{
	struct bio *bio;
	bio = bio_alloc(GFP_NOIO, nr_vecs);
	if (bio == NULL) {
		while (!bio && (nr_vecs >>= 1))
			bio = bio_alloc(GFP_NOIO, nr_vecs);
	}
	if (likely(bio)) {
		bio->bi_bdev = nilfs->ns_bdev;
		bio->bi_sector = start << (nilfs->ns_blocksize_bits - 9);
	}
	return bio;
}