/* Description: Returns the number of elements required in a scatterlist corresponding to the integrity metadata in a request.  */
int blk_rq_count_integrity_sg(struct request *rq)
/* Description: Returns the number of elements required in a scatterlist corresponding to the integrity metadata in a request.  */
int blk_rq_count_integrity_sg(struct request *rq)
{
	struct bio_vec *iv, *ivprv;
	struct req_iterator iter;
	unsigned int segments;
	ivprv = NULL;
	segments = 0;
	rq_for_each_integrity_segment(iv, rq, iter) {
		if (!ivprv || !BIOVEC_PHYS_MERGEABLE(ivprv, iv))
			segments++;
		ivprv = iv;
	}
	return segments;
}