Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1591715rdb; Tue, 20 Feb 2024 00:23:12 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVSFE9vrkCwN88YcRVc+nB5zBObXHN0aCWFqLhsvrL+N6yekhVCSQ4vxffqpffZW5ltD+VpCiuCamilKuFbkBKIToZMmpNheQ5z+yG0Hw== X-Google-Smtp-Source: AGHT+IFnELqUXmTiNcnlINSyo+NI9j1raADt/7WaT6FRdg8J/AXvoP05gYvSSjoxJOOHBdyD06Qa X-Received: by 2002:a05:6402:718:b0:564:a820:d87 with SMTP id w24-20020a056402071800b00564a8200d87mr1995873edx.0.1708417392149; Tue, 20 Feb 2024 00:23:12 -0800 (PST) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ec21-20020a0564020d5500b00563e0cb998fsi3341898edb.113.2024.02.20.00.23.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 00:23:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72538-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-72538-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72538-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 am.mirrors.kernel.org (Postfix) with ESMTPS id E39AD1F21477 for ; Tue, 20 Feb 2024 08:23:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F9A45CDCC; Tue, 20 Feb 2024 08:22:54 +0000 (UTC) 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 EECD45BAE4; Tue, 20 Feb 2024 08:22:51 +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=1708417373; cv=none; b=LNozJekuQbv625gKsv+FTCUBvvApBJBZKC+8/c8iSM49kK+djBb+BHgjyJdsFmWDZKHLIytXJ6CAQ1uwpixAL1ClrN3SwcMjBPhM82XLtPBL+xQ0LcX/NToXh1rm1eGprymcV1cw66S+OM+e/swCcSFA5nnISUl8BlnV/0wg8/8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708417373; c=relaxed/simple; bh=xcBFurX3UmQ0rxHVywfl4AduS/GQVMII1hz9dAXtgO0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GmCZH/1h5H+kIFE71LVL6WnvgW9723FtZDVNzMP2TXt26quG/S5WGkxbG8OSqSkwebJzJgjQw11BUks0rqvpeT2GpLcyGgh33KuGPS4dmbZtzdEimCY5li65BbgdzNsLSYBRrGV1YaaE0v9esyJ8RvJo5VnxKvc+3KaEOFHeo2c= 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 B616D68CFE; Tue, 20 Feb 2024 09:22:45 +0100 (CET) Date: Tue, 20 Feb 2024 09:22:45 +0100 From: Christoph Hellwig To: Dave Chinner Cc: John Garry , axboe@kernel.dk, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me, jejb@linux.ibm.com, martin.petersen@oracle.com, djwong@kernel.org, viro@zeniv.linux.org.uk, brauner@kernel.org, dchinner@redhat.com, jack@suse.cz, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org, tytso@mit.edu, jbongio@google.com, linux-scsi@vger.kernel.org, ojaswin@linux.ibm.com, linux-aio@kvack.org, linux-btrfs@vger.kernel.org, io-uring@vger.kernel.org, nilay@linux.ibm.com, ritesh.list@gmail.com Subject: Re: [PATCH v4 05/11] block: Add core atomic write support Message-ID: <20240220082245.GB13785@lst.de> References: <20240219130109.341523-1-john.g.garry@oracle.com> <20240219130109.341523-6-john.g.garry@oracle.com> Precedence: bulk X-Mailing-List: linux-kernel@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 Tue, Feb 20, 2024 at 09:58:39AM +1100, Dave Chinner wrote: > > + lim->atomic_write_hw_max_sectors = 0; > > + lim->atomic_write_max_sectors = 0; > > + lim->atomic_write_hw_boundary_sectors = 0; > > + lim->atomic_write_hw_unit_min_sectors = 0; > > + lim->atomic_write_unit_min_sectors = 0; > > + lim->atomic_write_hw_unit_max_sectors = 0; > > + lim->atomic_write_unit_max_sectors = 0; > > } > > Seems to me this function would do better to just > > memset(lim, 0, sizeof(*lim)); > > and then set all the non-zero fields. . which the caller already has done :) In the block tree this function looks completely different now and relies on the caller provided zeroing. > > +void blk_queue_atomic_write_max_bytes(struct request_queue *q, > > + unsigned int bytes) > > +{ > > + q->limits.atomic_write_hw_max_sectors = bytes >> SECTOR_SHIFT; > > + blk_atomic_writes_update_limits(q); > > +} > > +EXPORT_SYMBOL(blk_queue_atomic_write_max_bytes); > > Ok, so this can silently set a limit that is different to what the > caller asked to have set? > > How is the caller supposed to find this out if the smaller limit > that was set is not compatible with their configuration? > > i.e. shouldn't this return an error if the requested size cannot > be set exactly as specified? That's how the blk limits all work. The driver provides the hardware capabilities for a given value, and the block layer ensures it works with other limits imposed by the block layer or other parts of the device limits.