Skip to content

Commit af4dcb6

Browse files
amir73ilMiklos Szeredi
authored andcommitted
ovl: use plain list filler in indexdir and workdir cleanup
Those two cleanup routines are using the helper ovl_dir_read() with the merge dir filler, which populates an rb tree, that is never used. The index dir entry names all have a long (42 bytes) constant prefix, so it is not surprising that perf top has demostrated high CPU usage by rb tree population during cleanup of a large index dir: - 9.53% ovl_fill_merge - 78.41% ovl_cache_entry_find_link.constprop.27 + 72.11% strncmp Use the plain list filler that does not populate the unneeded rb tree. Signed-off-by: Amir Goldstein <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]>
1 parent 8ea2876 commit af4dcb6

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

fs/overlayfs/readdir.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,14 +1071,10 @@ static int ovl_workdir_cleanup_recurse(struct ovl_fs *ofs, const struct path *pa
10711071
int err;
10721072
struct inode *dir = path->dentry->d_inode;
10731073
LIST_HEAD(list);
1074-
struct rb_root root = RB_ROOT;
10751074
struct ovl_cache_entry *p;
10761075
struct ovl_readdir_data rdd = {
1077-
.ctx.actor = ovl_fill_merge,
1078-
.dentry = NULL,
1076+
.ctx.actor = ovl_fill_plain,
10791077
.list = &list,
1080-
.root = &root,
1081-
.is_lowest = false,
10821078
};
10831079
bool incompat = false;
10841080

@@ -1159,14 +1155,10 @@ int ovl_indexdir_cleanup(struct ovl_fs *ofs)
11591155
struct inode *dir = indexdir->d_inode;
11601156
struct path path = { .mnt = ovl_upper_mnt(ofs), .dentry = indexdir };
11611157
LIST_HEAD(list);
1162-
struct rb_root root = RB_ROOT;
11631158
struct ovl_cache_entry *p;
11641159
struct ovl_readdir_data rdd = {
1165-
.ctx.actor = ovl_fill_merge,
1166-
.dentry = NULL,
1160+
.ctx.actor = ovl_fill_plain,
11671161
.list = &list,
1168-
.root = &root,
1169-
.is_lowest = false,
11701162
};
11711163

11721164
err = ovl_dir_read(&path, &rdd);

0 commit comments

Comments
 (0)