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 /include/linux/bio.h | |
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 'include/linux/bio.h')
-rw-r--r-- | include/linux/bio.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 9f182fcbe714..c16adb5f69f8 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -63,10 +63,13 @@ | |||
63 | */ | 63 | */ |
64 | #define bio_iovec_idx(bio, idx) (&((bio)->bi_io_vec[(idx)])) | 64 | #define bio_iovec_idx(bio, idx) (&((bio)->bi_io_vec[(idx)])) |
65 | #define __bio_iovec(bio) bio_iovec_idx((bio), (bio)->bi_iter.bi_idx) | 65 | #define __bio_iovec(bio) bio_iovec_idx((bio), (bio)->bi_iter.bi_idx) |
66 | #define bio_iovec(bio) (*__bio_iovec(bio)) | 66 | |
67 | #define bio_iter_iovec(bio, iter) ((bio)->bi_io_vec[(iter).bi_idx]) | ||
67 | 68 | ||
68 | #define bio_page(bio) (bio_iovec((bio)).bv_page) | 69 | #define bio_page(bio) (bio_iovec((bio)).bv_page) |
69 | #define bio_offset(bio) (bio_iovec((bio)).bv_offset) | 70 | #define bio_offset(bio) (bio_iovec((bio)).bv_offset) |
71 | #define bio_iovec(bio) (*__bio_iovec(bio)) | ||
72 | |||
70 | #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_iter.bi_idx) | 73 | #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_iter.bi_idx) |
71 | #define bio_sectors(bio) ((bio)->bi_iter.bi_size >> 9) | 74 | #define bio_sectors(bio) ((bio)->bi_iter.bi_size >> 9) |
72 | #define bio_end_sector(bio) ((bio)->bi_iter.bi_sector + bio_sectors((bio))) | 75 | #define bio_end_sector(bio) ((bio)->bi_iter.bi_sector + bio_sectors((bio))) |
@@ -134,15 +137,6 @@ static inline void *bio_data(struct bio *bio) | |||
134 | #define bio_io_error(bio) bio_endio((bio), -EIO) | 137 | #define bio_io_error(bio) bio_endio((bio), -EIO) |
135 | 138 | ||
136 | /* | 139 | /* |
137 | * drivers should not use the __ version unless they _really_ know what | ||
138 | * they're doing | ||
139 | */ | ||
140 | #define __bio_for_each_segment(bvl, bio, i, start_idx) \ | ||
141 | for (bvl = bio_iovec_idx((bio), (start_idx)), i = (start_idx); \ | ||
142 | i < (bio)->bi_vcnt; \ | ||
143 | bvl++, i++) | ||
144 | |||
145 | /* | ||
146 | * drivers should _never_ use the all version - the bio may have been split | 140 | * drivers should _never_ use the all version - the bio may have been split |
147 | * before it got to the driver and the driver won't own all of it | 141 | * before it got to the driver and the driver won't own all of it |
148 | */ | 142 | */ |
@@ -151,10 +145,16 @@ static inline void *bio_data(struct bio *bio) | |||
151 | bvl = bio_iovec_idx((bio), (i)), i < (bio)->bi_vcnt; \ | 145 | bvl = bio_iovec_idx((bio), (i)), i < (bio)->bi_vcnt; \ |
152 | i++) | 146 | i++) |
153 | 147 | ||
154 | #define bio_for_each_segment(bvl, bio, i) \ | 148 | #define __bio_for_each_segment(bvl, bio, iter, start) \ |
155 | for (i = (bio)->bi_iter.bi_idx; \ | 149 | for (iter = (start); \ |
156 | bvl = bio_iovec_idx((bio), (i)), i < (bio)->bi_vcnt; \ | 150 | bvl = bio_iter_iovec((bio), (iter)), \ |
157 | i++) | 151 | (iter).bi_idx < (bio)->bi_vcnt; \ |
152 | (iter).bi_idx++) | ||
153 | |||
154 | #define bio_for_each_segment(bvl, bio, iter) \ | ||
155 | __bio_for_each_segment(bvl, bio, iter, (bio)->bi_iter) | ||
156 | |||
157 | #define bio_iter_last(bio, iter) ((iter).bi_idx == (bio)->bi_vcnt - 1) | ||
158 | 158 | ||
159 | /* | 159 | /* |
160 | * get a reference to a bio, so it won't disappear. the intended use is | 160 | * get a reference to a bio, so it won't disappear. the intended use is |