mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
dm: add target num_write_bios fn
Add a num_write_bios function to struct target. If an instance of a target sets this, it will be queried before the target's mapping function is called on a write bio, and the response controls the number of copies of the write bio that the target will receive. This provides a convenient way for a target to send the same data to more than one device. The new cache target uses this in writethrough mode, to send the data both to the cache and the backing device. Signed-off-by: Alasdair G Kergon <[email protected]>
This commit is contained in:
parent
df5d2e9089
commit
b0d8ed4d96
2 changed files with 30 additions and 7 deletions
|
|
@ -1152,15 +1152,23 @@ static void __clone_and_map_data_bio(struct clone_info *ci, struct dm_target *ti
|
|||
{
|
||||
struct bio *bio = ci->bio;
|
||||
struct dm_target_io *tio;
|
||||
unsigned target_bio_nr;
|
||||
unsigned num_target_bios = 1;
|
||||
|
||||
tio = alloc_tio(ci, ti, nr_iovecs, 0);
|
||||
/*
|
||||
* Does the target want to receive duplicate copies of the bio?
|
||||
*/
|
||||
if (bio_data_dir(bio) == WRITE && ti->num_write_bios)
|
||||
num_target_bios = ti->num_write_bios(ti, bio);
|
||||
|
||||
if (split_bvec)
|
||||
clone_split_bio(tio, bio, sector, idx, offset, len);
|
||||
else
|
||||
clone_bio(tio, bio, sector, idx, bv_count, len);
|
||||
|
||||
__map_bio(tio);
|
||||
for (target_bio_nr = 0; target_bio_nr < num_target_bios; target_bio_nr++) {
|
||||
tio = alloc_tio(ci, ti, nr_iovecs, target_bio_nr);
|
||||
if (split_bvec)
|
||||
clone_split_bio(tio, bio, sector, idx, offset, len);
|
||||
else
|
||||
clone_bio(tio, bio, sector, idx, bv_count, len);
|
||||
__map_bio(tio);
|
||||
}
|
||||
}
|
||||
|
||||
typedef unsigned (*get_num_bios_fn)(struct dm_target *ti);
|
||||
|
|
|
|||
Loading…
Reference in a new issue