Based on my previous patch set [1], which introduced the "runner" thread handling code as an abstract implementation of the asynchronous checker logic in the TUR checker, this set introduces a generic "async_checker" type and converts all existing checkers except directio to this framework. With this set applied, all checkers run asyncrhonously unless explicitly forbidden to do so with the "force_sync" option.
Patch 1-3 are minor preparations. Patch 4-8 introduce a general concept of a refcounted "shared" pointer and use it to replace multiple instances of hard-coded refcounts on objects. Patch 9 converts the current TUR code into a generic asynchronous checker type by separating the actual TUR code from the handling of the async runners. Patch 10 adds support for this async checker type in the checkers code by searching for "libcheck_async_func" with dlsym() in checker DSOs. Patch 11-15 convert all checkers except emc_clariion to the async_checker framework. emc_clariion is special because it needs extra context both for the checker itself and for multipath-related information. Patch 16 and 17 add the respective additional fields to the async_checker framework. The mpcontext handling is rewritten, because the current apporach of handling void ** pointers would be disastrous in scenarious with truly asynchronous checker threads that may hang forever. Patch 18 finally converts emc_clariion, using the concepts from patch 16 and 17. Comments and reviews welcome. Regards, Martin [1] https://lore.kernel.org/dm-devel/[email protected]/T/#m9369993a81c82b10ef42896505d4a354b6be3f79 Martin Wilck (18): libmpathutil: runner: reduce a message loglevel libmultipath: checkers: add two generic checker messages libmultipath: checkers: move checker_class definition to checkers.h libmpathutil: add implementation of generic shared pointer multipath-tools tests: add tests for shared pointer code libmultipath: use shared_ptr for checker classes libmultipath: use shared_ptr for prioritizers libmpathutil: runner: use shared_ptr libmultipath: add generic async path checker code libmultipath: checkers: add support for async checker libmultipath: convert TUR checker to an async checker instance libmultipath: convert RDAC checker to async checker libmultipath: convert cciss_tur checker to async checker libmultipath: convert readsector0 checker to async checker libmultipath: convert hp_sw checker to async checker libmultipath: async_checker: add context_size and init symbols libmultipath: checkers: rework mpcontext passing libmultipath: convert emc_clariion to async_checker libmpathutil/libmpathutil.version | 7 + libmpathutil/runner.c | 32 ++-- libmpathutil/util.c | 45 ++++- libmpathutil/util.h | 5 + libmultipath/Makefile | 2 +- libmultipath/async_checker.c | 251 +++++++++++++++++++++++++++ libmultipath/async_checker.h | 36 ++++ libmultipath/checkers.c | 236 ++++++++++--------------- libmultipath/checkers.h | 54 ++++-- libmultipath/checkers/cciss_tur.c | 41 ++--- libmultipath/checkers/directio.c | 6 +- libmultipath/checkers/emc_clariion.c | 104 +++++------ libmultipath/checkers/hp_sw.c | 32 +--- libmultipath/checkers/rdac.c | 30 ++-- libmultipath/checkers/readsector0.c | 28 +-- libmultipath/checkers/tur.c | 251 ++------------------------- libmultipath/discovery.c | 8 +- libmultipath/libmultipath.version | 2 +- libmultipath/prio.c | 47 +++-- libmultipath/prio.h | 1 - libmultipath/structs.c | 3 +- libmultipath/structs.h | 3 +- tests/Makefile | 4 +- tests/directio.c | 2 +- tests/shared_ptr.c | 111 ++++++++++++ 25 files changed, 716 insertions(+), 625 deletions(-) create mode 100644 libmultipath/async_checker.c create mode 100644 libmultipath/async_checker.h create mode 100644 tests/shared_ptr.c -- 2.54.0
