aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/drbd
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2010-06-10 07:30:36 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2010-10-14 08:37:33 -0400
commit5ba82308ea766b33404cb130a88fe4113d9c20a3 (patch)
treeec21a7d1cb92837cd98a6e9e30d44cb4cd63aa87 /drivers/block/drbd
parentb9b98716f83856b928f1c985ab55520c67663dd2 (diff)
drbd: factored drbd_req_make_private_bio() out of drbd_req_new()
Preparing tl_thaw_dio() Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block/drbd')
-rw-r--r--drivers/block/drbd/drbd_req.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/block/drbd/drbd_req.h b/drivers/block/drbd/drbd_req.h
index 1bcb85539735..07cb3b12edb4 100644
--- a/drivers/block/drbd/drbd_req.h
+++ b/drivers/block/drbd/drbd_req.h
@@ -257,30 +257,36 @@ static inline struct drbd_request *_ar_id_to_req(struct drbd_conf *mdev,
257 return NULL; 257 return NULL;
258} 258}
259 259
260static inline void drbd_req_make_private_bio(struct drbd_request *req, struct bio *bio_src)
261{
262 struct bio *bio;
263 bio = bio_clone(bio_src, GFP_NOIO); /* XXX cannot fail?? */
264
265 req->private_bio = bio;
266
267 bio->bi_private = req;
268 bio->bi_end_io = drbd_endio_pri;
269 bio->bi_next = NULL;
270}
271
260static inline struct drbd_request *drbd_req_new(struct drbd_conf *mdev, 272static inline struct drbd_request *drbd_req_new(struct drbd_conf *mdev,
261 struct bio *bio_src) 273 struct bio *bio_src)
262{ 274{
263 struct bio *bio;
264 struct drbd_request *req = 275 struct drbd_request *req =
265 mempool_alloc(drbd_request_mempool, GFP_NOIO); 276 mempool_alloc(drbd_request_mempool, GFP_NOIO);
266 if (likely(req)) { 277 if (likely(req)) {
267 bio = bio_clone(bio_src, GFP_NOIO); /* XXX cannot fail?? */ 278 drbd_req_make_private_bio(req, bio_src);
268 279
269 req->rq_state = bio_data_dir(bio_src) == WRITE ? RQ_WRITE : 0; 280 req->rq_state = bio_data_dir(bio_src) == WRITE ? RQ_WRITE : 0;
270 req->mdev = mdev; 281 req->mdev = mdev;
271 req->master_bio = bio_src; 282 req->master_bio = bio_src;
272 req->private_bio = bio;
273 req->epoch = 0; 283 req->epoch = 0;
274 req->sector = bio->bi_sector; 284 req->sector = bio_src->bi_sector;
275 req->size = bio->bi_size; 285 req->size = bio_src->bi_size;
276 req->start_time = jiffies; 286 req->start_time = jiffies;
277 INIT_HLIST_NODE(&req->colision); 287 INIT_HLIST_NODE(&req->colision);
278 INIT_LIST_HEAD(&req->tl_requests); 288 INIT_LIST_HEAD(&req->tl_requests);
279 INIT_LIST_HEAD(&req->w.list); 289 INIT_LIST_HEAD(&req->w.list);
280
281 bio->bi_private = req;
282 bio->bi_end_io = drbd_endio_pri;
283 bio->bi_next = NULL;
284 } 290 }
285 return req; 291 return req;
286} 292}