[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 12 Dec 2022 12:44:44 -1000
From: Tejun Heo <tj@...nel.org>
To: Christoph Hellwig <hch@...radead.org>
Cc: Jens Axboe <axboe@...nel.dk>, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, darklight2357@...oud.com,
Josef Bacik <josef@...icpanda.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
cgroups@...r.kernel.org
Subject: Re: [PATCH 2/2 block/for-6.2] blk-iolatency: Make initialization lazy
Hello, Christoph.
On Mon, Dec 12, 2022 at 12:53:26AM -0800, Christoph Hellwig wrote:
> > +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.
Yeah, I thought about separating out open_bdev from blkg_conf_prep() but the
added complexity didn't feel very attractive given the usage pattern. Lemme
take a stab at it. Maybe it won't look too bad.
Thanks.
--
tejun
Powered by blists - more mailing lists