Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2537526lqo; Mon, 20 May 2024 08:45:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW3kucSn1qU6h16h6SU+gxdfTwAw3sh6Zmsq5b0r2EMvSm/gE18b6dhyitidd7TJ3OTflfqXPR+8xVdPTcCOIRh2wCzkWqR+uiN//79Cg== X-Google-Smtp-Source: AGHT+IGuEsHZlGmCHz7WW17iAJuh38OUPQ7gSCSdud6bIM8PwGtqJ2gnJxlnSlYrg8vXkXh48/qD X-Received: by 2002:a05:6214:4a04:b0:6a9:75ff:8ed4 with SMTP id 6a1803df08f44-6a975ff9188mr52428626d6.42.1716219907025; Mon, 20 May 2024 08:45:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716219907; cv=pass; d=google.com; s=arc-20160816; b=c5RPl7J4gUaYVhD7c68ibQ+FOeD7OCoVpwH2qe/acTizCKzroXHWvl4t5792iQSBYm jQioyTZdMKFAVJpaBryCc0kUcWCEGckhjKkPgDNADH0dsQxKgChCRMlXJAESJMccDNnR RB+/YcS0d7JPWIjHW9HB9qHHBYeVeWAbXgLzJGNUhJhMfIs5B8nzaCYBa4HI4HTVs+5R qeZroQrdGYlyZNw9UO21p0XbaxWPZDBQBCyFCHLkKjpAaYoQqk+WdFwTi0s6RqywFlb5 BMsgErhPAbsM+N0OPkRWABJ7ciNnAiejnperqeX19nRNUzD5KsNd80pLrCctCLmy0Ke2 UEcQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=//xN3bRIOTOPY9SYMYNe4u+yspOlXNwyYATUsUb7WbQ=; fh=vDwh9eUywtCNfeEB0rWNrxt0d7b2eCCILtNFIUdFvC8=; b=V/phN+DSNEo/BeW8iuZqnK7V6BTcUQmefHg1yUAfPt+mS4MdZCV8RVi34/r8IELwNz sQC7RR4aeWig1isZNhGLBxpbrVJ6FGPhCJFa+66DNMKVchKfSFB8plQQGvto8IEmUHMr SEBRet4o1lolNxGPCwM+Maji0tC3/iyNoxDYLv4+0CIq97/bjnadt8DIXh3a/gbgH7h5 P5igf1WjEH/EHsGsw1Ryr2W0hlMPFhDgnsW0KLSJLcjnoIR8HWKYzlUxp3ocF3aqzK+f Spijc6WZU2kxfFV7lPZzqtV0X2SyQ7b4NfDo0blX7mILy01iqQL+pu1X6lhKxsLIr5C8 6gjQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-ext4+bounces-2605-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2605-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f2b74acsi48479886d6.408.2024.05.20.08.45.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 08:45:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4+bounces-2605-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=lst.de); spf=pass (google.com: domain of linux-ext4+bounces-2605-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-ext4+bounces-2605-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BE32C1C20C5D for ; Mon, 20 May 2024 15:45:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6E4EA13776A; Mon, 20 May 2024 15:44:31 +0000 (UTC) X-Original-To: linux-ext4@vger.kernel.org Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AEF3137771; Mon, 20 May 2024 15:44:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716219871; cv=none; b=lNa+nrlu9ZyqNGCPQL6fT28hmu5UR5yPCMQ8H+u8TpyeOCnB+1OOqaZgXygihVC3n5ZvpykRLa8WZjPv5y5pdeGKlKmNm9SvSNmv2ZzrDkN1F3+75xOH8aLpE/lCoQd26Ue2cSs3gw21HZAM+Sj6TwOBtVeiPBnUi99xfDHoQAA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716219871; c=relaxed/simple; bh=uQYwQrhNr1tapWzD5SFii2r2ol4zhyU12nt7DLCJlRY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=L4X44Ed4YVnrpATFvT5Oz8tOY9N+rtrvp/e+BBZ6UkR9NQVlYDDIS9LRzmdSGqBBvW8DkfKVKFBGoBNGHx8xQmc7XxL+P8bQa4cdKbRoMv08W6CR0eYoBJ+1NpVS+bI0Ztb5ZcjSsWKyHKzxEg2z48THJZWJNXRSV7TuAJY+5Ro= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id B9FBC68AFE; Mon, 20 May 2024 17:44:25 +0200 (CEST) Date: Mon, 20 May 2024 17:44:25 +0200 From: Christoph Hellwig To: Mike Snitzer Cc: Christoph Hellwig , Theodore Ts'o , dm-devel@lists.linux.dev, fstests@vger.kernel.org, linux-ext4@vger.kernel.org, regressions@lists.linux.dev, linux-block@vger.kernel.org Subject: Re: dm: use queue_limits_set Message-ID: <20240520154425.GB1104@lst.de> References: <20240518022646.GA450709@mit.edu> <20240520150653.GA32461@lst.de> Precedence: bulk X-Mailing-List: linux-ext4@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) On Mon, May 20, 2024 at 11:39:14AM -0400, Mike Snitzer wrote: > That's fair. My criticism was more about having to fix up DM targets > to cope with the new normal of max_discard_sectors being set as a > function of max_hw_discard_sectors and max_user_discard_sectors. > > With stacked devices in particular it is _very_ hard for the user to > know their exerting control over a max discard limit is correct. The user forcing a limit is always very sketchy, which is why I'm not a fan of it. > Yeah, but my concern is that if a user sets a value that is too low > it'll break targets like DM thinp (which Ted reported). So forcibly > setting both to indirectly set the required max_discard_sectors seems > necessary. Dm-think requiring a minimum discard size is a rather odd requirement. Is this just a debug asswert, or is there a real technical reason for it? If so we can introduce a now to force a minimum size or disable user setting the value entirely. > 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 > @@ -4497,7 +4499,8 @@ static void thin_io_hints(struct dm_target *ti, struct queue_limits *limits) > > if (pool->pf.discard_enabled) { > limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT; > - limits->max_discard_sectors = pool->sectors_per_block * BIO_PRISON_MAX_RANGE; > + limits->max_hw_discard_sectors = limits->max_user_discard_sectors = > + pool->sectors_per_block * BIO_PRISON_MAX_RANGE; > } Drivers really have no business setting max_user_discard_sector, the whole point of the field is to separate device/driver capabilities from user policy. So if dm-think really has no way of handling smaller discards, we need to ensure they can't be set. I'm also kinda curious what actually sets a user limit in Ted's case as that feels weird.