From patchwork Tue Apr 5 11:56:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 8750111 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A3DB79F336 for ; Tue, 5 Apr 2016 11:59:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D7843203A1 for ; Tue, 5 Apr 2016 11:59:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 111D22034F for ; Tue, 5 Apr 2016 11:59:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755878AbcDEL7G (ORCPT ); Tue, 5 Apr 2016 07:59:06 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33704 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754796AbcDEL7F (ORCPT ); Tue, 5 Apr 2016 07:59:05 -0400 Received: by mail-pf0-f195.google.com with SMTP id e190so1174601pfe.0; Tue, 05 Apr 2016 04:58:59 -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=mZ7Hw2xeYT4xlaG9CJDk9t2e+ul/zuugosqwM00PjBo=; b=KZgdgH3zMcCySnuzWXuv7OnVhsi5zj57rsUN6R6udkBapfLiAAIuLc0pcYR4ENGdjM hwXAaeE0StA65EEcN0pl500oazLZBomxl2H599oZqq2y0Ukun0pp73EYBJPtRUXWvOcf 9hzhbxox0Spmbgqr0xW1VcK4sckbVrtquZxhaPsgilQq0dmH+O1oOMK4vA18kjTAa0k6 DDfogtBMs0zsVM+3FMhP6yPiMRmCHdxx8X/oIuP7+HXJOjHT/ImJ/Jnf9fMqOrzFeMxh Dp+oWyb9qMa5B2sCXciLAV0bkBggoUypBkMZRhTQWPToJQFqyyi/ZG+80gSP5N3yWmDe hD3w== 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=mZ7Hw2xeYT4xlaG9CJDk9t2e+ul/zuugosqwM00PjBo=; b=gI+fQ4JFgogbRc+aOrHcmfBHrSAEkRiPs5SCuhlzLylD/vZTQKgblW94yIdgG2uLHJ IOL/RolVJc96N3rVo0Zq+snWcJR+NveCVb27f4Fmaus7Bla5ThB4WVaVw687RuzbyNRD s7IzRTCw5w04vtKR07UHzy8O2eJtfjHhYF+xn4dbBkXRddRjnL6J9I6LdDtFfeWM67PR kzt6DusxInfg4GtImB1laQcN2fKF/rr4iuKu66QpqwZVb6n8eK13DlBMuJXPkjcpDbXR /YYre+H8UCu3zzEPdlR8fJ1wEp74leuyKwHLwA5VVIfoscPYzE5FZX4/B+g/TVM/UsMa 5C7A== X-Gm-Message-State: AD7BkJIzR2Lw5cQDV4rj5WL3l3gSDjkHQiZSbcDOiIvLVxtJpdBuXePJrgDsCUitwWPlNg== X-Received: by 10.98.16.150 with SMTP id 22mr28985338pfq.128.1459857539454; Tue, 05 Apr 2016 04:58:59 -0700 (PDT) Received: from localhost (56.34.213.162.lcy-01.canonistack.canonical.com. [162.213.34.56]) by smtp.gmail.com with ESMTPSA id 8sm46483961pfk.69.2016.04.05.04.58.57 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 05 Apr 2016 04:58:58 -0700 (PDT) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, Christoph Hellwig , Boaz Harrosh , Ming Lei , Philipp Reisner , Lars Ellenberg , drbd-dev@lists.linbit.com (open list:DRBD DRIVER) Subject: [PATCH 03/27] block: drbd: remove impossible failure handling Date: Tue, 5 Apr 2016 19:56:48 +0800 Message-Id: <1459857443-20611-4-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1459857443-20611-1-git-send-email-tom.leiming@gmail.com> References: <1459857443-20611-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. 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;