linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Mike Snitzer <snitzer@kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>,
	dm-devel@lists.linux.dev, fstests@vger.kernel.org,
	linux-ext4@vger.kernel.org, regressions@lists.linux.dev,
	Christoph Hellwig <hch@lst.de>,
	linux-block@vger.kernel.org
Subject: Re: dm: use queue_limits_set
Date: Mon, 20 May 2024 17:06:53 +0200	[thread overview]
Message-ID: <20240520150653.GA32461@lst.de> (raw)
In-Reply-To: <ZkmRKPfPeX3c138f@kernel.org>

On Sun, May 19, 2024 at 01:42:00AM -0400, Mike Snitzer wrote:
> > This being one potential fix from code inspection I've done to this
> > point, please see if it resolves your fstests failures (but I haven't
> > actually looked at those fstests yet _and_ I still need to review
> > commits d690cb8ae14bd and 4f563a64732da further -- will do on Monday,
> > sorry for the trouble):
> 
> I looked early, this is needed (max_user_discard_sectors makes discard
> limits stacking suck more than it already did -- imho 4f563a64732da is
> worthy of revert.

Can you explain why?  This actually makes the original addition of the
user-space controlled max discard limit work.  No I'm a bit doubful
that allowing this control was a good idea, but that ship unfortunately
has sailed.

Short of that, dm-cache-target.c and possibly other
> DM targets will need fixes too -- I'll go over it all Monday):
> 
> diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
> index 4793ad2aa1f7..c196f39579af 100644
> --- a/drivers/md/dm-thin.c
> +++ b/drivers/md/dm-thin.c
> @@ -4099,8 +4099,10 @@ static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits)
>  
>  	if (pt->adjusted_pf.discard_enabled) {
>  		disable_discard_passdown_if_not_supported(pt);
> -		if (!pt->adjusted_pf.discard_passdown)
> -			limits->max_discard_sectors = 0;
> +		if (!pt->adjusted_pf.discard_passdown) {
> +			limits->max_hw_discard_sectors = 0;
> +			limits->max_user_discard_sectors = 0;
> +		}

I think the main problem here is that dm targets adjust
max_discard_sectors diretly instead of adjusting max_hw_discard_sectors.
Im other words we need to switch all places dm targets set
max_discard_sectors to use max_hw_discard_sectors instead.  They should
not touch max_user_discard_sectors ever.

This is probably my fault, I actually found this right at the time
of the original revert of switching dm to the limits API, and then
let it slip as the patch was reverted.  That fact that you readded
the commit somehow went past my attention window.


  reply	other threads:[~2024-05-20 15:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240518022646.GA450709@mit.edu>
2024-05-19  5:05 ` dm: use queue_limits_set Mike Snitzer
2024-05-19  5:42   ` Mike Snitzer
2024-05-20 15:06     ` Christoph Hellwig [this message]
2024-05-20 15:39       ` Mike Snitzer
2024-05-20 15:44         ` Christoph Hellwig
2024-05-20 15:54           ` Mike Snitzer
2024-05-20 17:17             ` Mike Snitzer
2024-05-20 20:12               ` Christoph Hellwig
2024-05-20 22:03                 ` Mike Snitzer
2024-05-21  0:45                   ` Mike Snitzer
2024-05-21 15:29                     ` Mike Snitzer
2024-05-20 15:47         ` Mike Snitzer
2024-05-20 15:50           ` Christoph Hellwig

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=20240520150653.GA32461@lst.de \
    --to=hch@lst.de \
    --cc=dm-devel@lists.linux.dev \
    --cc=fstests@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=regressions@lists.linux.dev \
    --cc=snitzer@kernel.org \
    --cc=tytso@mit.edu \
    /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).