Skip to content

Commit b18045e

Browse files
backslashxxluyanci
authored andcommitted
kernel: minor optimization on throne tracker
* Picked from tiann#2633 * Add missed filp_close and don't make data_app_magic static + __read_mostly Signed-off-by: backslashxx <[email protected]> Signed-off-by: rsuntk <[email protected]>
1 parent 6dd1bb6 commit b18045e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

kernel/throne_tracker.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,13 @@ FILLDIR_RETURN_TYPE my_actor(struct dir_context *ctx, const char *name,
201201
return FILLDIR_ACTOR_CONTINUE;
202202
}
203203

204-
static unsigned long data_app_magic __read_mostly = 0; // its not like /data/app magic changes duh
205-
206204
void search_manager(const char *path, int depth, struct list_head *uid_data)
207205
{
208206
int i, stop = 0;
209207
struct list_head data_path_list;
210208
INIT_LIST_HEAD(&data_path_list);
211209
INIT_LIST_HEAD(&apk_path_hash_list);
210+
unsigned long data_app_magic = 0;
212211

213212
// Initialize APK cache list
214213
struct apk_path_hash *pos, *n;
@@ -242,12 +241,14 @@ void search_manager(const char *path, int depth, struct list_head *uid_data)
242241
}
243242

244243
// grab magic on first folder, which is /data/app
245-
if (unlikely(!data_app_magic)) {
244+
if (!data_app_magic) {
246245
if (file->f_inode->i_sb->s_magic) {
247246
data_app_magic = file->f_inode->i_sb->s_magic;
248247
pr_info("%s: dir: %s got magic! 0x%lx\n", __func__, pos->dirpath, data_app_magic);
249-
} else
248+
} else {
249+
filp_close(file, NULL);
250250
goto skip_iterate;
251+
}
251252
}
252253

253254
if (file->f_inode->i_sb->s_magic != data_app_magic) {

0 commit comments

Comments
 (0)