Re: [RFC] ext4: Add support for ext4_map_blocks_atomic()

Ritesh Harjani
2024-03-14T15:52:28Z

John Garry <john.g.garry@oracle.com> writes:

> On 08/03/2024 20:25, Ritesh Harjani (IBM) wrote:
>
> Hi Ritesh,
>
>> Currently ext4 exposes [fsawu_min, fsawu_max] size as
>> [blocksize, clustersize] (given the hw block device constraints are
>> larger than FS atomic write units).
>>
>> That means a user should be allowed to -
>> 1. pwrite 0 4k /mnt/test/f1
>> 2. pwrite 0 16k /mnt/test/f1
>>
>
> Previously you have mentioned 2 or 3 methods in which ext4 could support
> atomic writes. To avoid doubt, is this patch for the "Add intelligence
> in multi-block allocator of ext4 to provide aligned allocations (this
> option won't require any formatting)" method mentioned at
> https://lore.kernel.org/linux-fsdevel/8734tb0xx7.fsf@doe.com/
>
> and same as method 3 at
> https://lore.kernel.org/linux-fsdevel/cover.1709356594.git.ritesh.list@gmail.com/?

Hi John,

No. So this particular patch to add ext4_map_blocks_atomic() method is
only to support the usecase which you listed should work for a good user
behaviour. This is because, with bigalloc we advertizes fsawu_min and
fsawu_max as [blocksize, clustersize]
i.e.

That means a user should be allowed to -
1. pwrite 0 4k /mnt/test/f1
followed by
2. pwrite 0 16k /mnt/test/f1

So earlier we were failing the second 16k write at an offset where there
is already an existing extent smaller that 16k (that was because of the
assumption that the most of the users won't do such a thing).

But for a more general usecase, it is not difficult to support the
second 16k write in such a way for atomic writes with bigalloc,
so this patch just adds that support to this series.

-ritesh

>
>
> Thanks,
> John