Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1692875rdd; Thu, 11 Jan 2024 06:46:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEiOYuqqhfbEXq0ge4NXs3WAxEHJIHuygxvd7NFecqaEWN09/OesKI7Jba0B3bH7/pbFn+3 X-Received: by 2002:a17:907:517:b0:a26:e4ec:b6ca with SMTP id wj23-20020a170907051700b00a26e4ecb6camr528746ejb.92.1704984368667; Thu, 11 Jan 2024 06:46:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704984368; cv=none; d=google.com; s=arc-20160816; b=mV19J2RBdFbAfc9ZjG7XNalPr1jy2O2PsCPKSLd8Rar0xqvYPAQ57BFq5sUQ1Fey+w P9a3oagz9MICrWEc4+K38ZQ1fgR8cnhOcVLnE4YfWs93vh7ew6/SEY7+qae28M0H0x0H dh0MjHaw9jcwMYd6/ciczh1Rwr47Df36rRnsV+68Djmu1jBr4QHZ2ikn1R0+DMk8UECY d0aa4kOo2okH6/ivtRfSa0/hFGb2wwLje27O4eGkNBG6R2oFYigAwt7zkR0877onvZmz M8H31nxQRXDleDerfU8Gw11GSN9gXaI1vz89Zuu5baqovKPRmSg06MDu8G0qq/WLjdF7 OS+g== ARC-Message-Signature: i=1; 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=yzRCvlsTRGnFzhLrpDej9blmMSAiS/7ddLOHv3Y+1vE=; fh=0JBwPAvmw/CoYJXkESbcZb/xSyhS+2+H3qemEDrBPR0=; b=Q3l7qDTgpwoWE2rw/jMmxLYEwsxqec8wNGUw8sr/EsM97FCS6+SCBLcbaGwAKCsHat Hna69q/NtcitLpT29zYg+2V8nItyhFhgT0d4n7Rmr9XuAlnUlOAZFWmzGAQHb7uivSF7 nAw3Fj2g3+KPW3zyrOBl1t903QeD9k9NgfxiNjScH/ZtCKLHky9ejnBZwo4WCYynNzPI /j4C4iNkogCSAtF9rd4sAqfofsnl0nhQhDWJEmMqPrX6DTaIdTw9uCYfqS1cvhtxRZdn 02Fw7KLKVTkdEYIvGlsPeh6TR2uOvqqaSj8qQyLqnSRV55fzw9rC5fYrcreB+a7d2+3p 6pQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-23728-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23728-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id dt23-20020a170906b79700b00a2c35568f8dsi578129ejb.781.2024.01.11.06.46.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 06:46:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23728-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-23728-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23728-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 6D72C1F21021 for ; Thu, 11 Jan 2024 14:46:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 827254BAA7; Thu, 11 Jan 2024 14:45:48 +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 AB92D3BB29; Thu, 11 Jan 2024 14:45:45 +0000 (UTC) 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 783DE68CFE; Thu, 11 Jan 2024 15:45:38 +0100 (CET) Date: Thu, 11 Jan 2024 15:45:37 +0100 From: Christoph Hellwig To: John Garry Cc: Christoph Hellwig , "Darrick J. Wong" , Dave Chinner , axboe@kernel.dk, kbusch@kernel.org, sagi@grimberg.me, jejb@linux.ibm.com, martin.petersen@oracle.com, 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, ming.lei@redhat.com, bvanassche@acm.org, ojaswin@linux.ibm.com Subject: Re: [PATCH v2 00/16] block atomic writes Message-ID: <20240111144537.GA9295@lst.de> References: <76c85021-dd9e-49e3-80e3-25a17c7ca455@oracle.com> <20231219151759.GA4468@lst.de> <20231221065031.GA25778@lst.de> <73d03703-6c57-424a-80ea-965e636c34d6@oracle.com> <20240110091929.GA31003@lst.de> <20240111014056.GL722975@frogsfrogsfrogs> <20240111050257.GA4457@lst.de> 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 Thu, Jan 11, 2024 at 09:55:36AM +0000, John Garry wrote: > On 11/01/2024 05:02, Christoph Hellwig wrote: >> On Wed, Jan 10, 2024 at 05:40:56PM -0800, Darrick J. Wong wrote: >>> struct statx statx; >>> struct fsxattr fsxattr; >>> int fd = open('/foofile', O_RDWR | O_DIRECT); > > I'm assuming O_CREAT also. Yes. >> I think this still needs a check if the fs needs alignment for >> atomic writes at all. i.e. >> >> struct statx statx; >> struct fsxattr fsxattr; >> int fd = open('/foofile', O_RDWR | O_DIRECT); >> >> ioctl(fd, FS_IOC_GETXATTR, &fsxattr); >> statx(fd, "", AT_EMPTY_PATH, STATX_ALL | STATX_WRITE_ATOMIC, &statx); >> if (statx.stx_atomic_write_unit_max < 16384) { >> bailout(); >> } > > How could this value be >= 16384 initially? Would it be from pre-configured > FS alignment, like XFS RT extsize? Or is this from some special CoW-based > atomic write support? Or FS block size of 16384? Sorry, this check should not be here at all, we should only check it later. > Incidentally, for consistency only setting FS_XFLAG_WRITE_ATOMIC will lead > to FMODE_CAN_ATOMIC_WRITE being set. So until FS_XFLAG_WRITE_ATOMIC is set > would it make sense to have statx return 0 for STATX_WRITE_ATOMIC. True. We might need to report the limits even without that, though.