From patchwork Mon Sep 24 22:34:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 1500881 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by patchwork1.kernel.org (Postfix) with ESMTP id 140AC3FE80 for ; Mon, 24 Sep 2012 22:39:32 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q8OMb6DU025998; Mon, 24 Sep 2012 18:37:06 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q8OMZmpD009200 for ; Mon, 24 Sep 2012 18:35:48 -0400 Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.20]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8OMZhWG019398 for ; Mon, 24 Sep 2012 18:35:43 -0400 Received: from mail-pb0-f46.google.com (mail-pb0-f46.google.com [209.85.160.46]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8OMZVX2029734 for ; Mon, 24 Sep 2012 18:35:42 -0400 Received: by mail-pb0-f46.google.com with SMTP id rr4so7786704pbb.33 for ; Mon, 24 Sep 2012 15:35:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=d2nMlnN90zX1H2dgf5nFPdwNXPeafkBnSRV/NXUPhl0=; b=cjRc3yRLEoXuG9N7Ufz6/lQMH5ilZCdgHTWo2aFQpFrCszV6JxZY4tdTBQDqqOVCJi lcPca3xSLbm+39/m7wcV6YT/1paZS4JOnHHIF9OnIDhX8EzCDt7UCWlO6URh8A4F/cAU PV0RyJJM/5hGh9CGPz5Ye+vCbxoRJfs9Mfjy92RZV8+IXT2BaHvQf+pXid5pBZ2um2BY UpkIeXginN9rLTgI6eXJ8+YA6YxImlMVmKko6DE+NcvIIYkxTJYbULMYeZkjJY4u4TYC yqrjWSvyytk0gIO7n48ngiPWMJoHONwVGa0y5wm07HzyizLwXVDD6dx9rHreyjhFwYq7 c6eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=d2nMlnN90zX1H2dgf5nFPdwNXPeafkBnSRV/NXUPhl0=; b=MmXUuYQaeTGpj9XG+a8mlw2nkKagcsZnIsUGbrXSI8J2hOFYw26/yC0qTEFd+6Kxj6 U5BnD9qVzU5Y77zO7hw29NF0vDK+fZFG/iIxp0Cv/mnO9haMpApew/I7yTOLdD7MgY/e wJ0wErlEupccyepE/sejOVU7CGmwvj1wnMsAehd3KoqbsNYxuD2jah2Lsj5clxx5ginU kV/WahJggGEduOYBVYC5yCeP+yUdMQJZKovE06UiT11N+/jNFsyARl2RgM3KjiCzgQLE 9FbyXYSzlhlecj0qLwg2JJ83eVGb+jI44V+cz/L14ymybewsq5NRyZ7vOFbN9k7Ua8Wm 46Bw== Received: by 10.68.235.106 with SMTP id ul10mr41095233pbc.83.1348526142337; Mon, 24 Sep 2012 15:35:42 -0700 (PDT) Received: by 10.68.235.106 with SMTP id ul10mr41095206pbc.83.1348526142168; Mon, 24 Sep 2012 15:35:42 -0700 (PDT) Received: from formenos.mtv.corp.google.com (formenos.mtv.corp.google.com [172.18.110.66]) by mx.google.com with ESMTPS id nu8sm133316pbc.45.2012.09.24.15.35.41 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 24 Sep 2012 15:35:41 -0700 (PDT) From: Kent Overstreet To: linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, dm-devel@redhat.com Date: Mon, 24 Sep 2012 15:34:50 -0700 Message-Id: <1348526106-17074-11-git-send-email-koverstreet@google.com> In-Reply-To: <1348526106-17074-1-git-send-email-koverstreet@google.com> References: <1348526106-17074-1-git-send-email-koverstreet@google.com> X-Gm-Message-State: ALoCoQknNVZ7G6gJ4rkmPm5s01pU+X1oS97ESehJlIYv/oz87Rg6pxbUjj73hXl6rp6u7I0tzjEQy16PW6nJmfb1ELzpx2wpVggWKPya8ZIwAwgKUrvl6o8nAXIv2vxjNlu2vErfzYA6fTKisrWbX7rtTSNj9BiCS0LxaMJ29F3bEFTf6mB64GKf4lM9jUZ7tOrgWVjW4ep4 X-RedHat-Spam-Score: -3.512 (BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.20 X-loop: dm-devel@redhat.com Cc: axboe@kernel.dk, linux-scsi@vger.kernel.org, Kent Overstreet , "James E.J. Bottomley" , tj@kernel.org, Eric Moore , vgoyal@redhat.com Subject: [dm-devel] [PATCH v3 10/26] block: Remove some unnecessary bi_vcnt usage X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com More prep work for immutable bvecs/effecient bio splitting - usage of bi_vcnt has to be auditing, so getting rid of all the unnecessary usage makes that easier. Plus, bio_segments() is really what this code wanted, as it respects the current value of bi_idx. Signed-off-by: Kent Overstreet CC: Jens Axboe CC: Eric Moore CC: "James E.J. Bottomley" CC: linux-scsi@vger.kernel.org --- drivers/message/fusion/mptsas.c | 6 +++--- drivers/scsi/libsas/sas_expander.c | 6 +++--- drivers/scsi/mpt2sas/mpt2sas_transport.c | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c index 551262e..5406a9f 100644 --- a/drivers/message/fusion/mptsas.c +++ b/drivers/message/fusion/mptsas.c @@ -2235,10 +2235,10 @@ static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, } /* do we need to support multiple segments? */ - if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) { + if (bio_segments(req->bio) > 1 || bio_segments(rsp->bio) > 1) { printk(MYIOC_s_ERR_FMT "%s: multiple segments req %u %u, rsp %u %u\n", - ioc->name, __func__, req->bio->bi_vcnt, blk_rq_bytes(req), - rsp->bio->bi_vcnt, blk_rq_bytes(rsp)); + ioc->name, __func__, bio_segments(req->bio), blk_rq_bytes(req), + bio_segments(rsp->bio), blk_rq_bytes(rsp)); return -EINVAL; } diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index efc6e72..ee331a7 100644 --- a/drivers/scsi/libsas/sas_expander.c +++ b/drivers/scsi/libsas/sas_expander.c @@ -2151,10 +2151,10 @@ int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, } /* do we need to support multiple segments? */ - if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) { + if (bio_segments(req->bio) > 1 || bio_segments(rsp->bio) > 1) { printk("%s: multiple segments req %u %u, rsp %u %u\n", - __func__, req->bio->bi_vcnt, blk_rq_bytes(req), - rsp->bio->bi_vcnt, blk_rq_bytes(rsp)); + __func__, bio_segments(req->bio), blk_rq_bytes(req), + bio_segments(rsp->bio), blk_rq_bytes(rsp)); return -EINVAL; } diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c index c6cf20f..403a57b 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_transport.c +++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c @@ -1939,7 +1939,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, ioc->transport_cmds.status = MPT2_CMD_PENDING; /* Check if the request is split across multiple segments */ - if (req->bio->bi_vcnt > 1) { + if (bio_segments(req->bio) > 1) { u32 offset = 0; /* Allocate memory and copy the request */ @@ -1971,7 +1971,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, /* Check if the response needs to be populated across * multiple segments */ - if (rsp->bio->bi_vcnt > 1) { + if (bio_segments(rsp->bio) > 1) { pci_addr_in = pci_alloc_consistent(ioc->pdev, blk_rq_bytes(rsp), &pci_dma_in); if (!pci_addr_in) { @@ -2038,7 +2038,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, sgl_flags = (MPI2_SGE_FLAGS_SIMPLE_ELEMENT | MPI2_SGE_FLAGS_END_OF_BUFFER | MPI2_SGE_FLAGS_HOST_TO_IOC); sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT; - if (req->bio->bi_vcnt > 1) { + if (bio_segments(req->bio) > 1) { ioc->base_add_sg_single(psge, sgl_flags | (blk_rq_bytes(req) - 4), pci_dma_out); } else { @@ -2054,7 +2054,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, MPI2_SGE_FLAGS_LAST_ELEMENT | MPI2_SGE_FLAGS_END_OF_BUFFER | MPI2_SGE_FLAGS_END_OF_LIST); sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT; - if (rsp->bio->bi_vcnt > 1) { + if (bio_segments(rsp->bio) > 1) { ioc->base_add_sg_single(psge, sgl_flags | (blk_rq_bytes(rsp) + 4), pci_dma_in); } else { @@ -2099,7 +2099,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, le16_to_cpu(mpi_reply->ResponseDataLength); /* check if the resp needs to be copied from the allocated * pci mem */ - if (rsp->bio->bi_vcnt > 1) { + if (bio_segments(rsp->bio) > 1) { u32 offset = 0; u32 bytes_to_copy = le16_to_cpu(mpi_reply->ResponseDataLength);