/** * dm_bio_integrity_rewind - Rewind integrity vector * @bio: bio whose integrity vector to update * @bytes_done: number of data bytes to rewind * * Description: This function calculates how many integrity bytes the * number of completed data bytes correspond to and rewind the * integrity vector accordingly.
*/ staticvoid dm_bio_integrity_rewind(struct bio *bio, unsignedint bytes_done)
{ struct bio_integrity_payload *bip = bio_integrity(bio); struct blk_integrity *bi = blk_get_integrity(bio->bi_bdev->bd_disk); unsignedint bytes = bio_integrity_bytes(bi, bytes_done >> 9);
staticinlinevoid dm_bio_integrity_rewind(struct bio *bio, unsignedint bytes_done)
{
}
#endif
#ifdefined(CONFIG_BLK_INLINE_ENCRYPTION)
/* Decrements @dun by @dec, treating @dun as a multi-limb integer. */ staticvoid dm_bio_crypt_dun_decrement(u64 dun[BLK_CRYPTO_DUN_ARRAY_SIZE], unsignedint dec)
{ int i;
for (i = 0; dec && i < BLK_CRYPTO_DUN_ARRAY_SIZE; i++) {
u64 prev = dun[i];
dun[i] -= dec; if (dun[i] > prev)
dec = 1; else
dec = 0;
}
}
/* No advance means no rewind */ if (bio_no_advance_iter(bio))
iter->bi_size += bytes; else
dm_bvec_iter_rewind(bio->bi_io_vec, iter, bytes);
}
/** * dm_bio_rewind - update ->bi_iter of @bio by rewinding @bytes. * @bio: bio to rewind * @bytes: how many bytes to rewind * * WARNING: * Caller must ensure that @bio has a fixed end sector, to allow * rewinding from end of bio and restoring its original position. * Caller is also responsibile for restoring bio's size.
*/ staticvoid dm_bio_rewind(struct bio *bio, unsignedint bytes)
{ if (bio_integrity(bio))
dm_bio_integrity_rewind(bio, bytes);
if (bio_has_crypt_ctx(bio))
dm_bio_crypt_rewind(bio, bytes);
dm_bio_rewind_iter(bio, &bio->bi_iter, bytes);
}
void dm_io_rewind(struct dm_io *io, struct bio_set *bs)
{ struct bio *orig = io->orig_bio; struct bio *new_orig = bio_alloc_clone(orig->bi_bdev, orig,
GFP_NOIO, bs); /* * dm_bio_rewind can restore to previous position since the * end sector is fixed for original bio, but we still need * to restore bio's size manually (using io->sectors).
*/
dm_bio_rewind(new_orig, ((io->sector_offset << 9) -
orig->bi_iter.bi_size));
bio_trim(new_orig, 0, io->sectors);
bio_chain(new_orig, orig); /* * __bi_remaining was increased (by dm_split_and_process_bio), * so must drop the one added in bio_chain.
*/
atomic_dec(&orig->__bi_remaining);
io->orig_bio = new_orig;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.