Whamcloud - gitweb
LU-14098 obdclass: try to skip corrupted llog records
[fs/lustre-release.git] / lustre / obdclass / local_storage.c
index a8dd4cb..05132b0 100644 (file)
@@ -47,7 +47,7 @@ static int ls_object_init(const struct lu_env *env, struct lu_object *o,
 
        ENTRY;
 
-       ls = container_of0(o->lo_dev, struct ls_device, ls_top_dev.dd_lu_dev);
+       ls = container_of(o->lo_dev, struct ls_device, ls_top_dev.dd_lu_dev);
        under = &ls->ls_osd->dd_lu_dev;
        below = under->ld_ops->ldo_object_alloc(env, o->lo_header, under);
        if (below == NULL)
@@ -65,7 +65,8 @@ static void ls_object_free(const struct lu_env *env, struct lu_object *o)
 
        dt_object_fini(&obj->ls_obj);
        lu_object_header_fini(h);
-       OBD_FREE_PTR(obj);
+       OBD_FREE_PRE(obj, sizeof(*obj), "kfreed");
+       kfree_rcu(obj, ls_header.loh_rcu);
 }
 
 static struct lu_object_operations ls_lu_obj_ops = {
@@ -371,7 +372,7 @@ static struct dt_object *__local_file_create(const struct lu_env *env,
        if (rc)
                GOTO(trans_stop, rc);
 
-       dt_write_lock(env, dto, LOS_CHILD);
+       dt_write_lock(env, dto, DT_SRC_CHILD);
        if (dt_object_exists(dto))
                GOTO(unlock, rc = 0);
 
@@ -388,23 +389,23 @@ static struct dt_object *__local_file_create(const struct lu_env *env,
                rec->rec_fid = fid;
                /* Add "." and ".." for newly created dir */
                rc = dt_insert(env, dto, (const struct dt_rec *)rec,
-                              (const struct dt_key *)".", th, 1);
+                              (const struct dt_key *)".", th);
                if (rc != 0)
                        GOTO(destroy, rc);
 
                dt_ref_add(env, dto, th);
                rec->rec_fid = lu_object_fid(&parent->do_lu);
                rc = dt_insert(env, dto, (const struct dt_rec *)rec,
-                              (const struct dt_key *)"..", th, 1);
+                              (const struct dt_key *)"..", th);
                if (rc != 0)
                        GOTO(destroy, rc);
        }
 
        rec->rec_fid = fid;
        rec->rec_type = dto->do_lu.lo_header->loh_attr;
-       dt_write_lock(env, parent, LOS_PARENT);
+       dt_write_lock(env, parent, DT_SRC_PARENT);
        rc = dt_insert(env, parent, (const struct dt_rec *)rec,
-                      (const struct dt_key *)name, th, 1);
+                      (const struct dt_key *)name, th);
        if (dti->dti_dof.dof_type == DFT_DIR)
                dt_ref_add(env, parent, th);
        dt_write_unlock(env, parent);
@@ -502,7 +503,7 @@ struct dt_object *local_file_find_or_create_with_fid(const struct lu_env *env,
 
                ls = ls_device_get(dt);
                if (IS_ERR(ls)) {
-                       dto = ERR_PTR(PTR_ERR(ls));
+                       dto = ERR_CAST(ls);
                } else {
                        /* create the object */
                        dti->dti_attr.la_valid  = LA_MODE;
@@ -597,7 +598,7 @@ local_index_find_or_create_with_fid(const struct lu_env *env,
 
                ls = ls_device_get(dt);
                if (IS_ERR(ls)) {
-                       dto = ERR_PTR(PTR_ERR(ls));
+                       dto = ERR_CAST(ls);
                } else {
                        /* create the object */
                        dti->dti_attr.la_valid          = LA_MODE;
@@ -684,7 +685,7 @@ int local_object_unlink(const struct lu_env *env, struct dt_device *dt,
                rec->rec_fid = &dti->dti_fid;
                rec->rec_type = dto->do_lu.lo_header->loh_attr;
                rc = dt_insert(env, parent, (const struct dt_rec *)rec,
-                              (const struct dt_key *)name, th, 1);
+                              (const struct dt_key *)name, th);
                GOTO(unlock, rc);
        }
 
@@ -719,7 +720,6 @@ void dt_los_put(struct local_oid_storage *los)
                /* should never happen, only local_oid_storage_fini should
                 * drop refcount to zero */
                LBUG();
-       return;
 }
 
 /* after Lustre 2.3 release there may be old file to store last generated FID