summaryrefslogtreecommitdiff
tag namein-memory-btrees_2022-11-09 (dbc81de59c35a0706efebb36c3c8909129d0a5a3)
tag date2022-11-09 19:10:09 -0800
tagged byDarrick J. Wong <djwong@kernel.org>
tagged objectcommit 37c015cada...
xfs: support in-memory btrees
Online repair of the reverse-mapping btrees presens some unique challenges. To construct a new reverse mapping btree, we must scan the entire filesystem, but we cannot afford to quiesce the entire filesystem for the potentially lengthy scan. For rmap btrees, therefore, we relax our requirements of totally atomic repairs. Instead, repairs will scan all inodes, construct a new reverse mapping dataset, format a new btree, and commit it before anyone trips over the corruption. This is exactly the same strategy as was used in the quotacheck and nlink scanners. Unfortunately, the xfarray cannot perform key-based lookups and is therefore unsuitable for supporting live updates. Luckily, we already a data structure that maintains an indexed rmap recordset -- the existing rmap btree code! Hence we port the existing btree and buffer target code to be able to create a btree using the xfile we developed earlier. Live hooks keep the in-memory btree up to date for any resources that have already been scanned. This approach is not maximally memory efficient, but we can use the same rmap code that we do everywhere else, which provides improved stability without growing the code base even more. Note that in-memory btree blocks are always page sized. This patchset modifies the kernel xfs buffer cache to be capable of using a xfile (aka a shmem file) as a backing device. It then augments the btree code to support creating btree cursors with buffers that come from a buftarg other than the data device (namely an xfile-backed buftarg). For the userspace xfs buffer cache, we instead use a memfd or an O_TMPFILE file as a backing device. Signed-off-by: Darrick J. Wong <djwong@kernel.org> -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEUzaAxoMeQq6m2jMV+H93GTRKtOsFAmNsa5EACgkQ+H93GTRK tOtqtg/+PnpZIEvFg9cxzqCJaQpxgqhBboztaPeMLKWWYamOvdlnCxzQZfnj1vWw EtxTeXpryKKlF8LyMFT2Ej2h6AOfQFb8FTe1pvyfVPPDMZbwQO7ghKYYX9VePfwe EevWff46PHx3LKq/8jFPQESSUJs6389IOprFZPlKV0yZPuTiNWrRU8NYktQEti8H uRMLc4uxQ91o4YXoOFnbEX7ZieGEgbahPjM1ialxpjCATI1K86Z82Kube3llGCm2 FAEZkcq39NqV0KnCwef6XiYUNmJW/VtO4unL97/gMAC1+ujhGKiVW4pWwZq7z6vS t0ISU5lYVE4HZ5c7h02IXrZPOjXMfF9nuLIf6VyQ9mGqmiZVYJ+5BlWKyO+hMnhl zq6/EfN7iti1onuQ5w2xvFMb/x9Vfy37dN4ZlQ2A5prRlX+LR64ScQc1hhYd0M4Q M/llNUUtjHIb3XGmJKuEw37thF/qL767gwC+y6BsAIYFJrD+iGOfPl9/S6GbCvZs qJiP3nQ36HBnvqZon4soZzUFSgBi3WxK5FEx7JH8NCRKwep7r3SL+1EEhzZ/zK40 x6mzSdb4tTPsvXP4YnO0uE8wEjjRAMIMVzYk32xv6QFsb5PmxQLLMCH2J3N8+tcj nYyhkqeFdfVVk4H5fPXmXfYxEbl4oeNkEEQL6ruYjI5Yrrhus5c= =64ui -----END PGP SIGNATURE-----