/* Map the kernel address into a bio suitable for io to a block device. Returns an error pointer in case of error.  */
struct bio* bio_map_kern(struct request_queue *q, void *data, unsigned int len, gfp_t gfp_mask)
/* Map the kernel address into a bio suitable for io to a block device. Returns an error pointer in case of error.  */
struct bio* bio_map_kern(struct request_queue *q, void *data, unsigned int len, gfp_t gfp_mask)
{
	struct bio *bio;
	bio = __bio_map_kern(q, data, len, gfp_mask);
	if (IS_ERR(bio))
		return bio;
	if (bio->bi_size == len)
		return bio;
	bio_put(bio);
	return ERR_PTR(-EINVAL);
}