linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Tejun Heo <tj@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	darklight2357@icloud.com, Josef Bacik <josef@toxicpanda.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	cgroups@vger.kernel.org
Subject: Re: [PATCH 2/2 block/for-6.2] blk-iolatency: Make initialization lazy
Date: Mon, 12 Dec 2022 00:53:26 -0800	[thread overview]
Message-ID: <Y5bsBuwjcbHEjhIw@infradead.org> (raw)
In-Reply-To: <Y5TRU2+s379DhUbj@slm.duckdns.org>

> +static int blk_iolatency_try_init(char *input)
> +{
> +	static DEFINE_MUTEX(init_mutex);
> +	struct block_device *bdev;
> +	int ret = 0;
> +
> +	bdev = blkcg_conf_open_bdev(&input);
> +	if (IS_ERR(bdev))
> +		return PTR_ERR(bdev);

> +retry:
>  	ret = blkg_conf_prep(blkcg, &blkcg_policy_iolatency, buf, &ctx);
> +	if (ret == -EOPNOTSUPP) {
> +		ret = blk_iolatency_try_init(buf);

It's a little sad to do two block device lookups here (even if it
obviously doesn't matter for performance).  I wonder if it would
make sense to explicitly support the lazy init pattern
in blkg_conf_prep somehow.

Otherwise I'm all for the lazy init.

  reply	other threads:[~2022-12-12  8:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-10 18:33 [PATCH 1/2 block/for-6.2] blk-iolatency: Fix memory leak on add_disk() failures Tejun Heo
2022-12-10 18:34 ` [PATCH 2/2 block/for-6.2] blk-iolatency: Make initialization lazy Tejun Heo
2022-12-12  8:53   ` Christoph Hellwig [this message]
2022-12-12 22:44     ` Tejun Heo
2022-12-10 18:54 ` [PATCH 1/2 block/for-6.2] blk-iolatency: Fix memory leak on add_disk() failures Linus Torvalds
2022-12-12  8:47 ` Christoph Hellwig
2022-12-14 19:43 ` (subset) " Jens Axboe

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=Y5bsBuwjcbHEjhIw@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=darklight2357@icloud.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).