block: drbd: remove impossible failure handling
authorMing Lei <tom.leiming@gmail.com>
Fri, 11 Nov 2016 12:05:30 +0000 (20:05 +0800)
committerJens Axboe <axboe@fb.com>
Tue, 22 Nov 2016 15:57:55 +0000 (08:57 -0700)
For a non-cloned bio, bio_add_page() only returns failure when
the io vec table is full, but in that case, bio->bi_vcnt can't
be zero at all.

So remove the impossible failure handling.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/drbd/drbd_receiver.c

index a89538cb3eaabbd89ffb166acf504b5d96dd97ac..c7728dd77230a89f633f0ab8f5c95ec941b9d918 100644 (file)
@@ -1648,20 +1648,8 @@ next_bio:
 
        page_chain_for_each(page) {
                unsigned len = min_t(unsigned, data_size, PAGE_SIZE);
-               if (!bio_add_page(bio, page, len, 0)) {
-                       /* A single page must always be possible!
-                        * But in case it fails anyways,
-                        * we deal with it, and complain (below). */
-                       if (bio->bi_vcnt == 0) {
-                               drbd_err(device,
-                                       "bio_add_page failed for len=%u, "
-                                       "bi_vcnt=0 (bi_sector=%llu)\n",
-                                       len, (uint64_t)bio->bi_iter.bi_sector);
-                               err = -ENOSPC;
-                               goto fail;
-                       }
+               if (!bio_add_page(bio, page, len, 0))
                        goto next_bio;
-               }
                data_size -= len;
                sector += len >> 9;
                --nr_pages;