From 4f133fd8e48ad7a35d0f36a491fb771ff688a7be Mon Sep 17 00:00:00 2001 From: Andrew Walsh Date: Thu, 3 Sep 2020 18:11:14 -0400 Subject: [PATCH] Replace generic_make_request with submit_bio_noacct. In kernel 5.9, generic_make_request has been renamed to submit_bio_noacct to more accurately describe its function. There is a comment in vdo/kernel/kernelLayer.c referencing generic_make_request which is not touched by this change because the whole lengthy comment will have to be massively revised or even removed for upstreaming. The doxygen comments in dmvdo.c and dmDory.c that reference generic_make_request cannot easily be made conditional because doxygen does not process preprocessor directives within comments. The comments can be rephrased to simply refer to bio submission because the exact name of the function used to do the submission is not critical to the meaning of the comments. Pair: sweettea .../dmvdo.c .../ioSubmitter.c .../kvdoFlush.c Replace generic_make_request with submit_bio_noacct for kernels > 5.9. --- vdo/kernel/dmvdo.c | 8 ++++---- vdo/kernel/ioSubmitter.c | 4 ++++ vdo/kernel/kvdoFlush.c | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/vdo/kernel/dmvdo.c b/vdo/kernel/dmvdo.c index a6c7b98..f5bed6d 100644 --- a/vdo/kernel/dmvdo.c +++ b/vdo/kernel/dmvdo.c @@ -80,8 +80,8 @@ static KernelLayer *getKernelLayerForTarget(struct dm_target *ti) /** * Begin VDO processing of a bio. This is called by the device mapper - * through the "map" function, and has resulted from a call to either - * submit_bio or generic_make_request. + * through the "map" function, and has resulted from a bio being + * submitted. * * @param ti The dm_target. We only need the "private" member to give * us the KernelLayer. @@ -95,11 +95,11 @@ static KernelLayer *getKernelLayerForTarget(struct dm_target *ti) * DM_MAPIO_SUBMITTED VDO will take care of this I/O, either * processing it completely and calling * bio_endio, or forwarding it onward by - * calling generic_make_request. + * submitting it to the next layer. * * DM_MAPIO_REMAPPED VDO has modified the bio and the device * mapper will immediately forward the bio - * onward using generic_make_request. + * onward by submitting it to the next layer. * * DM_MAPIO_REQUEUE We do not use this. It is used by device * mapper devices to defer an I/O request diff --git a/vdo/kernel/ioSubmitter.c b/vdo/kernel/ioSubmitter.c index 036bf25..0e28c3f 100644 --- a/vdo/kernel/ioSubmitter.c +++ b/vdo/kernel/ioSubmitter.c @@ -291,7 +291,11 @@ static void sendBioToDevice(KVIO *kvio, BIO *bio, TraceLocation location) countAllBios(kvio, bio); kvioAddTraceRecord(kvio, location); bio->bi_next = NULL; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0) generic_make_request(bio); +#else + submit_bio_noacct(bio); +#endif } /** diff --git a/vdo/kernel/kvdoFlush.c b/vdo/kernel/kvdoFlush.c index 7b38af1..ddc3958 100644 --- a/vdo/kernel/kvdoFlush.c +++ b/vdo/kernel/kvdoFlush.c @@ -198,7 +198,11 @@ static void kvdoCompleteFlushWork(KvdoWorkItem *item) prepareFlushBIO(bio, bio->bi_private, getKernelLayerBdev(layer), bio->bi_end_io); atomic64_inc(&layer->flushOut); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,9,0) generic_make_request(bio); +#else + submit_bio_noacct(bio); +#endif }