From patchwork Wed Apr 12 08:48:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9676863 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 09AA460381 for ; Wed, 12 Apr 2017 08:48:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F02D92848E for ; Wed, 12 Apr 2017 08:48:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E522F2858A; Wed, 12 Apr 2017 08:48:42 +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_SIGNED, 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 6D0B62848E for ; Wed, 12 Apr 2017 08:48:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753661AbdDLIsj (ORCPT ); Wed, 12 Apr 2017 04:48:39 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:56201 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753660AbdDLIse (ORCPT ); Wed, 12 Apr 2017 04:48:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=c1dMQYhCV9Ck14NGNVpJxP1f+TBHtf8dRGEMFWtO3VY=; b=XcYEGzsjhfpjZExEXuIqIiT2g wB8hRnIH8CGSm0lIV00eUiNKCcBVe0c4+quypFKqKKMSDmb+wCAkWhIEIRs3ti2W3+yd75cvW/XOJ LPDbRPRhPRT95nfo8g/wKhnG5N+/jbH3q7QZnP3aUQmorlHLb1GgsOh2NLpGX9EBf0AsljSTsAgbo +XrEbfArO6uy/HTyqvIVe+dld+es0dZkM0WXAf+e0LGI+eZ+SUJoGRTC1pz/Gd59EE7oqnJWNXVEY q5uVmNJ+3M2KP7Echg8uuba5f0XxHBMwDrrVmJJgDO8Z9cV7Ay/siav9uyoGTBcEHfSW48yZkje1p 0u/rPmccQ==; Received: from clnet-p099-196.ikbnet.co.at ([83.175.99.196] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1cyDx2-0007Ze-Gj; Wed, 12 Apr 2017 08:48:32 +0000 From: Christoph Hellwig To: axboe@kernel.dk, martin.petersen@oracle.com, philipp.reisner@linbit.com, lars.ellenberg@linbit.com, target-devel@vger.kernel.org Cc: linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, drbd-dev@lists.linbit.com, dm-devel@redhat.com Subject: [PATCH 7/8] block: remove bio_no_advance_iter Date: Wed, 12 Apr 2017 10:48:08 +0200 Message-Id: <20170412084809.8245-8-hch@lst.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170412084809.8245-1-hch@lst.de> References: <20170412084809.8245-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now that we don't have to support the odd Write Same special case we can simply increment the iter if the bio has data, else just manipulate bi_size directly. Signed-off-by: Christoph Hellwig --- include/linux/bio.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index 96a20afb8575..7a24a1a24967 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -83,13 +83,6 @@ static inline bool bio_has_data(struct bio *bio) return false; } -static inline bool bio_no_advance_iter(struct bio *bio) -{ - return bio_op(bio) == REQ_OP_DISCARD || - bio_op(bio) == REQ_OP_SECURE_ERASE || - bio_op(bio) == REQ_OP_WRITE_ZEROES; -} - static inline bool bio_mergeable(struct bio *bio) { if (bio->bi_opf & REQ_NOMERGE_FLAGS) @@ -165,10 +158,10 @@ static inline void bio_advance_iter(struct bio *bio, struct bvec_iter *iter, { iter->bi_sector += bytes >> 9; - if (bio_no_advance_iter(bio)) - iter->bi_size -= bytes; - else + if (bio_has_data(bio)) bvec_iter_advance(bio->bi_io_vec, iter, bytes); + else + iter->bi_size -= bytes; } #define __bio_for_each_segment(bvl, bio, iter, start) \