Hi forks, This RFC patchset mainly addresses the thoughts [*] and [**] from Dave's original patchset, https://lore.kernel.org/r/20200623095015.1934171-1-david@xxxxxxxxxxxxx In short, it focues on the following ideas mentioned by Dave: - use bucket 0 instead of multiple buckets since in-memory double linked list finally works; - avoid taking AGI buffer and unnecessary AGI update if possible, so 1) add a new lock and keep proper locking order to avoid deadlock; 2) insert a new unlinked inode from the tail instead of head; In addition, it's worth noticing 3 things: - xfs_iunlink_remove() should support old multiple buckets in order to keep old inode unlinked list (old image) working when recovering. - (but) OTOH, the old kernel recovery _shouldn't_ work with new image since the bucket_index from old xfs_iunlink_remove() is generated by the old formula (rather than keep in xfs_inode), which is now fixed as 0. So this feature is not forward compatible without some extra backport patches; - a tail xfs_inode pointer is also added in the perag, which keeps track of the tail of bucket 0 since it's mainly used for xfs_iunlink(). - the old kernel recovery shouldn't work with new image since its bucket_index from old kernel is The git tree is also available at git://git.kernel.org/pub/scm/linux/kernel/git/xiang/linux.git tags/xfs/iunlink_opt_v1 Some limited test for debugging only is done (mainly fsstress and manual power-cut tests), so it could not work as expected just like my limited broken xfs knowledge. But I will go on improving this patchset recently. Any comments and directions are welcome. :) Thanks, Gao Xiang Gao Xiang (2): xfs: arrange all unlinked inodes into one list xfs: don't access AGI on unlinked inodes if it can fs/xfs/xfs_inode.c | 283 ++++++++++++++++++++------------------- fs/xfs/xfs_log_recover.c | 6 + fs/xfs/xfs_mount.c | 3 + fs/xfs/xfs_mount.h | 3 + 4 files changed, 160 insertions(+), 135 deletions(-) -- 2.18.1