Skip to content

Commit f557e69

Browse files
committed
Restore 5.10 kernels support
1 parent e209cfe commit f557e69

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

vdo/bio.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,50 @@ void vdo_bio_copy_data_in(struct bio *bio, char *data_ptr)
4141
struct bio_vec biovec;
4242
struct bvec_iter iter;
4343

44+
// XXX workaround for LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0)
45+
#ifdef __LINUX_BVEC_ITER_H
46+
unsigned long flags;
47+
48+
bio_for_each_segment(biovec, bio, iter) {
49+
void *from = bvec_kmap_irq(&biovec, &flags);
50+
51+
memcpy(data_ptr, from, biovec.bv_len);
52+
data_ptr += biovec.bv_len;
53+
bvec_kunmap_irq(from, &flags);
54+
}
55+
#else
56+
4457
bio_for_each_segment(biovec, bio, iter) {
4558
memcpy_from_bvec(data_ptr, &biovec);
4659
data_ptr += biovec.bv_len;
4760
}
61+
#endif
4862
}
4963

5064
/**********************************************************************/
5165
void vdo_bio_copy_data_out(struct bio *bio, char *data_ptr)
5266
{
5367
struct bio_vec biovec;
5468
struct bvec_iter iter;
69+
// XXX workaround for LINUX_VERSION_CODE < KERNEL_VERSION(5,15,0)
70+
#ifdef __LINUX_BVEC_ITER_H
71+
unsigned long flags;
72+
73+
bio_for_each_segment(biovec, bio, iter) {
74+
void *dest = bvec_kmap_irq(&biovec, &flags);
75+
76+
memcpy(dest, data_ptr, biovec.bv_len);
77+
data_ptr += biovec.bv_len;
78+
flush_dcache_page(biovec.bv_page);
79+
bvec_kunmap_irq(dest, &flags);
80+
}
81+
#else
5582

5683
bio_for_each_segment(biovec, bio, iter) {
5784
memcpy_to_bvec(&biovec, data_ptr);
5885
data_ptr += biovec.bv_len;
5986
}
87+
#endif
6088
}
6189

6290
/**********************************************************************/

vdo/dmvdo.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,14 @@ static void vdo_status(struct dm_target *ti,
198198
device_config = (struct device_config *) ti->private;
199199
DMEMIT("%s", device_config->original_string);
200200
break;
201+
// XXX workaround for LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
202+
#ifndef __LINUX_BVEC_ITER_H
201203
// XXX We ought to print more detailed output here, but this is what
202204
// thin does.
203205
case STATUSTYPE_IMA:
204206
*result = '\0';
205207
break;
208+
#endif // 5.15+
206209
}
207210
}
208211

0 commit comments

Comments
 (0)