Add bvec_merge_data to handle stacked devices and ->merge_bvec()
authorAlasdair G Kergon <agk@redhat.com>
Thu, 3 Jul 2008 07:53:43 +0000 (09:53 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Thu, 3 Jul 2008 11:21:15 +0000 (13:21 +0200)
commitcc371e66e340f35eed8dc4651c7c18e754c7fb26
tree5a2d6727eb07a05999c531a90da43ab1c36b713e
parentb24498d477a14680fc3bb3ad884fa9fa76a2d237
Add bvec_merge_data to handle stacked devices and ->merge_bvec()

When devices are stacked, one device's merge_bvec_fn may need to perform
the mapping and then call one or more functions for its underlying devices.

The following bio fields are used:
  bio->bi_sector
  bio->bi_bdev
  bio->bi_size
  bio->bi_rw  using bio_data_dir()

This patch creates a new struct bvec_merge_data holding a copy of those
fields to avoid having to change them directly in the struct bio when
going down the stack only to have to change them back again on the way
back up.  (And then when the bio gets mapped for real, the whole
exercise gets repeated, but that's a problem for another day...)

Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Cc: Neil Brown <neilb@suse.de>
Cc: Milan Broz <mbroz@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
drivers/block/pktcdvd.c
drivers/md/linear.c
drivers/md/raid0.c
drivers/md/raid10.c
drivers/md/raid5.c
fs/bio.c
include/linux/blkdev.h