Skip to content

ext4: Speedup orphan file handling

Jan Kara linux-ext4 5 versions – Applied

Status from this message: Thanks, applied.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest5 patches 7 repliesApplied
  2. v65 patches 1 replySuperseded
  3. v55 patches 7 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v45 patches4 repliesSuperseded
v34 patches9 repliesSuperseded

Changes in v7 from the cover letter

* Rebased on top of v5.14-rc6 + patches fixing exposure of hidden inodes in directory hierarchy
* Added check orphan file cannot be linked from directory hierarchy
* Get orphan file inode with EXT4_IGET_SPECIAL flag

Patches in v7 Applied

#Subject and filesSizeRepliesApplied
1/5ext4: Support for checksumming from journal triggersfs/ext4/ext4.h fs/ext4/ext4_jbd2.c fs/ext4/ext4_jbd2.h +13 more+259 -1280 replies
2/5ext4: Move orphan inode handling into a separate filefs/ext4/Makefile fs/ext4/ext4.h fs/ext4/namei.c +2 more+375 -3630 replies
3/5ext4: Speedup ext4 orphan inode handlingfs/ext4/ext4.h fs/ext4/inode.c fs/ext4/orphan.c +1 more+394 -520 replies
4/5ext4: Orphan file documentationDocumentation/filesystems/ext4/globals.rst Documentation/filesystems/ext4/inodes.rst Documentation/filesystems/ext4/orphan.rst +2 more+89 -60 replies
5/5ext4: Improve scalability of ext4 orphan file handlingfs/ext4/ext4.h fs/ext4/orphan.c+53 -270 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchTheodore Ts'oLukas CzernerAndreas Dilger
1/5R-b
2/5R-b R-b
3/5R-b
4/5R-b
5/5R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v7 thread

Cover letter [PATCH 0/5 v7] ext4: Speedup orphan file handling

Hello,

Here is the seventh version of my series to speed up orphan inode handling in ext4. I've forgot to add a check that orphan file is not exposed in directory hierarchy. The only change in this version is addition of that fix.

Orphan inode handling in ext4 is a bottleneck for workloads which heavily excercise truncate / unlink of small files as they contend on global s_orphan_mutex (when you have fast enough storage). This patch set implements new way of handling orphan inodes - instead of using a linked list, we store inode numbers of orphaned inodes in a file which is possible to implement in a more scalable manner than linked list manipulations. See description of patch 3/5 for more details.

The patch set achieves significant gains both for a micro benchmark stressing orphan inode handling (truncating file byte-by-byte, several threads in parallel) and for reaim creat_clo workload. I'm happy for any review, thoughts, ideas about the patches. I have also implemented full support in e2fsprogs which I'll send separately.

Honza

[1] https://lore.kernel.org/lkml/20210227120804.GB22871@xsang-OptiPlex-9020/

Changes since v6:
* Rebased on top of v5.14-rc6 + patches fixing exposure of hidden inodes in directory hierarchy
* Added check orphan file cannot be linked from directory hierarchy
* Get orphan file inode with EXT4_IGET_SPECIAL flag

Changes since v5:
* Added Reviewed-by tags from Ted
* Fixed up sparse warning spotted by 0-day
* Fixed error handling path in ext4_orphan_add() to not leak orphan entry

Changes since v4:
* Rebased on top of v5.14-rc5
* Updated commit message of patch 1/5
* Added Reviewed-by tags from Ted

Changes since v3:
* Added documentation about on-disk format changes
* Add physical block number into orphan block checksum
* Improve some sanity checks, handling of corrupted orphan file
* Improved some changelogs

Changes since v2:
* Updated some comments
* Rebased onto 5.13-rc5
* Change orphan file inode from a fixed inode number to inode number stored in the superblock

Changes since v1:
* orphan blocks have now magic numbers
* split out orphan handling to a separate source file
* some smaller updates according to review

Previous versions: