diff options
author | Kent Overstreet <kmo@daterainc.com> | 2013-11-23 20:19:00 -0500 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2013-11-24 01:33:49 -0500 |
commit | 7988613b0e5b2638caf6cd493cc78e9595eba19c (patch) | |
tree | cc9fc4e235278035313ee32940740f61269f8fb3 /drivers/scsi | |
parent | a4ad39b1d10584dfcfcfb0d510faab2c7f034399 (diff) |
block: Convert bio_for_each_segment() to bvec_iter
More prep work for immutable biovecs - with immutable bvecs drivers
won't be able to use the biovec directly, they'll need to use helpers
that take into account bio->bi_iter.bi_bvec_done.
This updates callers for the new usage without changing the
implementation yet.
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: "Ed L. Cashin" <ecashin@coraid.com>
Cc: Nick Piggin <npiggin@kernel.dk>
Cc: Lars Ellenberg <drbd-dev@lists.linbit.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Paul Clements <Paul.Clements@steeleye.com>
Cc: Jim Paris <jim@jtan.com>
Cc: Geoff Levand <geoff@infradead.org>
Cc: Yehuda Sadeh <yehuda@inktank.com>
Cc: Sage Weil <sage@inktank.com>
Cc: Alex Elder <elder@inktank.com>
Cc: ceph-devel@vger.kernel.org
Cc: Joshua Morris <josh.h.morris@us.ibm.com>
Cc: Philip Kelleher <pjk1939@linux.vnet.ibm.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Neil Brown <neilb@suse.de>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: Nagalakshmi Nandigama <Nagalakshmi.Nandigama@lsi.com>
Cc: Sreekanth Reddy <Sreekanth.Reddy@lsi.com>
Cc: support@lsi.com
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Steven Whitehouse <swhiteho@redhat.com>
Cc: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Guo Chao <yan@linux.vnet.ibm.com>
Cc: Asai Thambi S P <asamymuthupa@micron.com>
Cc: Selvan Mani <smani@micron.com>
Cc: Sam Bradshaw <sbradshaw@micron.com>
Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: Quoc-Son Anh <quoc-sonx.anh@intel.com>
Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Jerome Marchand <jmarchan@redhat.com>
Cc: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Jan Kara <jack@suse.cz>
Cc: linux-m68k@lists.linux-m68k.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: drbd-user@lists.linbit.com
Cc: nbd-general@lists.sourceforge.net
Cc: cbe-oss-dev@lists.ozlabs.org
Cc: xen-devel@lists.xensource.com
Cc: virtualization@lists.linux-foundation.org
Cc: linux-raid@vger.kernel.org
Cc: linux-s390@vger.kernel.org
Cc: DL-MPTFusionLinux@lsi.com
Cc: linux-scsi@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Cc: linux-fsdevel@vger.kernel.org
Cc: cluster-devel@redhat.com
Cc: linux-mm@kvack.org
Acked-by: Geoff Levand <geoff@infradead.org>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/mpt2sas/mpt2sas_transport.c | 31 | ||||
-rw-r--r-- | drivers/scsi/mpt3sas/mpt3sas_transport.c | 31 |
2 files changed, 32 insertions, 30 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_transport.c b/drivers/scsi/mpt2sas/mpt2sas_transport.c index 9d26637308be..7143e86af326 100644 --- a/drivers/scsi/mpt2sas/mpt2sas_transport.c +++ b/drivers/scsi/mpt2sas/mpt2sas_transport.c | |||
@@ -1901,7 +1901,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1901 | struct MPT2SAS_ADAPTER *ioc = shost_priv(shost); | 1901 | struct MPT2SAS_ADAPTER *ioc = shost_priv(shost); |
1902 | Mpi2SmpPassthroughRequest_t *mpi_request; | 1902 | Mpi2SmpPassthroughRequest_t *mpi_request; |
1903 | Mpi2SmpPassthroughReply_t *mpi_reply; | 1903 | Mpi2SmpPassthroughReply_t *mpi_reply; |
1904 | int rc, i; | 1904 | int rc; |
1905 | u16 smid; | 1905 | u16 smid; |
1906 | u32 ioc_state; | 1906 | u32 ioc_state; |
1907 | unsigned long timeleft; | 1907 | unsigned long timeleft; |
@@ -1916,7 +1916,8 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1916 | void *pci_addr_out = NULL; | 1916 | void *pci_addr_out = NULL; |
1917 | u16 wait_state_count; | 1917 | u16 wait_state_count; |
1918 | struct request *rsp = req->next_rq; | 1918 | struct request *rsp = req->next_rq; |
1919 | struct bio_vec *bvec = NULL; | 1919 | struct bio_vec bvec; |
1920 | struct bvec_iter iter; | ||
1920 | 1921 | ||
1921 | if (!rsp) { | 1922 | if (!rsp) { |
1922 | printk(MPT2SAS_ERR_FMT "%s: the smp response space is " | 1923 | printk(MPT2SAS_ERR_FMT "%s: the smp response space is " |
@@ -1955,11 +1956,11 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1955 | goto out; | 1956 | goto out; |
1956 | } | 1957 | } |
1957 | 1958 | ||
1958 | bio_for_each_segment(bvec, req->bio, i) { | 1959 | bio_for_each_segment(bvec, req->bio, iter) { |
1959 | memcpy(pci_addr_out + offset, | 1960 | memcpy(pci_addr_out + offset, |
1960 | page_address(bvec->bv_page) + bvec->bv_offset, | 1961 | page_address(bvec.bv_page) + bvec.bv_offset, |
1961 | bvec->bv_len); | 1962 | bvec.bv_len); |
1962 | offset += bvec->bv_len; | 1963 | offset += bvec.bv_len; |
1963 | } | 1964 | } |
1964 | } else { | 1965 | } else { |
1965 | dma_addr_out = pci_map_single(ioc->pdev, bio_data(req->bio), | 1966 | dma_addr_out = pci_map_single(ioc->pdev, bio_data(req->bio), |
@@ -2106,19 +2107,19 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
2106 | u32 offset = 0; | 2107 | u32 offset = 0; |
2107 | u32 bytes_to_copy = | 2108 | u32 bytes_to_copy = |
2108 | le16_to_cpu(mpi_reply->ResponseDataLength); | 2109 | le16_to_cpu(mpi_reply->ResponseDataLength); |
2109 | bio_for_each_segment(bvec, rsp->bio, i) { | 2110 | bio_for_each_segment(bvec, rsp->bio, iter) { |
2110 | if (bytes_to_copy <= bvec->bv_len) { | 2111 | if (bytes_to_copy <= bvec.bv_len) { |
2111 | memcpy(page_address(bvec->bv_page) + | 2112 | memcpy(page_address(bvec.bv_page) + |
2112 | bvec->bv_offset, pci_addr_in + | 2113 | bvec.bv_offset, pci_addr_in + |
2113 | offset, bytes_to_copy); | 2114 | offset, bytes_to_copy); |
2114 | break; | 2115 | break; |
2115 | } else { | 2116 | } else { |
2116 | memcpy(page_address(bvec->bv_page) + | 2117 | memcpy(page_address(bvec.bv_page) + |
2117 | bvec->bv_offset, pci_addr_in + | 2118 | bvec.bv_offset, pci_addr_in + |
2118 | offset, bvec->bv_len); | 2119 | offset, bvec.bv_len); |
2119 | bytes_to_copy -= bvec->bv_len; | 2120 | bytes_to_copy -= bvec.bv_len; |
2120 | } | 2121 | } |
2121 | offset += bvec->bv_len; | 2122 | offset += bvec.bv_len; |
2122 | } | 2123 | } |
2123 | } | 2124 | } |
2124 | } else { | 2125 | } else { |
diff --git a/drivers/scsi/mpt3sas/mpt3sas_transport.c b/drivers/scsi/mpt3sas/mpt3sas_transport.c index e771a88c6a74..196a67f2e95f 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_transport.c +++ b/drivers/scsi/mpt3sas/mpt3sas_transport.c | |||
@@ -1884,7 +1884,7 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1884 | struct MPT3SAS_ADAPTER *ioc = shost_priv(shost); | 1884 | struct MPT3SAS_ADAPTER *ioc = shost_priv(shost); |
1885 | Mpi2SmpPassthroughRequest_t *mpi_request; | 1885 | Mpi2SmpPassthroughRequest_t *mpi_request; |
1886 | Mpi2SmpPassthroughReply_t *mpi_reply; | 1886 | Mpi2SmpPassthroughReply_t *mpi_reply; |
1887 | int rc, i; | 1887 | int rc; |
1888 | u16 smid; | 1888 | u16 smid; |
1889 | u32 ioc_state; | 1889 | u32 ioc_state; |
1890 | unsigned long timeleft; | 1890 | unsigned long timeleft; |
@@ -1898,7 +1898,8 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1898 | void *pci_addr_out = NULL; | 1898 | void *pci_addr_out = NULL; |
1899 | u16 wait_state_count; | 1899 | u16 wait_state_count; |
1900 | struct request *rsp = req->next_rq; | 1900 | struct request *rsp = req->next_rq; |
1901 | struct bio_vec *bvec = NULL; | 1901 | struct bio_vec bvec; |
1902 | struct bvec_iter iter; | ||
1902 | 1903 | ||
1903 | if (!rsp) { | 1904 | if (!rsp) { |
1904 | pr_err(MPT3SAS_FMT "%s: the smp response space is missing\n", | 1905 | pr_err(MPT3SAS_FMT "%s: the smp response space is missing\n", |
@@ -1938,11 +1939,11 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
1938 | goto out; | 1939 | goto out; |
1939 | } | 1940 | } |
1940 | 1941 | ||
1941 | bio_for_each_segment(bvec, req->bio, i) { | 1942 | bio_for_each_segment(bvec, req->bio, iter) { |
1942 | memcpy(pci_addr_out + offset, | 1943 | memcpy(pci_addr_out + offset, |
1943 | page_address(bvec->bv_page) + bvec->bv_offset, | 1944 | page_address(bvec.bv_page) + bvec.bv_offset, |
1944 | bvec->bv_len); | 1945 | bvec.bv_len); |
1945 | offset += bvec->bv_len; | 1946 | offset += bvec.bv_len; |
1946 | } | 1947 | } |
1947 | } else { | 1948 | } else { |
1948 | dma_addr_out = pci_map_single(ioc->pdev, bio_data(req->bio), | 1949 | dma_addr_out = pci_map_single(ioc->pdev, bio_data(req->bio), |
@@ -2067,19 +2068,19 @@ _transport_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy, | |||
2067 | u32 offset = 0; | 2068 | u32 offset = 0; |
2068 | u32 bytes_to_copy = | 2069 | u32 bytes_to_copy = |
2069 | le16_to_cpu(mpi_reply->ResponseDataLength); | 2070 | le16_to_cpu(mpi_reply->ResponseDataLength); |
2070 | bio_for_each_segment(bvec, rsp->bio, i) { | 2071 | bio_for_each_segment(bvec, rsp->bio, iter) { |
2071 | if (bytes_to_copy <= bvec->bv_len) { | 2072 | if (bytes_to_copy <= bvec.bv_len) { |
2072 | memcpy(page_address(bvec->bv_page) + | 2073 | memcpy(page_address(bvec.bv_page) + |
2073 | bvec->bv_offset, pci_addr_in + | 2074 | bvec.bv_offset, pci_addr_in + |
2074 | offset, bytes_to_copy); | 2075 | offset, bytes_to_copy); |
2075 | break; | 2076 | break; |
2076 | } else { | 2077 | } else { |
2077 | memcpy(page_address(bvec->bv_page) + | 2078 | memcpy(page_address(bvec.bv_page) + |
2078 | bvec->bv_offset, pci_addr_in + | 2079 | bvec.bv_offset, pci_addr_in + |
2079 | offset, bvec->bv_len); | 2080 | offset, bvec.bv_len); |
2080 | bytes_to_copy -= bvec->bv_len; | 2081 | bytes_to_copy -= bvec.bv_len; |
2081 | } | 2082 | } |
2082 | offset += bvec->bv_len; | 2083 | offset += bvec.bv_len; |
2083 | } | 2084 | } |
2084 | } | 2085 | } |
2085 | } else { | 2086 | } else { |