From patchwork Sat Oct 29 08:08:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9403479 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 9ABC3601C0 for ; Sat, 29 Oct 2016 08:34:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 87CA12A6C1 for ; Sat, 29 Oct 2016 08:34:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BFDB2A747; Sat, 29 Oct 2016 08:34:07 +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 0B6422A6C1 for ; Sat, 29 Oct 2016 08:34:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932875AbcJ2IeB (ORCPT ); Sat, 29 Oct 2016 04:34:01 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34008 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755103AbcJ2IMM (ORCPT ); Sat, 29 Oct 2016 04:12:12 -0400 Received: by mail-pf0-f195.google.com with SMTP id u84so3374122pfj.1; Sat, 29 Oct 2016 01:12:11 -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=Vv6AbeBiCU7+XqkSGUI77ywrgWdjSsCDPvczakUqLMc=; b=vKF620G8F23NycDofAQ2Dx+lgoUL4a5i00mhUcEDZC+OimxG5jOWyDxERterZekVYn Xu1BD0y+NzUgzK0VYrah5rB+xNj3xX0X1/Bp3TgjBNZ/MswT0XcvFmPxPEAXZoyUyhNi y9I40hrWRvJk8GVfwApu17qD6ysog2KioqZWm1RJNeObTLjPf+PMIIOoXicCFH0AAdDk uj26Eo0L+vJt/zf9IK1van0u2Mi50I8bLA7yVfI/DXt6uCn3PEH+9j9H1VARTDt0lLu0 S2i8sV0RxgkV0L9TB5tO5q5jsMJXLcx8opaTRyQque3LjIKkHh0RhmeL3WB7J2s/5/04 ZWxQ== 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=Vv6AbeBiCU7+XqkSGUI77ywrgWdjSsCDPvczakUqLMc=; b=cekvrf0P2Bc7yTBLxQSmaO5OvHclHzu1ZLuKZ3smA8Ute0FVCv+3d8UKayI16kmmlU Kotue6wooH1zAl/FyXWgSUnERwgfoXX6AbmXoB6tUHE6uqjxdZO/vO++IDnGQ3QOj7UJ Nj6FZiQUO79rwSeiL0CeLGWihL4zgM8IwCwTBkavWyk/uckIPKkrYYgmA61WjF5Ht6P9 pDvxEEqDseCuv886BZJz+697nQk9Uv3m/l4r9O7OjHg0ba5EdoaxhH6ZFfW9oo7ohVbM +GgQUyglza2/GWJyeKONF8EqboP8QWH9WByaJ5/6E3rOyPPibVidGL7yToBTK++A1l2V J83A== X-Gm-Message-State: ABUngvftC15EZK+m2vaCl5B+Dua5UIZK2JIugAFuxLIuiYz6FezXJgNz2dy8Q8+ILKL9ow== X-Received: by 10.99.52.10 with SMTP id b10mr5361488pga.42.1477728731413; Sat, 29 Oct 2016 01:12:11 -0700 (PDT) Received: from localhost ([45.34.23.101]) by smtp.gmail.com with ESMTPSA id xs10sm23561366pac.24.2016.10.29.01.12.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Oct 2016 01:12:10 -0700 (PDT) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , "Kirill A . Shutemov" , Ming Lei , Philipp Reisner , Lars Ellenberg , drbd-dev@lists.linbit.com (open list:DRBD DRIVER) Subject: [PATCH 03/60] block: drbd: remove impossible failure handling Date: Sat, 29 Oct 2016 16:08:02 +0800 Message-Id: <1477728600-12938-4-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> References: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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. Acked-by: Lars Ellenberg Signed-off-by: Ming Lei Reviewed-by: Christoph Hellwig --- 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 942384f34e22..c537e3bd09eb 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;