diff options
author | Kent Overstreet <koverstreet@google.com> | 2012-09-05 20:31:42 -0400 |
---|---|---|
committer | Kent Overstreet <koverstreet@google.com> | 2013-03-23 17:15:31 -0400 |
commit | 2f477877f8c4be18f054aeb7c4be8cc748cfe932 (patch) | |
tree | ade275970fd1282cafc6d47753564c821020be8a | |
parent | 4f2ac93c175c4922bdddbfec6cad94b32cea0070 (diff) |
block: Remove some unnecessary bi_vcnt usage
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 <koverstreet@google.com>
CC: Jens Axboe <axboe@kernel.dk>
CC: Eric Moore <Eric.Moore@lsi.com>
CC: "James E.J. Bottomley" <JBottomley@parallels.com>
CC: linux-scsi@vger.kernel.org
-rw-r--r-- | drivers/message/fusion/mptsas.c | 6 | ||||
-rw-r--r-- | drivers/scsi/libsas/sas_expander.c | 6 | ||||
-rw-r--r-- | 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 fa43c391c8ed..2bb01546df0b 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, | |||
2235 | } | 2235 | } |
2236 | 2236 | ||
2237 | /* do we need to support multiple segments? */ | 2237 | /* do we need to support multiple segments? */ |
2238 | if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) { | 2238 | if (bio_segments(req->bio) > 1 || bio_segments(rsp->bio) > 1) { |
2239 | printk(MYIOC_s_ERR_FMT "%s: multiple segments req %u %u, rsp %u %u\n", | 2239 | printk(MYIOC_s_ERR_FMT "%s: multiple segments req %u %u, rsp %u %u\n", |
2240 | ioc->name, __func__, req->bio->bi_vcnt, blk_rq_bytes(req), | 2240 | ioc->name, __func__, bio_segments(req->bio), blk_rq_bytes(req), |
2241 | rsp->bio->bi_vcnt, blk_rq_bytes(rsp)); | 2241 | bio_segments(rsp->bio), blk_rq_bytes(rsp)); |
2242 | return -EINVAL; | 2242 | return -EINVAL; |
2243 | } | 2243 | } |
2244 | 2244 | ||
diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c index aec2e0da5016..7af776737b40 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, | |||
2151 | } | 2151 | } |
2152 | 2152 | ||
2153 | /* do we need to support multiple segments? */ | 2153 | /* do we need to support multiple segments? */ |
2154 | if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) { | 2154 | if (bio_segments(req->bio) > 1 || bio_segments(rsp->bio) > 1) { |
2155 | printk("%s: multiple segments req %u %u, rsp %u %u\n", | 2155 | printk("%s: multiple segments req %u %u, rsp %u %u\n", |
2156 | __func__, req->bio->bi_vcnt, blk_rq_bytes(req), | 2156 | __func__, bio_segments(req->bio), blk_rq_bytes(req), |
2157 | rsp->bio->bi_vcnt, blk_rq_bytes(rsp)); | 2157 | bio_segments(rsp->bio), blk_rq_bytes(rsp)); |
2158 | return -EINVAL; | 2158 | return -EINVAL; |
2159 | } | 2159 | } |
2160 | 2160 | ||
diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c index 8c2ffbe6af0f..193e7ae90c3b 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, | |||
1939 | ioc->transport_cmds.status = MPT2_CMD_PENDING; | 1939 | ioc->transport_cmds.status = MPT2_CMD_PENDING; |
1940 | 1940 | ||
1941 | /* Check if the request is split across multiple segments */ | 1941 | /* Check if the request is split across multiple segments */ |
1942 | if (req->bio->bi_vcnt > 1) { | 1942 | if (bio_segments(req->bio) > 1) { |
1943 | u32 offset = 0; | 1943 | u32 offset = 0; |
1944 | 1944 | ||
1945 | /* Allocate memory and copy the request */ | 1945 | /* Allocate memory and copy the request */ |
@@ -1971,7 +1971,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1971 | 1971 | ||
1972 | /* Check if the response needs to be populated across | 1972 | /* Check if the response needs to be populated across |
1973 | * multiple segments */ | 1973 | * multiple segments */ |
1974 | if (rsp->bio->bi_vcnt > 1) { | 1974 | if (bio_segments(rsp->bio) > 1) { |
1975 | pci_addr_in = pci_alloc_consistent(ioc->pdev, blk_rq_bytes(rsp), | 1975 | pci_addr_in = pci_alloc_consistent(ioc->pdev, blk_rq_bytes(rsp), |
1976 | &pci_dma_in); | 1976 | &pci_dma_in); |
1977 | if (!pci_addr_in) { | 1977 | if (!pci_addr_in) { |
@@ -2038,7 +2038,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
2038 | sgl_flags = (MPI2_SGE_FLAGS_SIMPLE_ELEMENT | | 2038 | sgl_flags = (MPI2_SGE_FLAGS_SIMPLE_ELEMENT | |
2039 | MPI2_SGE_FLAGS_END_OF_BUFFER | MPI2_SGE_FLAGS_HOST_TO_IOC); | 2039 | MPI2_SGE_FLAGS_END_OF_BUFFER | MPI2_SGE_FLAGS_HOST_TO_IOC); |
2040 | sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT; | 2040 | sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT; |
2041 | if (req->bio->bi_vcnt > 1) { | 2041 | if (bio_segments(req->bio) > 1) { |
2042 | ioc->base_add_sg_single(psge, sgl_flags | | 2042 | ioc->base_add_sg_single(psge, sgl_flags | |
2043 | (blk_rq_bytes(req) - 4), pci_dma_out); | 2043 | (blk_rq_bytes(req) - 4), pci_dma_out); |
2044 | } else { | 2044 | } else { |
@@ -2054,7 +2054,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
2054 | MPI2_SGE_FLAGS_LAST_ELEMENT | MPI2_SGE_FLAGS_END_OF_BUFFER | | 2054 | MPI2_SGE_FLAGS_LAST_ELEMENT | MPI2_SGE_FLAGS_END_OF_BUFFER | |
2055 | MPI2_SGE_FLAGS_END_OF_LIST); | 2055 | MPI2_SGE_FLAGS_END_OF_LIST); |
2056 | sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT; | 2056 | sgl_flags = sgl_flags << MPI2_SGE_FLAGS_SHIFT; |
2057 | if (rsp->bio->bi_vcnt > 1) { | 2057 | if (bio_segments(rsp->bio) > 1) { |
2058 | ioc->base_add_sg_single(psge, sgl_flags | | 2058 | ioc->base_add_sg_single(psge, sgl_flags | |
2059 | (blk_rq_bytes(rsp) + 4), pci_dma_in); | 2059 | (blk_rq_bytes(rsp) + 4), pci_dma_in); |
2060 | } else { | 2060 | } else { |
@@ -2099,7 +2099,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
2099 | le16_to_cpu(mpi_reply->ResponseDataLength); | 2099 | le16_to_cpu(mpi_reply->ResponseDataLength); |
2100 | /* check if the resp needs to be copied from the allocated | 2100 | /* check if the resp needs to be copied from the allocated |
2101 | * pci mem */ | 2101 | * pci mem */ |
2102 | if (rsp->bio->bi_vcnt > 1) { | 2102 | if (bio_segments(rsp->bio) > 1) { |
2103 | u32 offset = 0; | 2103 | u32 offset = 0; |
2104 | u32 bytes_to_copy = | 2104 | u32 bytes_to_copy = |
2105 | le16_to_cpu(mpi_reply->ResponseDataLength); | 2105 | le16_to_cpu(mpi_reply->ResponseDataLength); |