Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp149195rdb; Thu, 5 Oct 2023 21:32:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH983M/6rRDBSOwQ64gsgYqLFXcFZZBiZOaQ4nHt6BUu96msi7GQj6mlGrClj9LBEIylz3+ X-Received: by 2002:a05:6a20:ce8f:b0:152:cb38:5b47 with SMTP id if15-20020a056a20ce8f00b00152cb385b47mr6729005pzb.55.1696566751193; Thu, 05 Oct 2023 21:32:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696566751; cv=none; d=google.com; s=arc-20160816; b=sq8u0xNzVMZl0TORM1qmra8GK0L+hDCwRk2EOl8qBMTO5ghO05dshwFK3IN6NWSPMo YobMKTLzCDvj6Fev6swylrSiGyS7/ykI52kSsLUNGumhw8+HuW3X5vDyFw6fR+brYyIM Bb2zOFSl34FQAPX/TQ/S2fw0TGkFG1bj043B3beXyjtJKWrcbxFSKmFcaV7Yf2WUhqP9 NFNGsfpAU7iZYWyZZ9zjor3f9mTdhRjJUa+TbX39/cvW/gAe43hm5xqGcgtSw/VRjvcL 1K9QERqwkStjHGGqonFrLYYxJ5E8ZcTnSRsmKTS4AbQKuWPvM78dAAMErdIVZQDX3qCG 6G3Q== 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=ix+sRq4XQRGJaHRfH6WXpO9zrY7MmqagNFx/9Jnm3Cw=; fh=3/poCUNwWzvlD+VkllB01LLtNEHk7zUmpplaSRThMD4=; b=H2ym8w4u832zSC07GD1t+FE5qf1EIEBkws2mvWXK7ruOJrAlKpFmuSLB82AEK4xvms VswC83WlAjN1kRlhD01KGvKlAkTUREIJ3Sjcf09HF4eBONLWdkeZAShAeV6AcULXIUu3 vPsdFKSZ0hcNMUdVku2puc61PkNemXIF+DnKbj2nkeCswmU/Di3es2LZ/wHlO10dHNiO wQ8xkZyRwHW7w2s3ZxHHl7A7eACE/5MqhAjjYfDpFS+Kwgf4QG9x0NdS5tyxZ/fQrylf Kue9aInyxRLP6WDFibBGkTcN6NxSalsVVC1wR8aLkeVzEbDefLz5y9VI0vJTObbSdDH4 wqhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=1PXrH8VZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id cv9-20020a056a0044c900b0068fdeb84453si676824pfb.265.2023.10.05.21.32.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 21:32:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=1PXrH8VZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 40C388130FB2; Thu, 5 Oct 2023 21:32:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230039AbjJFEcJ (ORCPT + 99 others); Fri, 6 Oct 2023 00:32:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230048AbjJFEbo (ORCPT ); Fri, 6 Oct 2023 00:31:44 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F04011C for ; Thu, 5 Oct 2023 21:31:09 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-58907163519so1247048a12.1 for ; Thu, 05 Oct 2023 21:31:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20230601.gappssmtp.com; s=20230601; t=1696566669; x=1697171469; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ix+sRq4XQRGJaHRfH6WXpO9zrY7MmqagNFx/9Jnm3Cw=; b=1PXrH8VZnOblzuDC7aK/UG4BmUJT3RX2BSU2ovDIkmCEzmSbK9W2unlSLAt7RVfROA uk+A/E6ugLaxfW9A2XIFg3J2HEDzr8n6c2Aa17kn39z2vmedi082//EAkpShgfYAUSJl CydbxSDIB30+eGO0Da0ibs7g3KHtjrVZ8dQlY6dePodntI+1kNfJzL8U+iwhniC76fiX nwLztdRyyquTTwympjC0U8E4NJzkL/eB4XgzU43c6iiM3jtyBdZbOtRnfFmSAALGh7Sl aHvsMcP1x2wCPpxJ2lCLWZJ+qCTipRNUe8kEQnftAMToDeSR9VUp2Pqq89J2n5vMqJCC fDuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696566669; x=1697171469; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ix+sRq4XQRGJaHRfH6WXpO9zrY7MmqagNFx/9Jnm3Cw=; b=RE3KWn+ku6/+UGp64PM+1MtSa2iRNs+aJ9Iuhw9fq64f5kKpcbJPDDVdROz8d8UTsa qdpYBgTSMI4VgQeXtmRsJnEeriGieXisBCp0di8uQGMIyoC5OPhYIiQhLXeW1y46LMie MUG9mtPQsWDdvOU1yY4aMx1l1CnMthHELja0emtWgVtkPI5rf+C2vqXUC+2V6vhu0W9S pHrhEhbtcsT6BpATqk9rCze9Hjr6FIlU/1NTU1uiLF1+2ljipgMNJHuWf9tUFiimOS6m ydOKMn3e/lkkkBYXcxrRju723MYAmrjmXsNzwqqRFksIokPZ6W3SceqQG8HMvjCnKwrW bG8A== X-Gm-Message-State: AOJu0Yy/qBYshRnERjc9TgAMTYTXYRVHPKpVp5PF1QKbKKgPYegbYepu Lg4Ur4OC9A/Ndku173tX1kROGg== X-Received: by 2002:a05:6a20:1447:b0:14e:3daf:fdb9 with SMTP id a7-20020a056a20144700b0014e3daffdb9mr8351717pzi.22.1696566668815; Thu, 05 Oct 2023 21:31:08 -0700 (PDT) Received: from dread.disaster.area (pa49-180-20-59.pa.nsw.optusnet.com.au. [49.180.20.59]) by smtp.gmail.com with ESMTPSA id v9-20020a62a509000000b0069029a3196dsm427960pfm.184.2023.10.05.21.31.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 21:31:08 -0700 (PDT) Received: from dave by dread.disaster.area with local (Exim 4.96) (envelope-from ) id 1qocUT-00A4Ul-1m; Fri, 06 Oct 2023 15:31:05 +1100 Date: Fri, 6 Oct 2023 15:31:05 +1100 From: Dave Chinner To: Bart Van Assche Cc: "Martin K. Petersen" , 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, chandan.babu@oracle.com, dchinner@redhat.com, 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-api@vger.kernel.org Subject: Re: [PATCH 10/21] block: Add fops atomic write support Message-ID: References: <5d26fa3b-ec34-bc39-ecfe-4616a04977ca@oracle.com> <34c08488-a288-45f9-a28f-a514a408541d@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Thu, 05 Oct 2023 21:32:28 -0700 (PDT) On Thu, Oct 05, 2023 at 03:58:38PM -0700, Bart Van Assche wrote: > On 10/5/23 15:36, Dave Chinner wrote: > > $ lspci |grep -i nvme > > 03:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981/PM983 > > 06:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981/PM983 > > $ cat /sys/block/nvme*n1/queue/write_cache > > write back > > write back > > $ > > > > That they have volatile writeback caches.... > > It seems like what I wrote has been misunderstood completely. With > "handling a power failure cleanly" I meant that power cycling a block device > does not result in read errors nor in reading data that has never been written. Then I don't see what your concern is. Single sector writes are guaranteed atomic and have been for as long as I've worked in this game. OTOH, multi-sector writes are not guaranteed to be atomic - they can get torn on sector boundaries, but the individual sectors within that write are guaranteed to be all-or-nothing. Any hardware device that does not guarantee single sector write atomicity (i.e. tears in the middle of a sector) is, by definition, broken. And we all know that broken hardware means nothing in the storage stack works as it should, so I just don't see what point you are trying to make... > Although it is hard to find information about this topic, here is what I found > online: > * About certain SSDs with power loss protection: > https://us.transcend-info.com/embedded/technology/power-loss-protection-plp > * About another class of SSDs with power loss protection: > https://www.kingston.com/en/blog/servers-and-data-centers/ssd-power-loss-protection > * About yet another class of SSDs with power loss protection: > https://phisonblog.com/avoiding-ssd-data-loss-with-phisons-power-loss-protection-2/ Yup, devices that behave as if they have non-volatile write caches. Such devices have been around for more than 30 years, they operate the same as devices without caches at all. > So far I haven't found any information about hard disks and power failure > handling. What I found is that most current hard disks protect data with ECC. > The ECC mechanism should provide good protection against reading data that > has never been written. If a power failure occurs while a hard disk is writing > a physical block, can this result in a read error after power is restored? If > so, is this behavior allowed by storage standards? If a power fail results in read errors from the storage media being reported to the OS instead of the data that was present in the sector before the power failure, then the device is broken. If there is no data in the region being read because it has never been written, then it should return zeros (no data) rather than stale data or a media read error. -Dave. -- Dave Chinner david@fromorbit.com