Linux Device Mapper development
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: Martin Wilck <martin.wilck@suse.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>,
	Brian Bunker <brian@purestorage.com>,
	dm-devel@lists.linux.dev,
	Xose Vazquez Perez <xose.vazquez@gmail.com>
Subject: Re: [PATCH 06/18] libmultipath: use shared_ptr for checker classes
Date: Mon, 18 May 2026 15:27:56 -0400	[thread overview]
Message-ID: <agtoPFRlhXx7lJzH@redhat.com> (raw)
In-Reply-To: <41f748a2979937ca6d7e8016d06de9ddc4c4d129.camel@suse.com>

On Sun, May 17, 2026 at 11:57:25AM +0200, Martin Wilck wrote:
> On Tue, 2026-05-12 at 20:49 -0400, Benjamin Marzinski wrote:
> > On Tue, May 05, 2026 at 05:43:20PM +0200, Martin Wilck wrote:
> > > Utilize the share_ptr code for tracking the refcount of checker
> > > classes.
> > > 
> > > Signed-off-by: Martin Wilck <mwilck@suse.com>
> > > ---
> > >  libmultipath/checkers.c | 98 +++++++++----------------------------
> > > ----
> > >  libmultipath/checkers.h |  2 -
> > >  2 files changed, 20 insertions(+), 80 deletions(-)
> > > 
> > > diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c
> > > index 8f18ca6..a3b9cc8 100644
> > > --- a/libmultipath/checkers.c
> > > +++ b/libmultipath/checkers.c
> > [...]
> > > @@ -163,8 +143,7 @@ static struct checker_class
> > > *add_checker_class(const char *name)
> > >  		goto out;
> > >  
> > >  	c->mp_init = (int (*)(struct checker *)) dlsym(c->handle,
> > > "libcheck_mp_init");
> > > -	c->reset = (void (*)(void)) dlsym(c->handle,
> > > "libcheck_reset");
> > > -	c->thread = (void *(*)(void*)) dlsym(c->handle,
> > > "libcheck_thread");
> > > +	c->reset = (void (*)(void))dlsym(c->handle,
> > > "libcheck_reset");
> > 
> > Nitpick. Dropped a space here.
> 
> I didn't do that. clang-format did, as it also reformats context lines
> in patches. I think clang-format is correct. We usually don't use space
> after cast, do we? (As usual, our code base is inconsistent in this
> respect).
> 
> While I don't want to enforce formatting style throughout the entire
> code base, I tend to keep the changes that clang-format applies to
> context lines (be it only to avoid red lights from the GitHub CI).
> 
> Do you disagree with this policy?

It's fine. It just doesn't match the dlsym lines around it, which is fine.
-Ben

> 
> Regards
> Martin
> 
> > 
> > >  	c->pending = (int (*)(struct checker *)) dlsym(c->handle,
> > > "libcheck_pending");
> > >  	c->need_wait = (bool (*)(struct checker *)) dlsym(c-
> > > >handle, "libcheck_need_wait");
> > >  	/* These 5 functions can be NULL. call dlerror() to clear
> > > out any
> > [...]
> > > @@ -371,43 +350,6 @@ bad_id:
> > >  	return generic_msg[CHECKER_MSGID_NONE];
> > >  }
> > 
> > Removing the checker thread stuff is more of a cleanup from d1ebd977.
> > It
> > should probably either be it's own cleanup patch, or it should at
> > least
> > get mentioned in the commit message.
> >   
> > > -static void checker_cleanup_thread(void *arg)
> > > -{
> > > -	struct checker_class *cls = arg;
> > > -
> > > -	free_checker_class(cls);
> > > -	rcu_unregister_thread();
> > > -}
> > > -
> > > -static void *checker_thread_entry(void *arg)
> > > -{
> > > -	struct checker_context *ctx = arg;
> > > -	void *rv;
> > > -
> > > -	rcu_register_thread();
> > > -	pthread_cleanup_push(checker_cleanup_thread, ctx->cls);
> > > -	rv = ctx->cls->thread(ctx);
> > > -	pthread_cleanup_pop(1);
> > > -	return rv;
> > > -}
> > > -
> > 
> > Also, start_checker_thread() is stil declared in
> > libmultipath/checkers.h,
> > along with a comment.
> > 
> > -Ben
> > 
> > > -int start_checker_thread(pthread_t *thread, const pthread_attr_t
> > > *attr,
> > > -			 struct checker_context *ctx)
> > > -{
> > > -	int rv;
> > > -
> > > -	assert(ctx && ctx->cls && ctx->cls->thread);
> > > -	/* Take a ref here, lest the class be freed before the
> > > thread starts */
> > > -	(void)checker_class_ref(ctx->cls);
> > > -	rv = pthread_create(thread, attr, checker_thread_entry,
> > > ctx);
> > > -	if (rv != 0) {
> > > -		condlog(1, "failed to start checker thread for %s:
> > > %m",
> > > -			ctx->cls->name);
> > > -		checker_class_unref(ctx->cls);
> > > -	}
> > > -	return rv;
> > > -}
> > > -
> > >  void checker_clear_message (struct checker *c)
> > >  {
> > >  	if (!c)


  reply	other threads:[~2026-05-18 19:28 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-05 15:43 [PATCH 00/18] multipath-tools: asynchronous checker framework Martin Wilck
2026-05-05 15:43 ` [PATCH 01/18] libmpathutil: runner: reduce a message loglevel Martin Wilck
2026-05-13  0:39   ` Benjamin Marzinski
2026-05-05 15:43 ` [PATCH 02/18] libmultipath: checkers: add two generic checker messages Martin Wilck
2026-05-13  0:39   ` Benjamin Marzinski
2026-05-05 15:43 ` [PATCH 03/18] libmultipath: checkers: move checker_class definition to checkers.h Martin Wilck
2026-05-13  0:40   ` Benjamin Marzinski
2026-05-05 15:43 ` [PATCH 04/18] libmpathutil: add implementation of generic shared pointer Martin Wilck
2026-05-13  0:45   ` Benjamin Marzinski
2026-05-05 15:43 ` [PATCH 05/18] multipath-tools tests: add tests for shared pointer code Martin Wilck
2026-05-08 23:11   ` Martin Wilck
2026-05-05 15:43 ` [PATCH 06/18] libmultipath: use shared_ptr for checker classes Martin Wilck
2026-05-13  0:49   ` Benjamin Marzinski
2026-05-17  9:57     ` Martin Wilck
2026-05-18 19:27       ` Benjamin Marzinski [this message]
2026-05-05 15:43 ` [PATCH 07/18] libmultipath: use shared_ptr for prioritizers Martin Wilck
2026-05-13  0:50   ` Benjamin Marzinski
2026-05-05 15:43 ` [PATCH 08/18] libmpathutil: runner: use shared_ptr Martin Wilck
2026-05-13  0:50   ` Benjamin Marzinski
2026-05-05 15:43 ` [PATCH 09/18] libmultipath: add generic async path checker code Martin Wilck
2026-05-13  0:55   ` Benjamin Marzinski
2026-05-05 15:43 ` [PATCH 10/18] libmultipath: checkers: add support for async checker Martin Wilck
2026-05-13  0:59   ` Benjamin Marzinski
2026-05-05 15:43 ` [PATCH 11/18] libmultipath: convert TUR checker to an async checker instance Martin Wilck
2026-05-13  1:03   ` Benjamin Marzinski
2026-05-05 15:43 ` [PATCH 12/18] libmultipath: convert RDAC checker to async checker Martin Wilck
2026-05-13  1:04   ` Benjamin Marzinski
2026-05-05 15:43 ` [PATCH 13/18] libmultipath: convert cciss_tur " Martin Wilck
2026-05-13  1:05   ` Benjamin Marzinski
2026-05-05 15:43 ` [PATCH 14/18] libmultipath: convert readsector0 " Martin Wilck
2026-05-13  1:05   ` Benjamin Marzinski
2026-05-05 15:43 ` [PATCH 15/18] libmultipath: convert hp_sw " Martin Wilck
2026-05-13  1:06   ` Benjamin Marzinski
2026-05-05 15:43 ` [PATCH 16/18] libmultipath: async_checker: add context_size and init symbols Martin Wilck
2026-05-13  1:09   ` Benjamin Marzinski
2026-05-05 15:43 ` [PATCH 17/18] libmultipath: checkers: rework mpcontext passing Martin Wilck
2026-05-13  1:09   ` Benjamin Marzinski
2026-05-05 15:43 ` [PATCH 18/18] libmultipath: convert emc_clariion to async_checker Martin Wilck
2026-05-13  1:20   ` Benjamin Marzinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=agtoPFRlhXx7lJzH@redhat.com \
    --to=bmarzins@redhat.com \
    --cc=brian@purestorage.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=martin.wilck@suse.com \
    --cc=xose.vazquez@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox