From patchwork Thu Apr 14 12:02:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 8834791 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AB504C0553 for ; Thu, 14 Apr 2016 12:03:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D712C20109 for ; Thu, 14 Apr 2016 12:03:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EFA8E2014A for ; Thu, 14 Apr 2016 12:03:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754475AbcDNMDR (ORCPT ); Thu, 14 Apr 2016 08:03:17 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:33157 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754603AbcDNMDQ (ORCPT ); Thu, 14 Apr 2016 08:03:16 -0400 Received: by mail-oi0-f67.google.com with SMTP id v67so9554122oie.0; Thu, 14 Apr 2016 05:03:16 -0700 (PDT) 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=5Crlj7ccFjxJ+ORpyitBBmlsp/+MHGqvISy+riBiBX0=; b=wphe14LWWjSZXwmdaySW4Ahi8BjkQmpm4KW5L8leIhRTmQEPIIm7v5TL0EvR67CHBU iM99DZeEILW8m39PrQrZbhUdllCwtXepI8FEKvuk9OgTkfQUEnd6F2A2kTI3s0mvL4EN whPZBNMbbRc3NKqRL6dpAFp5fmj7NwAi43AHn1yM3+L66vlTqqnS93+Sjohw0gfNoq11 GsRXRc8AxD8AA7kKf/Yhz8YqjaQ1g0qvOGmAQuGQO18Hv16o5S5xIu2wGT2DptimN3jy o6A5aF8ETVyZOdmDlBc9HKgRB+gCLo9hhuQI1S3YMko2RpDHxdksJuHAAJnfcQqMbMqs f10Q== 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=5Crlj7ccFjxJ+ORpyitBBmlsp/+MHGqvISy+riBiBX0=; b=UZNF70kNAqcqa5PuIOE+2D3O2Td/PuRnUhdvgxr5waHkUVGlwRYbcpZy8VhaxPQbiG dm+9GSxJxLRuBXLkBQlZDQT7iwYF4yqhqSmaQoyadxNmW0sNVlA54zB/1VL48pNyiTjI i4TbmiT4h1wR0q9iFFTBMKEzqvh2y48WHbGOc9HTSuytqtB2yEpAWGizYZ07CkBYrB+a nIka95HswZKuK9Psb5S4N7/molkTZQw0D2yOC3FS6DRBEH6TtOLQgiGcIdtg9sWWUqsH ECibtfm30Fw1iolmt1gyyZ8T7BQIJYZXhC9YeA9cl+zvg9Tlx2u3NOR+Ht830Y948aog HJng== X-Gm-Message-State: AOPr4FUhAtBgpbQgvuY1k8CkKrFOGFtNQX2oghNRFJEqsUOS19GHqHcme0jBa17iLYGsrQ== X-Received: by 10.157.4.72 with SMTP id 66mr7983908otc.141.1460635395412; Thu, 14 Apr 2016 05:03:15 -0700 (PDT) Received: from localhost ([12.228.154.70]) by smtp.gmail.com with ESMTPSA id h202sm13373148oic.17.2016.04.14.05.03.14 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 14 Apr 2016 05:03:14 -0700 (PDT) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, Christoph Hellwig , Ming Lei , Philipp Reisner , Lars Ellenberg , drbd-dev@lists.linbit.com (open list:DRBD DRIVER) Subject: [PATCH v1 03/27] block: drbd: remove impossible failure handling Date: Thu, 14 Apr 2016 20:02:21 +0800 Message-Id: <1460635375-28282-4-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1460635375-28282-1-git-send-email-tom.leiming@gmail.com> References: <1460635375-28282-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-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.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. 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 050aaa1..1b0ed15 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -1465,20 +1465,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;