History

block: don't allow multiple bio_iov_iter_get_pages calls per bio

No caller uses bio_iov_iter_get_pages multiple times on a given bio, and that funtionality isn't all that useful. Removing it will make some future changes a little easier and also simplifies the function a bit.

Christoph Hellwig committed 7 years ago

Commit 14eacf11 parent a10584c1 file · +6 −9Browse files

Unified · Split

block/bio.c+6−9
@@ -958,7 +958,10 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter) · 957 unmodified lines
958958 int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
959959 {
960960 const bool is_bvec = iov_iter_is_bvec(iter);
961− unsigned short orig_vcnt = bio->bi_vcnt;
961+ int ret;
962+
963+ if (WARN_ON_ONCE(bio->bi_vcnt))
964+ return -EINVAL;
962965
963966 /*
964967 * If this is a BVEC iter, then the pages are kernel pages. Don't
@@ -968,19 +971,13 @@ int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter) · 3 unmodified lines
968971 bio_set_flag(bio, BIO_NO_PAGE_REF);
969972
970973 do {
971− int ret;
972−
973974 if (is_bvec)
974975 ret = __bio_iov_bvec_add_pages(bio, iter);
975976 else
976977 ret = __bio_iov_iter_get_pages(bio, iter);
978+ } while (!ret && iov_iter_count(iter) && !bio_full(bio));
977979
978− if (unlikely(ret))
979− return bio->bi_vcnt > orig_vcnt ? 0 : ret;
980−
981− } while (iov_iter_count(iter) && !bio_full(bio));
982−
983− return 0;
980+ return bio->bi_vcnt ? 0 : ret;
984981 }
985982
986983 static void submit_bio_wait_endio(struct bio *bio)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t