Whamcloud - gitweb
LU-17392 build: compatibility updates for kernel 6.7
[fs/lustre-release.git] / lustre / osc / osc_request.c
index 6485093..edd4dcf 100644 (file)
@@ -3950,7 +3950,7 @@ DEFINE_SPINLOCK(osc_shrink_lock);
 bool osc_page_cache_shrink_enabled = true;
 
 #ifdef HAVE_SHRINKER_COUNT
-static struct shrinker osc_cache_shrinker = {
+static struct ll_shrinker_ops osc_cache_sh_ops = {
        .count_objects  = osc_cache_shrink_count,
        .scan_objects   = osc_cache_shrink_scan,
        .seeks          = DEFAULT_SEEKS,
@@ -3964,12 +3964,14 @@ static int osc_cache_shrink(struct shrinker *shrinker,
        return osc_cache_shrink_count(shrinker, sc);
 }
 
-static struct shrinker osc_cache_shrinker = {
+static struct ll_shrinker_ops osc_cache_sh_ops = {
        .shrink   = osc_cache_shrink,
        .seeks    = DEFAULT_SEEKS,
 };
 #endif
 
+static struct shrinker *osc_cache_shrinker;
+
 static int __init osc_init(void)
 {
        unsigned int reqpool_size;
@@ -3990,9 +3992,10 @@ static int __init osc_init(void)
        if (rc)
                RETURN(rc);
 
-       rc = register_shrinker(&osc_cache_shrinker);
-       if (rc)
-               GOTO(out_kmem, rc);
+       osc_cache_shrinker = ll_shrinker_create(&osc_cache_sh_ops, 0,
+                                               "osc_cache");
+       if (IS_ERR(osc_cache_shrinker))
+               GOTO(out_kmem, rc = PTR_ERR(osc_cache_shrinker));
 
        /* This is obviously too much memory, only prevent overflow here */
        if (osc_reqpool_mem_max >= 1 << 12 || osc_reqpool_mem_max == 0)
@@ -4035,7 +4038,7 @@ out_stop_grant:
 out_req_pool:
        ptlrpc_free_rq_pool(osc_rq_pool);
 out_shrinker:
-       unregister_shrinker(&osc_cache_shrinker);
+       shrinker_free(osc_cache_shrinker);
 out_kmem:
        lu_kmem_fini(osc_caches);
 
@@ -4047,7 +4050,7 @@ static void __exit osc_exit(void)
        class_unregister_type(LUSTRE_OSC_NAME);
        ptlrpc_free_rq_pool(osc_rq_pool);
        osc_stop_grant_work();
-       unregister_shrinker(&osc_cache_shrinker);
+       shrinker_free(osc_cache_shrinker);
        lu_kmem_fini(osc_caches);
 }