From patchwork Mon Nov 4 23:36:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 3138181 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0B3C0BEEB3 for ; Mon, 4 Nov 2013 23:37:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 31528201C8 for ; Mon, 4 Nov 2013 23:37:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5FFE9200EB for ; Mon, 4 Nov 2013 23:37:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754039Ab3KDXg6 (ORCPT ); Mon, 4 Nov 2013 18:36:58 -0500 Received: from mail-pd0-f174.google.com ([209.85.192.174]:56399 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753951Ab3KDXgt (ORCPT ); Mon, 4 Nov 2013 18:36:49 -0500 Received: by mail-pd0-f174.google.com with SMTP id z10so7403083pdj.33 for ; Mon, 04 Nov 2013 15:36:48 -0800 (PST) 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=dmgHMC4XcLTrxDItKRbHpIFQSjL4Qqogzo2epaBbuyk=; b=ZdYKJyi6aE7c1g4NKQk4+iuJP8DZ51r5Jd7uDGtTSaKzI5MWdhVBWOUo2pSIPwUlbs W59Vek+ANm1nvlzFpwMppg2ZZkLaC0eSz7+LqudiThcXuktnpwSCv4KFqFaNnFeZVOAV dk2Ao4R2qBA9IhDlxqncGGK83Ovz2IoyiE0pVEcu+UtYTvpm0TcJc789xjsYtVulOT7q M27V7Q6Q8bUmzP4ViRVDWjqmLbsQB7wAfQr0mK99nw1A03qu4Aox69BpPPh9b4fAJMkE hRI9po2WkbvOjYqTn+JoC+sfU8PsuYNjV1btZVsaHFSBt5kQ7hHL0a1lZJnskGfmwB3c XjKQ== X-Gm-Message-State: ALoCoQnX9YLaouWIlYIB6MJiJlchHSTNbOvPoYhGnXLV8OocAIS/pKj4mOSDqmwFCaSvj4+YQjoP X-Received: by 10.66.142.170 with SMTP id rx10mr20310466pab.117.1383608204721; Mon, 04 Nov 2013 15:36:44 -0800 (PST) Received: from kmo.daterainc.com ([157.22.22.146]) by mx.google.com with ESMTPSA id hz10sm30532839pbc.36.2013.11.04.15.36.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Nov 2013 15:36:44 -0800 (PST) From: Kent Overstreet To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org Cc: axboe@kernel.dk, hch@infradead.org, Kent Overstreet Subject: [PATCH 6/9] mtip32xx: handle arbitrary size bios Date: Mon, 4 Nov 2013 15:36:24 -0800 Message-Id: <1383608187-27368-7-git-send-email-kmo@daterainc.com> X-Mailer: git-send-email 1.8.4.rc3 In-Reply-To: <1383608187-27368-1-git-send-email-kmo@daterainc.com> References: <1383608187-27368-1-git-send-email-kmo@daterainc.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We get a measurable performance increase by handling this in the driver when we're already looping over the biovec, instead of handling it separately in generic_make_request() (or bio_add_page() originally) Signed-off-by: Kent Overstreet --- drivers/block/mtip32xx/mtip32xx.c | 46 +++++++++++++-------------------------- 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index d4c669b..c5a7a96 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -2648,24 +2648,6 @@ static void mtip_hw_submit_io(struct driver_data *dd, sector_t sector, } /* - * Release a command slot. - * - * @dd Pointer to the driver data structure. - * @tag Slot tag - * - * return value - * None - */ -static void mtip_hw_release_scatterlist(struct driver_data *dd, int tag, - int unaligned) -{ - struct semaphore *sem = unaligned ? &dd->port->cmd_slot_unal : - &dd->port->cmd_slot; - release_slot(dd->port, tag); - up(sem); -} - -/* * Obtain a command slot and return its associated scatter list. * * @dd Pointer to the driver data structure. @@ -4016,21 +3998,22 @@ static void mtip_make_request(struct request_queue *queue, struct bio *bio) sg = mtip_hw_get_scatterlist(dd, &tag, unaligned); if (likely(sg != NULL)) { - if (unlikely((bio)->bi_vcnt > MTIP_MAX_SG)) { - dev_warn(&dd->pdev->dev, - "Maximum number of SGL entries exceeded\n"); - bio_io_error(bio); - mtip_hw_release_scatterlist(dd, tag, unaligned); - return; - } - /* Create the scatter list for this bio. */ bio_for_each_segment(bvec, bio, iter) { - sg_set_page(&sg[nents], - bvec.bv_page, - bvec.bv_len, - bvec.bv_offset); - nents++; + if (unlikely(nents == MTIP_MAX_SG)) { + struct bio *split = bio_clone(bio, GFP_NOIO); + + split->bi_iter = iter; + bio->bi_iter.bi_size -= iter.bi_size; + bio_chain(split, bio); + generic_make_request(split); + break; + } + + sg_set_page(&sg[nents++], + bvec.bv_page, + bvec.bv_len, + bvec.bv_offset); } /* Issue the read/write. */ @@ -4145,6 +4128,7 @@ skip_create_disk: blk_queue_max_hw_sectors(dd->queue, 0xffff); blk_queue_max_segment_size(dd->queue, 0x400000); blk_queue_io_min(dd->queue, 4096); + set_bit(QUEUE_FLAG_LARGEBIOS, &dd->queue->queue_flags); /* * write back cache is not supported in the device. FUA depends on