5
5
*/
6
6
#include "internal.h"
7
7
8
+ static atomic_long_t erofs_global_shrink_cnt ; /* for all mounted instances */
9
+ /* protected by 'erofs_sb_list_lock' */
10
+ static unsigned int shrinker_run_no ;
11
+
12
+ /* protects the mounted 'erofs_sb_list' */
13
+ static DEFINE_SPINLOCK (erofs_sb_list_lock );
14
+ static LIST_HEAD (erofs_sb_list );
15
+ static struct shrinker * erofs_shrinker_info ;
16
+
8
17
struct page * erofs_allocpage (struct page * * pagepool , gfp_t gfp )
9
18
{
10
19
struct page * page = * pagepool ;
11
20
12
21
if (page ) {
13
22
DBG_BUGON (page_ref_count (page ) != 1 );
14
23
* pagepool = (struct page * )page_private (page );
15
- } else {
16
- page = alloc_page (gfp );
24
+ return page ;
17
25
}
18
- return page ;
26
+ return alloc_page ( gfp ) ;
19
27
}
20
28
21
29
void erofs_release_pages (struct page * * pagepool )
@@ -28,10 +36,6 @@ void erofs_release_pages(struct page **pagepool)
28
36
}
29
37
}
30
38
31
- #ifdef CONFIG_EROFS_FS_ZIP
32
- /* global shrink count (for all mounted EROFS instances) */
33
- static atomic_long_t erofs_global_shrink_cnt ;
34
-
35
39
static bool erofs_workgroup_get (struct erofs_workgroup * grp )
36
40
{
37
41
if (lockref_get_not_zero (& grp -> lockref ))
@@ -171,13 +175,6 @@ static unsigned long erofs_shrink_workstation(struct erofs_sb_info *sbi,
171
175
return freed ;
172
176
}
173
177
174
- /* protected by 'erofs_sb_list_lock' */
175
- static unsigned int shrinker_run_no ;
176
-
177
- /* protects the mounted 'erofs_sb_list' */
178
- static DEFINE_SPINLOCK (erofs_sb_list_lock );
179
- static LIST_HEAD (erofs_sb_list );
180
-
181
178
void erofs_shrinker_register (struct super_block * sb )
182
179
{
183
180
struct erofs_sb_info * sbi = EROFS_SB (sb );
@@ -264,8 +261,6 @@ static unsigned long erofs_shrink_scan(struct shrinker *shrink,
264
261
return freed ;
265
262
}
266
263
267
- static struct shrinker * erofs_shrinker_info ;
268
-
269
264
int __init erofs_init_shrinker (void )
270
265
{
271
266
erofs_shrinker_info = shrinker_alloc (0 , "erofs-shrinker" );
@@ -274,14 +269,11 @@ int __init erofs_init_shrinker(void)
274
269
275
270
erofs_shrinker_info -> count_objects = erofs_shrink_count ;
276
271
erofs_shrinker_info -> scan_objects = erofs_shrink_scan ;
277
-
278
272
shrinker_register (erofs_shrinker_info );
279
-
280
273
return 0 ;
281
274
}
282
275
283
276
void erofs_exit_shrinker (void )
284
277
{
285
278
shrinker_free (erofs_shrinker_info );
286
279
}
287
- #endif /* !CONFIG_EROFS_FS_ZIP */
0 commit comments