From patchwork Tue Jun 11 15:10:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10987551 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B06E14E5 for ; Tue, 11 Jun 2019 15:10:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D02128535 for ; Tue, 11 Jun 2019 15:10:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7128028571; Tue, 11 Jun 2019 15:10:52 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable 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 28F5C28535 for ; Tue, 11 Jun 2019 15:10:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404507AbfFKPKv (ORCPT ); Tue, 11 Jun 2019 11:10:51 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:44802 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404494AbfFKPKv (ORCPT ); Tue, 11 Jun 2019 11:10:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type: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=JRePIxhIBKIYU5r/SmxJouq0GO/d1zeJKYfLAmd06XU=; b=Wjoi2YZ8+qKs2rr01aziZzm5dp N4gkYKqUl4FluIobWKppUOk1FO7DB/ROTaN93h/REw3v/UbQxErrGDf4O1ZyOhhkEmA8T7a87I/W6 S6LFGsemrUy1gbroEc3HWkmV5xCUhvWLK/WhGyPhgMRW13KjjMCWsg8/y3lFZsb1FR2uqFxZDGYkZ 8GAZOT5z54dHGngNWrlKrjWBMvSr6H3fVAPItKMKTZsNz5wHHLz8PmEwcwtinIZ7Zu+vlti8OBIGU OiI6eeZ+wyjESA6vhggNgqL2dTtcekd/4/IbVvoDkVJ9I94LK0++HGUEWpGkbQUVkC4cAWHkEYmAT rFYHUGhg==; Received: from mpp-cp1-natpool-1-037.ethz.ch ([82.130.71.37] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1haiQ7-0000rH-83; Tue, 11 Jun 2019 15:10:44 +0000 From: Christoph Hellwig To: Jens Axboe , Ming Lei Cc: David Gibson , "Darrick J. Wong" , linux-block@vger.kernel.org, linux-xfs@vger.kernel.org Subject: [PATCH 5/5] block: use __bio_try_merge_page in __bio_try_merge_pc_page Date: Tue, 11 Jun 2019 17:10:07 +0200 Message-Id: <20190611151007.13625-6-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190611151007.13625-1-hch@lst.de> References: <20190611151007.13625-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Passsthrough bio handling should be the same as normal bio handling, except that we need to take hardware limitations into account. Thus use the common try_merge implementation after checking the hardware limits. Signed-off-by: Christoph Hellwig --- block/bio.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/block/bio.c b/block/bio.c index 0d841ba4373a..7db7186eab1c 100644 --- a/block/bio.c +++ b/block/bio.c @@ -661,20 +661,11 @@ static bool bio_try_merge_pc_page(struct request_queue *q, struct bio *bio, phys_addr_t addr1 = page_to_phys(bv->bv_page) + bv->bv_offset; phys_addr_t addr2 = page_to_phys(page) + off + len - 1; - if (page == bv->bv_page && off == bv->bv_offset + bv->bv_len) { - *same_page = true; - goto done; - } - if ((addr1 | mask) != (addr2 | mask)) return false; if (bv->bv_len + len > queue_max_segment_size(q)) return false; - if (!page_is_mergeable(bv, page, len, off, false)) - return false; -done: - bv->bv_len += len; - return true; + return __bio_try_merge_page(bio, page, len, off, same_page); } /** @@ -737,8 +728,8 @@ static int __bio_add_pc_page(struct request_queue *q, struct bio *bio, bvec->bv_len = len; bvec->bv_offset = offset; bio->bi_vcnt++; - done: bio->bi_iter.bi_size += len; + done: bio->bi_phys_segments = bio->bi_vcnt; bio_set_flag(bio, BIO_SEG_VALID); return len;