RE: [PATCH 1/4] block: bio: introduce helpers to get the 1st and last bvec
From: Elliott, Robert (Persistent Memory)
Date: Tue Feb 16 2016 - 22:08:24 EST
> -----Original Message-----
> From: linux-block-owner@xxxxxxxxxxxxxxx [mailto:linux-block-
> owner@xxxxxxxxxxxxxxx] On Behalf Of Ming Lei
> Sent: Monday, February 15, 2016 3:42 AM
> Subject: Re: [PATCH 1/4] block: bio: introduce helpers to get the 1st and
> last bvec
...
> diff --git a/include/linux/bio.h b/include/linux/bio.h
...
> static inline void bio_get_last_bvec(struct bio *bio, struct bio_vec *bv)
> {
> - struct bvec_iter iter;
> + struct bvec_iter iter = bio->bi_iter;
> + int idx;
> +
> + bio_advance_iter(bio, &iter, iter.bi_size);
> +
> + WARN_ON(!iter.bi_idx && !iter.bi_bvec_done);
If this ever did trigger, I don't think you'd want it for every bio
with a problem. WARN_ONCE would be safer.
---
Robert Elliott, HPE Persistent Memory