From patchwork Mon Apr 10 16:08:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 9673147 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 B223C6020C for ; Mon, 10 Apr 2017 16:09:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9897E28179 for ; Mon, 10 Apr 2017 16:09:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D0CC27C05; Mon, 10 Apr 2017 16:09:00 +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 3147A27C05 for ; Mon, 10 Apr 2017 16:09:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752802AbdDJQI6 (ORCPT ); Mon, 10 Apr 2017 12:08:58 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:56725 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751656AbdDJQIb (ORCPT ); Mon, 10 Apr 2017 12:08:31 -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=W83oN5hwIrtMh7ZmuFMCQjcAa Imye9yCEUo3hsKJkuJMoD9XXfGwcZehEcYf/eAT7ePHm4oHYV5Em8RnMn/bOBLYciUF3n/G2Y1C0U bCBQfD2uic7xkm6lT3ORK4NiT7qLfw+z4Q1WKBeeXPOHEoXte/AI1NHCpCyfpXllOz/i0guP1a6tY /+xSKg7+u2FreCPZTvMpJNshR+7i9pGXjTXvBNL8XgjEEsdPB3WWPh32L7YzVmjhior2QcNFE45nP 8aaFq11nGNf1tuH+JtFqg7Fqn3RzLUBJBbLJPAHbVRRHBKPi6+FWVlGVWYmLh/I2p680bTj6eDNND eOguOSM1Q==; 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 1cxbrh-0008Oc-5V; Mon, 10 Apr 2017 16:08:29 +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: Mon, 10 Apr 2017 18:08:06 +0200 Message-Id: <20170410160807.23674-8-hch@lst.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170410160807.23674-1-hch@lst.de> References: <20170410160807.23674-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) \