Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5994016rdb; Thu, 14 Dec 2023 05:47:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGKhErmu8dBghoGEMA2JbBdth6rlHKN8k121AiYsAtkdjOhZd7DIZYhkGy6XFx8CWIqfevj X-Received: by 2002:a17:902:eb88:b0:1d0:265:6a2c with SMTP id q8-20020a170902eb8800b001d002656a2cmr11680316plg.11.1702561673094; Thu, 14 Dec 2023 05:47:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702561673; cv=none; d=google.com; s=arc-20160816; b=ExfnjQcM0WdAHOUcprnY1emYrXx85HPhGkWmGlrcwLMqN8IizGLEVzfNqZuC74bMt2 GSwcWOPB1+gCnt2BaCf3TvD0RtbxdSyxpWScHp1kU7qxMM72BSNdkQqBM356ttlACqda jNR45A5HK7vks4YmrwfBpnnRtb4OlFwI1ggNDq2fkcFGmZKV75zNC3S4oTwGgJilt5K8 YvtYjxpdZGQTg+b48hIynG6+inYBuHjCjMCD5KTtDVThzEcjqXTlj6xJ++PXRSmN7RMT VXBfWtlbTr6OlZFWmnB7j4bfNfc6yQVVAbUHFLEJf/IKfpzz0DODpW8TkmYOdfmm2Fb0 w4jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QMlqSzMLtoLhUA6/pSOLSiY6ne++uxerHVPAdydtEYo=; fh=knvethQhiMIc3bpN6bFkMfcaC9//xeI+JtRGWJGvyis=; b=CRsMB1KTxdYRhB1ZXMm0dGYzz0QDA2TvEDY5OyesrJ/LRJsa5pQhZmwY0jJ0SUoBA3 TgXk8x+f/Z0yrziWP4RRQxieSgcNMaw7XlBhHPyEmuc7d9nq93+Tw88Z6idqrUCwO4mt /VHAmvjtCmbhL/GGydYuTPvAMIqt2kyGQru4tkezGEtbo0JfshxlBq9qw9lYUje6IwDY yWLc4zJHDNb2rN6UGpDrJCQLtR7Q4Jr3vISJSFYxMB5jAxitS/gB24TH+YsUdD3hhZI5 AkSsJhcmVgIoHtyU0V35sTBfYNRtYxtOimOdzQ9VjbNGCKz0vnkvQZIA43ELamGs5BhR 6LFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fiMUfyUK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id f1-20020a17090274c100b001d056d38cf4si430672plt.625.2023.12.14.05.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 05:47:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fiMUfyUK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9E81380747B4; Thu, 14 Dec 2023 05:46:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229851AbjLNNqV (ORCPT + 99 others); Thu, 14 Dec 2023 08:46:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229922AbjLNNqT (ORCPT ); Thu, 14 Dec 2023 08:46:19 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19918CF for ; Thu, 14 Dec 2023 05:46:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702561585; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QMlqSzMLtoLhUA6/pSOLSiY6ne++uxerHVPAdydtEYo=; b=fiMUfyUKsp+4F4PwDfNafkGuWkOhKDQgsDaxSWV1T4pwNaEh80ZKoYOr1t5Lm3+aw/qMR2 PUGDmH4jxQ4taFMlgw0YIliQAFl3visG0B52dv6fkRmiLYHqzvAoUbSMyat/gKaI/dZLEj n4BMrK5EjsktaGE4rq7TDZL1ndheCs8= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-457-Yr6iln9QPreJK0NkIMKRvw-1; Thu, 14 Dec 2023 08:46:21 -0500 X-MC-Unique: Yr6iln9QPreJK0NkIMKRvw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 514D328040B2; Thu, 14 Dec 2023 13:46:19 +0000 (UTC) Received: from fedora (unknown [10.72.116.126]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 006DAC15968; Thu, 14 Dec 2023 13:46:08 +0000 (UTC) Date: Thu, 14 Dec 2023 21:46:04 +0800 From: Ming Lei To: "Martin K. Petersen" Cc: John Garry , axboe@kernel.dk, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me, jejb@linux.ibm.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-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, tytso@mit.edu, jbongio@google.com, linux-scsi@vger.kernel.org, jaswin@linux.ibm.com, bvanassche@acm.org, Himanshu Madhani , ming.lei@redhat.com Subject: Re: [PATCH v2 01/16] block: Add atomic write operations to request_queue limits Message-ID: References: <20231212110844.19698-1-john.g.garry@oracle.com> <20231212110844.19698-2-john.g.garry@oracle.com> <36ee54b4-b8d5-4b3c-81a0-cc824b6ef68e@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 14 Dec 2023 05:46:31 -0800 (PST) Hi Martin, On Wed, Dec 13, 2023 at 11:38:10PM -0500, Martin K. Petersen wrote: > > Ming, On Thu, Dec 14, 2023 at 12:35 PM Martin K. Petersen wrote: > > > Hi Ming! > > >> +    lim->atomic_write_unit_min_sectors = 0; > >> +    lim->atomic_write_unit_max_sectors = 0; > >> +    lim->atomic_write_max_sectors = 0; > >> +    lim->atomic_write_boundary_sectors = 0; > > > > Can we move the four into single structure and setup them in single > > API? Then cross-validation can be done in this API. > > Why would we put them in a separate struct? We don't do that for any of > the other queue_limits. All the four limits are for same purpose of supporting atomic-write, and there can many benefits to define single API to setup atomic parameters: 1) common logic can be put into single place, such as running cross-validation among them and setting up default value, and it is impossible to do that by the way in this patch 2) all limits are supposed to setup once by driver in same place, so doing them in single API actually simplifies driver and block layer, and API itself becomes less fragile 3) it is easier for trace or troubleshoot > > > Relying on driver to provide sound value is absolutely bad design from > > API viewpoint. > > All the other queue_limits are validated by the LLDs. It's challenging > to lift that validation to the block layer since the values reported are > heavily protocol-dependent and After atomic limits are put into block layer, it becomes not driver specific any more, scsi and nvme are going to support it first, sooner or later, other drivers(dm & md, loop or ublk, ...) may try to support it. Also in theory, they are not protocol-dependent, usually physical block size is the minimized atomic-write unit, now John's patches are trying to support bigger atomic-write unit as scsi/nvme's protocol supports it, and the concept is actually common in disk. Similar in implementation level too, such as, for NAND flash based storage, I guess atomic-write should be supported by atomic update of FTL's LBA/PBA mapping. > thus information is lost if we do it somewhere else. Block layer is only focusing on common logic, such as the four limits added in request queue, which are consumed by block layer and related with other generic limits(physical block size, max IO size), and it won't be same with driver's internal validation. Thanks, Ming