diff --git a/vdo/bio.c b/vdo/bio.c index ef2142fd..66db8e19 100644 --- a/vdo/bio.c +++ b/vdo/bio.c @@ -41,10 +41,24 @@ void vdo_bio_copy_data_in(struct bio *bio, char *data_ptr) struct bio_vec biovec; struct bvec_iter iter; +// XXX workaround for LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) +#ifdef __LINUX_BVEC_ITER_H + unsigned long flags; + + bio_for_each_segment(biovec, bio, iter) { + void *from = bvec_kmap_irq(&biovec, &flags); + + memcpy(data_ptr, from, biovec.bv_len); + data_ptr += biovec.bv_len; + bvec_kunmap_irq(from, &flags); + } +#else + bio_for_each_segment(biovec, bio, iter) { memcpy_from_bvec(data_ptr, &biovec); data_ptr += biovec.bv_len; } +#endif } /**********************************************************************/ @@ -52,11 +66,25 @@ void vdo_bio_copy_data_out(struct bio *bio, char *data_ptr) { struct bio_vec biovec; struct bvec_iter iter; +// XXX workaround for LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0) +#ifdef __LINUX_BVEC_ITER_H + unsigned long flags; + + bio_for_each_segment(biovec, bio, iter) { + void *dest = bvec_kmap_irq(&biovec, &flags); + + memcpy(dest, data_ptr, biovec.bv_len); + data_ptr += biovec.bv_len; + flush_dcache_page(biovec.bv_page); + bvec_kunmap_irq(dest, &flags); + } +#else bio_for_each_segment(biovec, bio, iter) { memcpy_to_bvec(&biovec, data_ptr); data_ptr += biovec.bv_len; } +#endif } /**********************************************************************/ diff --git a/vdo/dmvdo.c b/vdo/dmvdo.c index 284ebad0..e526694b 100644 --- a/vdo/dmvdo.c +++ b/vdo/dmvdo.c @@ -198,12 +198,15 @@ static void vdo_status(struct dm_target *ti, device_config = (struct device_config *) ti->private; DMEMIT("%s", device_config->original_string); break; +// XXX workaround for LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0) +#ifndef __LINUX_BVEC_ITER_H // XXX We ought to print more detailed output here, but this is what // thin does. case STATUSTYPE_IMA: *result = '\0'; break; } +#endif // 5.15+ }