From patchwork Sat Oct 29 08:08:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9403245 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 C2D7E60588 for ; Sat, 29 Oct 2016 08:16:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF17B29B67 for ; Sat, 29 Oct 2016 08:16:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A393D29BA7; Sat, 29 Oct 2016 08:16:51 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 4EFD129B67 for ; Sat, 29 Oct 2016 08:16:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934076AbcJ2IQr (ORCPT ); Sat, 29 Oct 2016 04:16:47 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33585 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933044AbcJ2IQ2 (ORCPT ); Sat, 29 Oct 2016 04:16:28 -0400 Received: by mail-pf0-f193.google.com with SMTP id a136so5301pfa.0; Sat, 29 Oct 2016 01:16:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=r2qk4AgGjF//uID7r+ko3jVoIizr705Ns6nlK9fP/hI=; b=T86Pvo1EcLI+jSlyAcrN+8+xdTtVCTKkxdpuaN6y+ee4mlComHbfqsuVQR1YvD7R8U jwh6su+uNIoGI2bTk9fAV2P9ZTtPSubCk0cExDVQFCvyDRCLYVg1XwdMrX7fPuIK7nc2 7RHAPiDUIa9m3FZ9KRRSoEkHntEl54va3dnlRCZdvXaoPs/MTD74iBanJfHqHNPIflSe RbWe/CzKlTIADxTcPWlaOewHzvk3ibjMnAzjG8hIc3fmFY/xh3uDAVycWC8zz8vQU3sp Ww+eZ1bXIdPHyI7STQ2Oh1vosVrLUfeTM3cypQ6auX43P/8h5hjKQPownIc9zlsUEU7U 8xGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=r2qk4AgGjF//uID7r+ko3jVoIizr705Ns6nlK9fP/hI=; b=PoKqSaKkRGjiJleQZVwjBE6mmc6sc6i4N2LDBi6ZAiHfU/iqzmxfhqRW6+doLxGvxs qvMw8LnnwjuaLhPOQQrqApOkBtlfdIDPBRY/YVEN+UykZtAUCaQLBYPV9WViRRcwTREE qEvrWLnTuZWcB2htFlp4bcgGHdR6S1omq9Vxe47vPWMFkKhXDqaJpM+EybciZtl/rTew tANBQTnyTBfHxYf4U8tZrMLdp4xx2ZBoI1uNQCRQitKXuA6Pk4CrMOtZaXulAHDtegSo VaVK/u/cCFYd2I9DNLZIPwT3f/Bq5P9LmSBRfsSC64hyQQEXuMNdMxj0I2KlJJuOyKbg PHgQ== X-Gm-Message-State: ABUngveLqXh4rU00+9KtmdJd3SNcPynj4MZqlymPObeYRUf9QsbOgfFeXb0qJlvzzhVA8Q== X-Received: by 10.98.198.132 with SMTP id x4mr31919175pfk.23.1477728987951; Sat, 29 Oct 2016 01:16:27 -0700 (PDT) Received: from localhost ([45.34.23.101]) by smtp.gmail.com with ESMTPSA id fm6sm23553738pab.37.2016.10.29.01.16.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Oct 2016 01:16:27 -0700 (PDT) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , "Kirill A . Shutemov" , Ming Lei , Jens Axboe Subject: [PATCH 60/60] block: enable multipage bvecs Date: Sat, 29 Oct 2016 16:08:59 +0800 Message-Id: <1477728600-12938-61-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> References: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch pulls the trigger for multipage bvecs. Any request queue which doesn't set QUEUE_FLAG_NO_MP should support to handle multipage bvecs. Signed-off-by: Ming Lei --- block/bio.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/block/bio.c b/block/bio.c index c9cf0a81cca3..b73777dc59c3 100644 --- a/block/bio.c +++ b/block/bio.c @@ -838,6 +838,11 @@ int bio_add_page(struct bio *bio, struct page *page, * a consecutive offset. Optimize this special case. */ if (bio->bi_vcnt > 0) { + struct request_queue *q = NULL; + + if (bio->bi_bdev) + q = bdev_get_queue(bio->bi_bdev); + bv = &bio->bi_io_vec[bio->bi_vcnt - 1]; if (page == bv->bv_page && @@ -845,6 +850,14 @@ int bio_add_page(struct bio *bio, struct page *page, bv->bv_len += len; goto done; } + + /* disable multipage bvec too if cluster isn't enabled */ + if (q && !blk_queue_no_mp(q) && blk_queue_cluster(q) && + (bvec_to_phys(bv) + bv->bv_len == + page_to_phys(page) + offset)) { + bv->bv_len += len; + goto done; + } } if (bio->bi_vcnt >= bio->bi_max_vecs)