From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-ext4@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>,
Jan Kara <jack@suse.cz>, John Garry <john.g.garry@oracle.com>,
Ojaswin Mujoo <ojaswin@linux.ibm.com>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v4 7/7] ext4: Add atomic block write documentation
Date: Thu, 15 May 2025 23:44:33 +0530 [thread overview]
Message-ID: <87r00pwxkm.fsf@gmail.com> (raw)
In-Reply-To: <20250515165836.GQ25655@frogsfrogsfrogs>
"Darrick J. Wong" <djwong@kernel.org> writes:
> On Thu, May 15, 2025 at 08:15:39PM +0530, Ritesh Harjani (IBM) wrote:
>> Add an initial documentation around atomic writes support in ext4.
>>
>> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
>> ---
>> .../filesystems/ext4/atomic_writes.rst | 220 ++++++++++++++++++
>> Documentation/filesystems/ext4/overview.rst | 1 +
>> 2 files changed, 221 insertions(+)
>> create mode 100644 Documentation/filesystems/ext4/atomic_writes.rst
>>
>> diff --git a/Documentation/filesystems/ext4/atomic_writes.rst b/Documentation/filesystems/ext4/atomic_writes.rst
>> new file mode 100644
>> index 000000000000..de54eeb6aaae
>> --- /dev/null
>> +++ b/Documentation/filesystems/ext4/atomic_writes.rst
>> @@ -0,0 +1,220 @@
>> +.. SPDX-License-Identifier: GPL-2.0
>> +.. _atomic_writes:
>> +
>> +Atomic Block Writes
>> +-------------------------
>> +
>> +Introduction
>> +~~~~~~~~~~~~
>> +
>> +Atomic (untorn) block writes ensure that either the entire write is committed
>> +to disk or none of it is. This prevents "torn writes" during power loss or
>> +system crashes. The ext4 filesystem supports atomic writes (only with Direct
>> +I/O) on regular files with extents, provided the underlying storage device
>> +supports hardware atomic writes. This is supported in the following two ways:
>> +
>> +1. **Single-fsblock Atomic Writes**:
>> + EXT4's supports atomic write operations with a single filesystem block since
>> + v6.13. In this the atomic write unit minimum and maximum sizes are both set
>> + to filesystem blocksize.
>> + e.g. doing atomic write of 16KB with 16KB filesystem blocksize on 64KB
>> + pagesize system is possible.
>> +
>> +2. **Multi-fsblock Atomic Writes with Bigalloc**:
>> + EXT4 now also supports atomic writes spanning multiple filesystem blocks
>> + using a feature known as bigalloc. The atomic write unit's minimum and
>> + maximum sizes are determined by the filesystem block size and cluster size,
>> + based on the underlying device’s supported atomic write unit limits.
>> +
>> +Requirements
>> +~~~~~~~~~~~~
>> +
>> +Basic requirements for atomic writes in ext4:
>> +
>> + 1. The extents feature must be enabled (default for ext4)
>> + 2. The underlying block device must support atomic writes
>> + 3. For single-fsblock atomic writes:
>> +
>> + 1. A filesystem with appropriate block size (up to the page size)
>> + 4. For multi-fsblock atomic writes:
>> +
>> + 1. The bigalloc feature must be enabled
>> + 2. The cluster size must be appropriately configured
>> +
>> +NOTE: EXT4 does not support software or COW based atomic write, which means
>> +atomic writes on ext4 are only supported if underlying storage device supports
>> +it.
>> +
>> +Multi-fsblock Implementation Details
>> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> +
>> +The bigalloc feature changes ext4 to allocate in units of multiple filesystem
>> +blocks, also known as clusters. With bigalloc each bit within block bitmap
>> +represents cluster (power of 2 number of blocks) rather than individual
>
> Nit: "...represents one cluster"
yup, will make that change.
>
> With that fixed,
> Acked-by: "Darrick J. Wong" <djwong@kernel.org>
>
Thanks!
-ritesh
> --D
>
prev parent reply other threads:[~2025-05-15 18:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-15 14:45 [PATCH v4 0/7] ext4: Add multi-fsblock atomic write support with bigalloc Ritesh Harjani (IBM)
2025-05-15 14:45 ` [PATCH v4 1/7] ext4: Document an edge case for overwrites Ritesh Harjani (IBM)
2025-05-15 14:45 ` [PATCH v4 2/7] ext4: Check if inode uses extents in ext4_inode_can_atomic_write() Ritesh Harjani (IBM)
2025-05-15 14:45 ` [PATCH v4 3/7] ext4: Make ext4_meta_trans_blocks() non-static for later use Ritesh Harjani (IBM)
2025-05-15 14:45 ` [PATCH v4 4/7] ext4: Add support for EXT4_GET_BLOCKS_QUERY_LEAF_BLOCKS Ritesh Harjani (IBM)
2025-05-15 16:54 ` Darrick J. Wong
2025-05-15 14:45 ` [PATCH v4 5/7] ext4: Add multi-fsblock atomic write support with bigalloc Ritesh Harjani (IBM)
2025-05-15 16:53 ` Darrick J. Wong
2025-05-15 18:15 ` Ritesh Harjani
2025-05-15 19:12 ` Darrick J. Wong
2025-05-15 14:45 ` [PATCH v4 6/7] ext4: Enable support for ext4 multi-fsblock atomic write using bigalloc Ritesh Harjani (IBM)
2025-05-15 14:45 ` [PATCH v4 7/7] ext4: Add atomic block write documentation Ritesh Harjani (IBM)
2025-05-15 16:58 ` Darrick J. Wong
2025-05-15 18:14 ` Ritesh Harjani [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r00pwxkm.fsf@gmail.com \
--to=ritesh.list@gmail.com \
--cc=djwong@kernel.org \
--cc=jack@suse.cz \
--cc=john.g.garry@oracle.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=ojaswin@linux.ibm.com \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox