Skip to content

Commit

Permalink
Restore 5.10 kernels support
Browse files Browse the repository at this point in the history
  • Loading branch information
tigerblue77 committed Apr 24, 2022
1 parent e209cfe commit f557e69
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
28 changes: 28 additions & 0 deletions vdo/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,50 @@ 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
}

/**********************************************************************/
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
}

/**********************************************************************/
Expand Down
3 changes: 3 additions & 0 deletions vdo/dmvdo.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,14 @@ 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+
}
}

Expand Down

0 comments on commit f557e69

Please sign in to comment.