akiradeveloper / dm-writeboost

Log-structured Caching for Linux
GNU General Public License v2.0
120 stars 18 forks source link

Linux 6.0: support new dm_io_request->bi_opf #240

Closed arighi closed 1 year ago

arighi commented 1 year ago

With commit 581075e4f647 ("dm/core: Reduce the size of struct dm_io_request") bi_op and bi_op_flags in struct dm_io_request have been merged together into the same attribute bi_opf, make sure to support this change in recent kernels.

Signed-off-by: Andrea Righi andrea.righi@canonical.com

akiradeveloper commented 1 year ago

@arighi

Thanks for the fix.

But the if-else branches nesting is very confusing for me. I know you tried to avoid duplicating some code such as bio_is_barrier though.

I prefer writing as in this form.

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,0,0)
// new defines
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)
// the same
#else
// the same
#endif
arighi commented 1 year ago

Sure, I can change to this format, it's definitely more readable.