From patchwork Mon Sep 24 07:43:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10611967 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 E2136913 for ; Mon, 24 Sep 2018 07:44:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4F162870F for ; Mon, 24 Sep 2018 07:44:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9377287AA; Mon, 24 Sep 2018 07:44:28 +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 834262870F for ; Mon, 24 Sep 2018 07:44:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726400AbeIXNpO (ORCPT ); Mon, 24 Sep 2018 09:45:14 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:45480 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727726AbeIXNpO (ORCPT ); Mon, 24 Sep 2018 09:45:14 -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=sYgXMokBDJfLct5A7ewEr3YWRD0IBe0WFb3r3UCRBtU=; b=JJjbiK3/dIs5qqdwkY7CJkUF/k zChg3PJBbmIQuHF8sBLh5906/4pI/Eh9Ln8OLteqXa2IWVJQhyO9Nz70pTmfxVv1S0JdNfYH/kiiX cQo0qrJVEBSvnlmT2dOAVbKHQo98lE4t/vRYbYBC2p7fgKFjydnz/dSbb+u3506cOIVd/R4QJaK6G y2hJSYEpYs92ka1BSUrFd99Lns/9bavrn807Bk93nqhHdPRmxmsc8sAHGXyDKshn+npDE9N+C9gsw grfi6BI3sa3vkIzNqFn0TBei+cSnowChYTMgr14PDL7AHT8mD3meQxCSE1XsRD5+ucIe+jezpFwfw Dc72yqLQ==; Received: from [128.76.37.163] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1g4LXS-0001IM-7r; Mon, 24 Sep 2018 07:44:14 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Ming Lei , linux-block@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 06/10] block: add a missing BIOVEC_SEG_BOUNDARY check in bio_add_pc_page Date: Mon, 24 Sep 2018 09:43:51 +0200 Message-Id: <20180924074355.2802-7-hch@lst.de> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924074355.2802-1-hch@lst.de> References: <20180924074355.2802-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 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 81d90b839e05..c254e5aa331f 100644 --- a/block/bio.c +++ b/block/bio.c @@ -731,7 +731,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: