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
958int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)958int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
959{959{
960 const bool is_bvec = iov_iter_is_bvec(iter);960 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;
962 965
963 /*966 /*
964 * If this is a BVEC iter, then the pages are kernel pages. Don't967 * 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
968 bio_set_flag(bio, BIO_NO_PAGE_REF);971 bio_set_flag(bio, BIO_NO_PAGE_REF);
969 972
970 do {973 do {
971 int ret;
972
973 if (is_bvec)974 if (is_bvec)
974 ret = __bio_iov_bvec_add_pages(bio, iter);975 ret = __bio_iov_bvec_add_pages(bio, iter);
975 else976 else
976 ret = __bio_iov_iter_get_pages(bio, iter);977 ret = __bio_iov_iter_get_pages(bio, iter);
978 } while (!ret && iov_iter_count(iter) && !bio_full(bio));
977 979
978 if (unlikely(ret))980 return bio->bi_vcnt ? 0 : ret;
979 return bio->bi_vcnt > orig_vcnt ? 0 : ret;
980
981 } while (iov_iter_count(iter) && !bio_full(bio));
982
983 return 0;
984}981}
985 982
986static void submit_bio_wait_endio(struct bio *bio)983static 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