Message ID | 20220630204212.1265638-9-kbusch@fb.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | block: support for partial sector reads | expand |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 992ee987f273..ded38accf009 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -452,6 +452,17 @@ static inline int bio_iov_vecs_to_alloc(struct iov_iter *iter, int max_segs) return iov_iter_npages(iter, max_segs); } +static inline int bio_iov_vecs_to_alloc_partial(struct iov_iter *iter, + int max_segs, bool trunc, + bool skip) +{ + if (skip || trunc) + return min(iov_iter_npages(iter, max_segs) + skip + trunc, + max_segs); + else + return bio_iov_vecs_to_alloc(iter, max_segs); +} + struct request_queue; extern int submit_bio_wait(struct bio *bio);