/* Free pages allocated from bio_copy_user() and write back data to user space in case of a read.  */
int bio_uncopy_user(struct bio *bio)
/* Free pages allocated from bio_copy_user() and write back data to user space in case of a read.  */
int bio_uncopy_user(struct bio *bio)
{
	struct bio_map_data *bmd = bio->bi_private;
	int ret = 0;
	if (!bio_flagged(bio, BIO_NULL_MAPPED))
		ret = __bio_copy_iov(bio, bmd->iovecs, bmd->sgvecs,
				     bmd->nr_sgvecs, bio_data_dir(bio) == READ,
				     0, bmd->is_our_pages);
	bio_free_map_data(bmd);
	bio_put(bio);
	return ret;
}