diff options
author | Kent Overstreet <kmo@daterainc.com> | 2013-10-11 18:44:27 -0400 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2013-11-24 01:33:47 -0500 |
commit | 4f024f3797c43cb4b73cd2c50cec728842d0e49e (patch) | |
tree | 3aedcab02d2ad723a189d01934d1e94fec7a54e1 /drivers/block/rbd.c | |
parent | ed9c47bebeeea4a468b07cfd745c690190f8014c (diff) |
block: Abstract out bvec iterator
Immutable biovecs are going to require an explicit iterator. To
implement immutable bvecs, a later patch is going to add a bi_bvec_done
member to this struct; for now, this patch effectively just renames
things.
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: Matthew Wilcox <willy@linux.intel.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: Rusty Russell <rusty@rustcorp.com.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Neil Brown <neilb@suse.de>
Cc: Alasdair Kergon <agk@redhat.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: dm-devel@redhat.com
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: Boaz Harrosh <bharrosh@panasas.com>
Cc: Benny Halevy <bhalevy@tonian.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Chris Mason <chris.mason@fusionio.com>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Cc: Steven Whitehouse <swhiteho@redhat.com>
Cc: Dave Kleikamp <shaggy@kernel.org>
Cc: Joern Engel <joern@logfs.org>
Cc: Prasad Joshi <prasadjoshi.linux@gmail.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Ben Myers <bpm@sgi.com>
Cc: xfs@oss.sgi.com
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Guo Chao <yan@linux.vnet.ibm.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Asai Thambi S P <asamymuthupa@micron.com>
Cc: Selvan Mani <smani@micron.com>
Cc: Sam Bradshaw <sbradshaw@micron.com>
Cc: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <Ian.Campbell@citrix.com>
Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Jiang Liu <jiang.liu@huawei.com>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Jerome Marchand <jmarchand@redhat.com>
Cc: Joe Perches <joe@perches.com>
Cc: Peng Tao <tao.peng@emc.com>
Cc: Andy Adamson <andros@netapp.com>
Cc: fanchaoting <fanchaoting@cn.fujitsu.com>
Cc: Jie Liu <jeff.liu@oracle.com>
Cc: Sunil Mushran <sunil.mushran@gmail.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Namjae Jeon <namjae.jeon@samsung.com>
Cc: Pankaj Kumar <pankaj.km@samsung.com>
Cc: Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: Mel Gorman <mgorman@suse.de>6
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r-- | drivers/block/rbd.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index cb1db2979d3d..a8f4fe2d4d1b 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -1183,14 +1183,14 @@ static struct bio *bio_clone_range(struct bio *bio_src, | |||
1183 | 1183 | ||
1184 | /* Handle the easy case for the caller */ | 1184 | /* Handle the easy case for the caller */ |
1185 | 1185 | ||
1186 | if (!offset && len == bio_src->bi_size) | 1186 | if (!offset && len == bio_src->bi_iter.bi_size) |
1187 | return bio_clone(bio_src, gfpmask); | 1187 | return bio_clone(bio_src, gfpmask); |
1188 | 1188 | ||
1189 | if (WARN_ON_ONCE(!len)) | 1189 | if (WARN_ON_ONCE(!len)) |
1190 | return NULL; | 1190 | return NULL; |
1191 | if (WARN_ON_ONCE(len > bio_src->bi_size)) | 1191 | if (WARN_ON_ONCE(len > bio_src->bi_iter.bi_size)) |
1192 | return NULL; | 1192 | return NULL; |
1193 | if (WARN_ON_ONCE(offset > bio_src->bi_size - len)) | 1193 | if (WARN_ON_ONCE(offset > bio_src->bi_iter.bi_size - len)) |
1194 | return NULL; | 1194 | return NULL; |
1195 | 1195 | ||
1196 | /* Find first affected segment... */ | 1196 | /* Find first affected segment... */ |
@@ -1220,7 +1220,8 @@ static struct bio *bio_clone_range(struct bio *bio_src, | |||
1220 | return NULL; /* ENOMEM */ | 1220 | return NULL; /* ENOMEM */ |
1221 | 1221 | ||
1222 | bio->bi_bdev = bio_src->bi_bdev; | 1222 | bio->bi_bdev = bio_src->bi_bdev; |
1223 | bio->bi_sector = bio_src->bi_sector + (offset >> SECTOR_SHIFT); | 1223 | bio->bi_iter.bi_sector = bio_src->bi_iter.bi_sector + |
1224 | (offset >> SECTOR_SHIFT); | ||
1224 | bio->bi_rw = bio_src->bi_rw; | 1225 | bio->bi_rw = bio_src->bi_rw; |
1225 | bio->bi_flags |= 1 << BIO_CLONED; | 1226 | bio->bi_flags |= 1 << BIO_CLONED; |
1226 | 1227 | ||
@@ -1239,8 +1240,7 @@ static struct bio *bio_clone_range(struct bio *bio_src, | |||
1239 | } | 1240 | } |
1240 | 1241 | ||
1241 | bio->bi_vcnt = vcnt; | 1242 | bio->bi_vcnt = vcnt; |
1242 | bio->bi_size = len; | 1243 | bio->bi_iter.bi_size = len; |
1243 | bio->bi_idx = 0; | ||
1244 | 1244 | ||
1245 | return bio; | 1245 | return bio; |
1246 | } | 1246 | } |
@@ -1271,7 +1271,7 @@ static struct bio *bio_chain_clone_range(struct bio **bio_src, | |||
1271 | 1271 | ||
1272 | /* Build up a chain of clone bios up to the limit */ | 1272 | /* Build up a chain of clone bios up to the limit */ |
1273 | 1273 | ||
1274 | if (!bi || off >= bi->bi_size || !len) | 1274 | if (!bi || off >= bi->bi_iter.bi_size || !len) |
1275 | return NULL; /* Nothing to clone */ | 1275 | return NULL; /* Nothing to clone */ |
1276 | 1276 | ||
1277 | end = &chain; | 1277 | end = &chain; |
@@ -1283,7 +1283,7 @@ static struct bio *bio_chain_clone_range(struct bio **bio_src, | |||
1283 | rbd_warn(NULL, "bio_chain exhausted with %u left", len); | 1283 | rbd_warn(NULL, "bio_chain exhausted with %u left", len); |
1284 | goto out_err; /* EINVAL; ran out of bio's */ | 1284 | goto out_err; /* EINVAL; ran out of bio's */ |
1285 | } | 1285 | } |
1286 | bi_size = min_t(unsigned int, bi->bi_size - off, len); | 1286 | bi_size = min_t(unsigned int, bi->bi_iter.bi_size - off, len); |
1287 | bio = bio_clone_range(bi, off, bi_size, gfpmask); | 1287 | bio = bio_clone_range(bi, off, bi_size, gfpmask); |
1288 | if (!bio) | 1288 | if (!bio) |
1289 | goto out_err; /* ENOMEM */ | 1289 | goto out_err; /* ENOMEM */ |
@@ -1292,7 +1292,7 @@ static struct bio *bio_chain_clone_range(struct bio **bio_src, | |||
1292 | end = &bio->bi_next; | 1292 | end = &bio->bi_next; |
1293 | 1293 | ||
1294 | off += bi_size; | 1294 | off += bi_size; |
1295 | if (off == bi->bi_size) { | 1295 | if (off == bi->bi_iter.bi_size) { |
1296 | bi = bi->bi_next; | 1296 | bi = bi->bi_next; |
1297 | off = 0; | 1297 | off = 0; |
1298 | } | 1298 | } |
@@ -2186,7 +2186,8 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request, | |||
2186 | 2186 | ||
2187 | if (type == OBJ_REQUEST_BIO) { | 2187 | if (type == OBJ_REQUEST_BIO) { |
2188 | bio_list = data_desc; | 2188 | bio_list = data_desc; |
2189 | rbd_assert(img_offset == bio_list->bi_sector << SECTOR_SHIFT); | 2189 | rbd_assert(img_offset == |
2190 | bio_list->bi_iter.bi_sector << SECTOR_SHIFT); | ||
2190 | } else { | 2191 | } else { |
2191 | rbd_assert(type == OBJ_REQUEST_PAGES); | 2192 | rbd_assert(type == OBJ_REQUEST_PAGES); |
2192 | pages = data_desc; | 2193 | pages = data_desc; |