kernel: minor optimization on throne tracker
* Picked from https://github.com/tiann/KernelSU/pull/2633 * Add missed filp_close and don't make data_app_magic static + __read_mostly Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com> Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
This commit is contained in:
@@ -201,14 +201,13 @@ FILLDIR_RETURN_TYPE my_actor(struct dir_context *ctx, const char *name,
|
|||||||
return FILLDIR_ACTOR_CONTINUE;
|
return FILLDIR_ACTOR_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned long data_app_magic __read_mostly = 0; // its not like /data/app magic changes duh
|
|
||||||
|
|
||||||
void search_manager(const char *path, int depth, struct list_head *uid_data)
|
void search_manager(const char *path, int depth, struct list_head *uid_data)
|
||||||
{
|
{
|
||||||
int i, stop = 0;
|
int i, stop = 0;
|
||||||
struct list_head data_path_list;
|
struct list_head data_path_list;
|
||||||
INIT_LIST_HEAD(&data_path_list);
|
INIT_LIST_HEAD(&data_path_list);
|
||||||
INIT_LIST_HEAD(&apk_path_hash_list);
|
INIT_LIST_HEAD(&apk_path_hash_list);
|
||||||
|
unsigned long data_app_magic = 0;
|
||||||
|
|
||||||
// Initialize APK cache list
|
// Initialize APK cache list
|
||||||
struct apk_path_hash *pos, *n;
|
struct apk_path_hash *pos, *n;
|
||||||
@@ -242,12 +241,14 @@ void search_manager(const char *path, int depth, struct list_head *uid_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// grab magic on first folder, which is /data/app
|
// grab magic on first folder, which is /data/app
|
||||||
if (unlikely(!data_app_magic)) {
|
if (!data_app_magic) {
|
||||||
if (file->f_inode->i_sb->s_magic) {
|
if (file->f_inode->i_sb->s_magic) {
|
||||||
data_app_magic = file->f_inode->i_sb->s_magic;
|
data_app_magic = file->f_inode->i_sb->s_magic;
|
||||||
pr_info("%s: dir: %s got magic! 0x%lx\n", __func__, pos->dirpath, data_app_magic);
|
pr_info("%s: dir: %s got magic! 0x%lx\n", __func__, pos->dirpath, data_app_magic);
|
||||||
} else
|
} else {
|
||||||
|
filp_close(file, NULL);
|
||||||
goto skip_iterate;
|
goto skip_iterate;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file->f_inode->i_sb->s_magic != data_app_magic) {
|
if (file->f_inode->i_sb->s_magic != data_app_magic) {
|
||||||
|
|||||||
Reference in New Issue
Block a user