On Thu, May 07, 2020 at 10:54:40AM +0800, robbieko wrote: > From: Robbie Ko <robbieko@xxxxxxxxxxxx> > > When mounting, we handle deleted subvol and orphan items. > First, find add orphan roots, then add them to fs_root radix tree. > Second, in tree-root, process each orphan item, skip if it is dead root. > > The original algorithm is based on the list of dead_roots, > one by one to visit and check whether the objectid is consistent, > the time complexity is O (n ^ 2). > When processing 50000 deleted subvols, it takes about 120s. > > Because btrfs_find_orphan_roots has already ran before us, > and added deleted subvol to fs_roots radix tree. > > The fs root will only be removed from the fs_roots radix tree > after the cleaner is processed, and the cleaner will only start > execution after the mount is complete. > > btrfs_orphan_cleanup can be called during the whole filesystem mount > lifetime, but only "tree root" will be used in this section of code, > and only mount time will be brought into tree root. > > So we can quickly check whether the orphan item is dead root > through the fs_roots radix tree. > > Signed-off-by: Robbie Ko <robbieko@xxxxxxxxxxxx> > --- > Changes in v2: > - update changelog Thanks, added to misc-next, with the updated subject.
