Re: [PATCH v4 00/14] forcealign for xfs
From: IBM
Date: Wed Sep 04 2024 - 14:25:05 EST
John Garry <john.g.garry@xxxxxxxxxx> writes:
> This series is being spun off the block atomic writes for xfs series at
> [0].
>
> That series got too big.
>
> The actual forcealign patches are roughly the same in this series.
>
> Why forcealign?
> In some scenarios to may be required to guarantee extent alignment and
> granularity.
>
> For example, for atomic writes, the maximum atomic write unit size would
> be limited at the extent alignment and granularity, guaranteeing that an
> atomic write would not span data present in multiple extents.
>
> forcealign may be useful as a performance tuning optimization in other
> scenarios.
>
> I decided not to support forcealign for RT devices here. Initially I
> thought that it would be quite simple of implement. However, I discovered
> through much testing and subsequent debug that this was not true, so I
> decided to defer support to later.
>
> Early development xfsprogs support is at:
> https://github.com/johnpgarry/xfsprogs-dev/commits/atomic-writes/
>
Hi John,
Thanks for your continued work on atomic write.
I went over the XFS patch series and this is my understanding + some queries. Could you please help with these.
1. As I understand XFS untorn atomic write support is built on top of FORCEALIGN feature (which this series is adding) which in turn uses extsize hint feature underneath.
Now extsize hint mainly controls the alignment of both "physical start" & "logical start" offset and extent length, correct?
This is done using args->alignment for start aand args->prod/mode variables for extent length. Correct?
- If say we are not able to allocate an aligned physical start? Then since extsize is just a hint we go ahead with whatever best available extent is right?
- also extsize looks to be only providing allocation side of hints. (not de-allocation). Correct?
2. If say there is an append write i.e. the allocation is needed to be done at EOF. Then we try for an exact bno (from eof block) and aligned extent length, right?
i.e. xfs_bmap_btalloc_filestreams() -> xfs_bmap_btalloc_at_eof(ap, args);
If it is not available then we try for nearby bno xfs_alloc_vextent_near_bno(args, target) and similar...
3. It is the FORCEALIGN feature which _mandates_ both allocation (by using extsize hint) and de-allocation to happen _only_ in extsize chunks.
i.e. forcealign mandates -
- the logical and physical start offset should be aligned as per args->alignment
- extent length be aligned as per args->prod/mod.
If above two cannot be satisfied then return -ENOSPC.
- Does the unmapping of extents also only happens in extsize chunks (with forcealign)?
If the start or end of the extent which needs unmapping is unaligned then we convert that extent to unwritten and skip, is it? (__xfs_bunmapi())
This is a bit unclear to me. Maybe I need to look more deeper into the __xfs_bunmapi() while loop.
My knowledge about this is still limited so please ignore any silly questions.
-ritesh