Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

hbirth
Copy link
Collaborator

@hbirth hbirth commented Aug 4, 2025

add an option to communicate alignment from the fuse server to the kernel and the kernel to obey alignment set by the fuse server.
Note that the writepage code in the kernel can only work restrictively (basically deciding, that it has to write out the buffer this call to fuse_writepages_fill).

This patch will check against the wbc range_end if we can write another aligned block and write out the buffer if not.
This will lead to write operations that will end on an aligned boundary. And then have a smaller write operation at the end that starts on an aligned boundary.

This patch will also check if we can write another aligned buffer until we hit the max_pages limit. This happens a lot when we don't start on an aligned position the max_pages will also be unaligned and that leads to almost the complete write process will be unaligned.

The patch cannot ensure aligned writes but it will keep the write operations as aligned as the mm write cache operation allows.

@hbirth hbirth force-pushed the redfs-ubuntu-aligned-writes branch from 907ac17 to a2db6ee Compare August 6, 2025 11:17
Sometimes the file offset alignment needs to be opt-in to achieve the
optimum performance at the backend store.

For example when ErasureCode [1] is used at the backend store, the
optimum write performance is achieved when the WRITE request is aligned
with the stripe size of ErasureCode.  Otherwise a non-aligned WRITE
request needs to be split at the stripe size boundary.  It is quite
costly to handle these split partial requests, as firstly the whole
stripe to which the split partial request belongs needs to be read out,
then overwrite the read stripe buffer with the request, and finally write
the whole stripe back to the persistent storage.

Thus the backend store can suffer severe performance degradation when
WRITE requests can not fit into one stripe exactly.  The write performance
can be 10x slower when the request is 256KB in size given 4MB stripe size.
Also there can be 50% performance degradation in theory if the request
is not stripe boundary aligned.

Besides, the conveyed test indicates that, the non-alignment issue
becomes more severe when decreasing fuse's max_ratio, maybe partly
because the background writeback now is more likely to run parallelly
with the dirtier.

fuse's max_ratio	ratio of aligned WRITE requests
----------------	-------------------------------
70			99.9%
40			74%
20			45%
10			20%

With the patched version, which makes the alignment constraint opt-in
when constructing WRITE requests, the ratio of aligned WRITE requests
increases to 98% (previously 20%) when fuse's max_ratio is 10.

fuse: fix alignment to work with redfs ubuntu

- small fix to make the fuse alignment patch work with redfs ubuntu 6.8.x
- add writeback_control to fuse_writepage_need_send() to make
more accurate decisions about when to skip sending data
- fix shift number for FUSE_ALIGN_PG_ORDER
- remove test code

[1] https://lore.kernel.org/linux-fsdevel/[email protected]/T/#m9bce469998ea6e4f911555c6f7be1e077ce3d8b4
Signed-off-by: Jingbo Xu <[email protected]>
Signed-off-by: Bernd Schubert <[email protected]>
Signed-off-by: Horst Birthelmer <[email protected]>
@hbirth hbirth force-pushed the redfs-ubuntu-aligned-writes branch from a2db6ee to 5e590a6 Compare August 8, 2025 11:28
@bsbernd bsbernd merged commit e743b01 into DDNStorage:redfs-ubuntu-noble-6.8.0-58.60 Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants