Whamcloud - gitweb
LU-5051 hsm: do not reallocate hsm receive buffer
[fs/lustre-release.git] / lustre / ofd / ofd_fmd.c
index ab2a5a8..63433e8 100644 (file)
@@ -40,7 +40,7 @@
 
 #include "ofd_internal.h"
 
-static cfs_mem_cache_t *ll_fmd_cachep;
+static struct kmem_cache *ll_fmd_cachep;
 
 /* drop fmd reference, free it if last ref. must be called with fed_lock held.*/
 static inline void ofd_fmd_put_nolock(struct obd_export *exp,
@@ -48,7 +48,7 @@ static inline void ofd_fmd_put_nolock(struct obd_export *exp,
 {
        struct filter_export_data *fed = &exp->exp_filter_data;
 
-       LASSERT_SPIN_LOCKED(&fed->fed_lock);
+       assert_spin_locked(&fed->fed_lock);
        if (--fmd->fmd_refcount == 0) {
                /* XXX when we have persistent reservations and the handle
                 * is stored herein we need to drop it here. */
@@ -115,7 +115,7 @@ static struct ofd_mod_data *ofd_fmd_find_nolock(struct obd_export *exp,
 
        cfs_time_t now = cfs_time_current();
 
-       LASSERT_SPIN_LOCKED(&fed->fed_lock);
+       assert_spin_locked(&fed->fed_lock);
 
        cfs_list_for_each_entry_reverse(fmd, &fed->fed_mod_list, fmd_list) {
                if (lu_fid_eq(&fmd->fmd_fid, fid)) {
@@ -134,7 +134,7 @@ static struct ofd_mod_data *ofd_fmd_find_nolock(struct obd_export *exp,
 
 /* Find fmd based on fid or return NULL if not found. */
 struct ofd_mod_data *ofd_fmd_find(struct obd_export *exp,
-                                 struct lu_fid *fid)
+                                 const struct lu_fid *fid)
 {
        struct filter_export_data       *fed = &exp->exp_filter_data;
        struct ofd_mod_data             *fmd;
@@ -153,7 +153,7 @@ struct ofd_mod_data *ofd_fmd_find(struct obd_export *exp,
  * or if fid = 0 is passed (which will only cause old entries to expire).
  * Currently this is not fatal because any fmd state is transient and
  * may also be freed when it gets sufficiently old. */
-struct ofd_mod_data *ofd_fmd_get(struct obd_export *exp, struct lu_fid *fid)
+struct ofd_mod_data *ofd_fmd_get(struct obd_export *exp, const struct lu_fid *fid)
 {
        struct filter_export_data       *fed = &exp->exp_filter_data;
        struct ofd_device               *ofd = ofd_exp(exp);
@@ -192,7 +192,7 @@ struct ofd_mod_data *ofd_fmd_get(struct obd_export *exp, struct lu_fid *fid)
  * This isn't so critical because it would in fact only affect the one client
  * that is doing the unlink and at worst we have an stale entry referencing
  * an object that should never be used again. */
-void ofd_fmd_drop(struct obd_export *exp, struct lu_fid *fid)
+void ofd_fmd_drop(struct obd_export *exp, const struct lu_fid *fid)
 {
        struct filter_export_data       *fed = &exp->exp_filter_data;
        struct ofd_mod_data             *found = NULL;
@@ -227,9 +227,9 @@ void ofd_fmd_cleanup(struct obd_export *exp)
 
 int ofd_fmd_init(void)
 {
-       ll_fmd_cachep = cfs_mem_cache_create("ll_fmd_cache",
-                                            sizeof(struct ofd_mod_data),
-                                            0, 0);
+       ll_fmd_cachep = kmem_cache_create("ll_fmd_cache",
+                                         sizeof(struct ofd_mod_data),
+                                         0, 0, NULL);
        if (!ll_fmd_cachep)
                return -ENOMEM;
        else
@@ -239,9 +239,7 @@ int ofd_fmd_init(void)
 void ofd_fmd_exit(void)
 {
        if (ll_fmd_cachep) {
-               int rc = cfs_mem_cache_destroy(ll_fmd_cachep);
-
-               LASSERTF(rc == 0, "Cannot destroy ll_fmd_cachep: rc %d\n", rc);
+               kmem_cache_destroy(ll_fmd_cachep);
                ll_fmd_cachep = NULL;
        }
 }