From patchwork Fri Nov 11 12:05:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9422923 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C145D60233 for ; Fri, 11 Nov 2016 12:09:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AEE05299F3 for ; Fri, 11 Nov 2016 12:09:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3C8229A87; Fri, 11 Nov 2016 12:09:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD32C299F3 for ; Fri, 11 Nov 2016 12:09:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756262AbcKKMGf (ORCPT ); Fri, 11 Nov 2016 07:06:35 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34744 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751606AbcKKMGd (ORCPT ); Fri, 11 Nov 2016 07:06:33 -0500 Received: by mail-pf0-f193.google.com with SMTP id y68so2415125pfb.1; Fri, 11 Nov 2016 04:06:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WHOF417ilElcSyFF13gIddGFhHzBh5amifXQjSYrU4I=; b=PaxJkj2HeKxC2VWG8wcrKiJd7mtvhBSsW8DUJzCyxrjWbnKRTruyK3znZmWAZHrvs9 x2v7i4F2razGjzHcjWAaIfbqFgDpmfU+NToxJAvsq8+aaXaeNhuz3luQCgE2WeMNjj2S aCaSSo6zwIWemFJJYx/Wl0jhxoHKAY/gjqFwpHPCVasubsHQOhH0BI+TmMYCMu57/g22 YDDeHcWO/y50+3k6uycDwKjuwYITVABOKlLAKea69d7QONnV8V1EfbPPZa5durKPusL1 kCE7rcia8d2UAOZyoHRvbMwPrlLsaQ5pZ3Go3gV0CtwoIbPDFtRqTpnjL529txMgsGk1 isOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WHOF417ilElcSyFF13gIddGFhHzBh5amifXQjSYrU4I=; b=N5kuiJQ7mHT30UvExeaPiJeLxBwri/mS697lRqJ5LimnehiuzVM1nzufgIDW9umDBv 2dbT7tk7+ih18rAFPHJ+xR3L8UjplEMFKE9jZJNXiK5scoKjl4Hwoq+jYH0wohYwRkhw JBh9wc7kSeqiW7Bfa8NG30TKoulkBGvNyPDLgoQhzg670SMsCNr4MY9hIkMeJJm30UEO s/2hBzqyzmBegkE7RTfnyZczUsRWgi5wnNMexeqDdaBFmkGuRvICtH3wLuG3Sy8u627k XlCT+epxEUPfwwY906DcB/BrzEH+L0Nb0dXCtHHYWf8G55MyZ6+RHX11WQY6HsmqOp6X LrpA== X-Gm-Message-State: ABUngvd1Ebg/ME5W/1pWcokVptjW1pnJWXPCagFg5Mf5Zbk95Cxyfz6DogCAt8TN+/+oVA== X-Received: by 10.98.66.214 with SMTP id h83mr6258196pfd.67.1478865993088; Fri, 11 Nov 2016 04:06:33 -0800 (PST) Received: from localhost ([45.34.23.101]) by smtp.gmail.com with ESMTPSA id c128sm14777670pfc.39.2016.11.11.04.06.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Nov 2016 04:06:32 -0800 (PST) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , Ming Lei , Philipp Reisner , Lars Ellenberg , drbd-dev@lists.linbit.com (open list:DRBD DRIVER) Subject: [PATCH 02/12] block: drbd: remove impossible failure handling Date: Fri, 11 Nov 2016 20:05:30 +0800 Message-Id: <1478865957-25252-3-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478865957-25252-1-git-send-email-tom.leiming@gmail.com> References: <1478865957-25252-1-git-send-email-tom.leiming@gmail.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Lars Ellenberg Signed-off-by: Ming Lei --- drivers/block/drbd/drbd_receiver.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index a89538cb3eaa..c7728dd77230 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -1648,20 +1648,8 @@ int drbd_submit_peer_request(struct drbd_device *device, 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;