From patchwork Tue Sep 4 19:14:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10587803 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 A49CB13AC for ; Tue, 4 Sep 2018 19:14:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 966AD27F82 for ; Tue, 4 Sep 2018 19:14:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AB9F28D32; Tue, 4 Sep 2018 19:14:47 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,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 39DB827F82 for ; Tue, 4 Sep 2018 19:14:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728045AbeIDXlO (ORCPT ); Tue, 4 Sep 2018 19:41:14 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:37508 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727941AbeIDXlN (ORCPT ); Tue, 4 Sep 2018 19:41:13 -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=u87pBBMmkP2i8bDZaPuy3r7Ts+vcnUnHwm6yX348Kss=; b=B2hSMUJfJIJjk9KtgoJ1Q4G/S H7+98PKCNYq0AtnWAUPN3tfBUyDTgjleiqKedePyipJoLTgEAKEDE9nqKJQSAZNTCgGKWNRXKghTF uz9/+KTey/o8SHj7XNGl+OU4KSMQ+OUZwPwW3O1M4K9d75pfVdRQjBMP1F5WXoo6D3guu5Q0SyGMm vEYNregfvLRpaqh72MmEEYPNldN/fpTEjwziLSB52JrxmH7nI1asV6ARPA3O+XHisiLQBnQ6sJzQe BdNQ9GW36rw/HQ27NSF5u9jJdCUQK8C71+MNlhNjyi9PkTu/RZLVaVeARslQ8v3cqZFaoCi4KTXaG nP28ps2Eg==; Received: from [199.255.44.5] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fxGmZ-0007as-Sd; Tue, 04 Sep 2018 19:14:35 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ming Lei , Konrad Rzeszutek Wilk , linux-block@vger.kernel.org, xen-devel@lists.xen.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 08/13] block: add a missing BIOVEC_SEG_BOUNDARY check in bio_add_pc_page Date: Tue, 4 Sep 2018 12:14:26 -0700 Message-Id: <20180904191431.20102-9-hch@lst.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180904191431.20102-1-hch@lst.de> References: <20180904191431.20102-1-hch@lst.de> 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 The actual recaculation of segments in __blk_recalc_rq_segments will do this check, so there is no point in forcing it if we know it won't succeed. Signed-off-by: Christoph Hellwig --- block/bio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/block/bio.c b/block/bio.c index 7f7230140b66..d15a228d1bfc 100644 --- a/block/bio.c +++ b/block/bio.c @@ -729,7 +729,9 @@ int bio_add_pc_page(struct request_queue *q, struct bio *bio, struct page } /* If we may be able to merge these biovecs, force a recount */ - if (bio->bi_vcnt > 1 && biovec_phys_mergeable(bvec-1, bvec)) + if (bio->bi_vcnt > 1 && + biovec_phys_mergeable(bvec - 1, bvec) && + BIOVEC_SEG_BOUNDARY(q, bvec - 1, bvec)) bio_clear_flag(bio, BIO_SEG_VALID); done: