mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Tao Cui <cui.tao@linux.dev>,
	axboe@kernel.dk, hch@lst.de,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: cuitao@kylinos.cn, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] loop: defer the queue limits clear to a workqueue
Date: Thu, 24 Sep 2026 11:01:29 -0700	[thread overview]
Message-ID: <b6e08595-50f5-494b-ae5e-726513d8dae2@acm.org> (raw)
In-Reply-To: <20260924102027.2307044-1-cui.tao@linux.dev>

On 9/24/26 3:20 AM, Tao Cui wrote:
> +	memflags = blk_mq_freeze_queue(lo->lo_queue);
> +	mutex_lock(&lo->clear_limits_lock);
> +	if (lo->clear_limits_gen == lo->rebind_gen) {
> +		mode = lo->clear_limits_mode;
> +		lo->clear_limits_mode = 0;
> +
> +		if (mode & FALLOC_FL_ZERO_RANGE)
> +			lim.max_write_zeroes_sectors = 0;
> +
> +		if (mode & FALLOC_FL_PUNCH_HOLE) {
> +			lim.max_hw_discard_sectors = 0;
> +			lim.discard_granularity = 0;
> +		}
> +	}

I propose to remove the member variables clear_limits_gen and
rebind_gen. These member variables complicate verifying correctness
of the code and IMHO are not necessary. If loop_clear_limits() races
with loop_clear_limits_workfn(), the work will be rescheduled and
loop_clear_limits_workfn() will be called another time.

>   	queue_limits_commit_update(lo->lo_queue, &lim);
> +	mutex_unlock(&lo->clear_limits_lock);

Since the mutex_lock(&lo->clear_limits_lock) call occurs after
queue_limits_start_update(), please move the
mutex_unlock(&lo->clear_limits_lock) call above the
queue_limits_commit_update() call. This has no impact on
correctness nor on the lock nesting order but makes the code
easier to follow.

Thanks,

Bart.

  parent reply	other threads:[~2026-09-24 18:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 10:20 Tao Cui
2026-09-24 10:32 ` Tao Cui
2026-09-24 18:01 ` Bart Van Assche [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-08-28  7:20 Tao Cui
2026-08-28 16:34 ` Bart Van Assche
2026-08-31 13:34   ` Tao Cui
2026-08-31 16:25 ` Bart Van Assche
2026-09-01 13:14   ` Tao Cui
2026-09-01 17:29 ` Bart Van Assche

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=b6e08595-50f5-494b-ae5e-726513d8dae2@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=cui.tao@linux.dev \
    --cc=cuitao@kylinos.cn \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    /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

all inboxes | Powered by JetHome®