Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1120418iog; Mon, 13 Jun 2022 22:29:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tJpOqBcSd9gf3tbxMdL32azu+7tKFdbEUCALwHQNBmBzPNy+Em//XKAHl1nBv2v7BVDP8a X-Received: by 2002:a17:907:9496:b0:711:f459:664 with SMTP id dm22-20020a170907949600b00711f4590664mr2655435ejc.704.1655184555450; Mon, 13 Jun 2022 22:29:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655184555; cv=none; d=google.com; s=arc-20160816; b=lwnNKME3JIrAv1cN4XfwuADU5r92cVDrhSdmocEg/LMte/k8h7rhPKlCkRI2a364X3 I/frUHofskC9QtFB/KYffQHfojTEjz1qos23+qddcxDdwKjuQ1OkuPicbRq94eC2le0m ++AWebUuT51I1cANj62aSQzx8BvnqYS3RYIKDlJjyF8ZCCKjL1v3qstFAfsJDRW6eQn9 3m2iTpwROfcPMl2qyeIWTf0s+FQFpTASvEvizw04rVn3XhZOuyIzxLyYNt4Y3LtKBODK TsYeOSL6vtcNQw+2Lyk6gGue44gmBEpkJDknkj3gWreSHEdL1ry37ctaV7AVfqsYcTUu fR7A== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dXfurU28sLHzeCbvqjuLN38AwqiSQGSBuu39ysOpKC8=; b=HLkdu/vO8VArTHbJ/AOySPsXp/5eupxF/WTS3oVEs5tmbQrtXMioewVdXGne3ldBPC wzBcN2t291QmeDemHrEZ0Xt30KQfI2++1RddMD7RLGV6fiTlQ3ZfEzoMx7aMIEJWBkDh i4Zy/Z89g0OKMCXebwnqNziqEy4ZLfTo1CD2BaeXuZkAzgxkvybIqYWAfkgfoXyMvaxX MiavdJfkhLp7bO8NaeYlL15Pq57SIx0oZCaF5CIjFV8IJBpAgojAdwMu4P8mYxA+T88D 2lHxi4SnEIZ5He6UHxwNKBNZePbvDUUEsG/5tRDhr2xgmfw8LgzLfp8WrRu8kH4C/Rsc asRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="V3vMc4a/"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i18-20020a1709064fd200b007165339eb02si7108869ejw.75.2022.06.13.22.28.46; Mon, 13 Jun 2022 22:29:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="V3vMc4a/"; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237697AbiFNFZW (ORCPT + 99 others); Tue, 14 Jun 2022 01:25:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232427AbiFNFZW (ORCPT ); Tue, 14 Jun 2022 01:25:22 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFDDB26AC4; Mon, 13 Jun 2022 22:25:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 15EF6CE181B; Tue, 14 Jun 2022 05:25:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9603C3411B; Tue, 14 Jun 2022 05:25:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655184315; bh=yVv5NBSoS8jRKy5ozRnvXgCu1M0fCe/nJRys6szNJx8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=V3vMc4a/nCEXDbFNP/4wKJ/IRtOdNoppRm3KT6glab4LkOZA75EmhzGbtaA1xJ+t3 zvkLdo81p05dnXKT+qKQuo6DrZwA4lYN2s4XqyUV53L250GdKda6QGguEubwN+2Tiu d4A9dR7WcBIqi94WqvepH+Mo3dRm4pzTy62UhK2d0tWAEz0EaNQA/qG3VSjqGh/ZGP BfUQkMRf8IKtoMh07F+Bm4ksrN2SWxyqmzziAxnkoynG7uOflh+qdDkUkyMvYFq2EJ VUGOVK9SwNY9c0UT3JGvInxETeshxNeq+5qJGUa9Q4x+rKmPDCLKDNxg8c1GJk61r1 KqP5kl72VRMGw== Date: Mon, 13 Jun 2022 22:25:12 -0700 From: Eric Biggers To: Dave Chinner Cc: "Darrick J. Wong" , linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-xfs@vger.kernel.org, linux-api@vger.kernel.org, linux-fscrypt@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Keith Busch Subject: Re: [RFC PATCH v2 1/7] statx: add I/O alignment information Message-ID: References: <20220518235011.153058-1-ebiggers@kernel.org> <20220518235011.153058-2-ebiggers@kernel.org> <20220520032739.GB1098723@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220520032739.GB1098723@dread.disaster.area> X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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-ext4@vger.kernel.org On Fri, May 20, 2022 at 01:27:39PM +1000, Dave Chinner wrote: > > > * stx_offset_align_optimal: the alignment (in bytes) suggested for file > > > offsets and I/O segment lengths to get optimal performance. This > > > applies to both DIO and buffered I/O. It differs from stx_blocksize > > > in that stx_offset_align_optimal will contain the real optimum I/O > > > size, which may be a large value. In contrast, for compatibility > > > reasons stx_blocksize is the minimum size needed to avoid page cache > > > read/write/modify cycles, which may be much smaller than the optimum > > > I/O size. For more details about the motivation for this field, see > > > https://lore.kernel.org/r/20220210040304.GM59729@dread.disaster.area > > > > Hmm. So I guess this is supposed to be the filesystem's best guess at > > the IO size that will minimize RMW cycles in the entire stack? i.e. if > > the user does not want RMW of pagecache pages, of file allocation units > > (if COW is enabled), of RAID stripes, or in the storage itself, then it > > should ensure that all IOs are aligned to this value? > > > > I guess that means for XFS it's effectively max(pagesize, i_blocksize, > > bdev io_opt, sb_width, and (pretend XFS can reflink the realtime volume) > > the rt extent size)? I didn't see a manpage update for statx(2) but > > that's mostly what I'm interested in. :) > > Yup, xfs_stat_blksize() should give a good idea of what we should > do. It will end up being pretty much that, except without the need > to a mount option to turn on the sunit/swidth return, and always > taking into consideration extent size hints rather than just doing > that for RT inodes... While working on the man-pages update, I'm having second thoughts about the stx_offset_align_optimal field. Does any filesystem other than XFS actually want stx_offset_align_optimal, when st[x]_blksize already exists? Many network filesystems, as well as tmpfs when hugepages are enabled, already report large (megabytes) sizes in st[x]_blksize. And all documentation I looked at (man pages for Linux, POSIX, FreeBSD, NetBSD, macOS) documents st_blksize as something like "the preferred blocksize for efficient I/O". It's never documented as being limited to PAGE_SIZE, which makes sense because it's not. So stx_offset_align_optimal seems redundant, and it is going to confuse application developers who will have to decide when to use st[x]_blksize and when to use stx_offset_align_optimal. Also, applications that don't work well with huge reported optimal I/O sizes would still continue to exist, as it will remain possible for applications to only be tested on filesystems that report a small optimal I/O size. Perhaps for now we should just add STATX_DIOALIGN instead of STATX_IOALIGN, leaving out the stx_offset_align_optimal field? What do people think? - Eric