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 Changes v1 -> v2 (suggestions by Ben Marzinski) - Patch 05: rework the shared_ptr test - Patch 06: new, separate patch for removing libcheck_tread code; remove libcheck_thread and start_checker_thread() from checkers.h Following patches are renumbered - Patch 10 (was 09): add alignment for checker_ctx field in struct runner_data remove the unused chkr field from struct async_checker_context - Patch 12: remove struct checker_context from checkers.h, remove unused MSG_TUR_FAILED, - patch 16: rename checker symbols to "libcheck_async_context_size" and "libcheck_async_init" - Patch 17 (was 12): Try to set TAS bit in rdac checker (libcheck_async_init()); this requires moving it after patch 16 Martin Wilck (19): 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: remove libcheck_thread related 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 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: convert RDAC checker to async checker 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 | 249 ++++++++++++++++++++++++++ libmultipath/async_checker.h | 36 ++++ libmultipath/checkers.c | 236 +++++++++---------------- libmultipath/checkers.h | 79 +++++---- 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 | 38 ++-- libmultipath/checkers/readsector0.c | 28 +-- libmultipath/checkers/tur.c | 253 ++------------------------- libmultipath/discovery.c | 8 +- libmultipath/libmultipath.version | 3 +- 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 | 120 +++++++++++++ 25 files changed, 728 insertions(+), 656 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
