* \retval 0 if version matches
* \retval -EOVERFLOW on version mismatch
*/
-int ofd_version_get_check(struct ofd_thread_info *info,
- struct ofd_object *fo)
+static int ofd_version_get_check(struct ofd_thread_info *info,
+ struct ofd_object *fo)
{
dt_obj_version_t curr_version;
* \retval negative value on error
*/
int ofd_precreate_objects(const struct lu_env *env, struct ofd_device *ofd,
- obd_id id, struct ofd_seq *oseq, int nr, int sync)
+ u64 id, struct ofd_seq *oseq, int nr, int sync)
{
struct ofd_thread_info *info = ofd_info(env);
struct ofd_object *fo = NULL;
struct thandle *th;
struct ofd_object **batch;
struct lu_fid *fid = &info->fti_fid;
- obd_id tmp;
+ u64 tmp;
int rc;
int i;
int objects = 0;
rc = dt_declare_create(env, next, &info->fti_attr, NULL,
&info->fti_dof, th);
- if (rc) {
+ if (rc < 0) {
+ if (i == 0)
+ GOTO(trans_stop, rc);
+
nr = i;
break;
}
CDEBUG(D_OTHER, "%s: create new object "DFID" nr %d\n",
ofd_name(ofd), PFID(fid), nr);
- LASSERT(nr > 0);
-
/* When the LFSCK scanning the whole device to verify the LAST_ID file
* consistency, it will load the last_id into RAM firstly, and compare
* the last_id with each OST-object's ID. If the later one is larger,
/* Only the new created objects need to be recorded. */
if (ofd->ofd_osd->dd_record_fid_accessed) {
- lfsck_pack_rfa(&ofd_info(env)->fti_lr,
- lu_object_fid(&fo->ofo_obj.do_lu));
- lfsck_in_notify(env, ofd->ofd_osd,
- &ofd_info(env)->fti_lr);
+ struct lfsck_request *lr = &ofd_info(env)->fti_lr;
+
+ lfsck_pack_rfa(lr, lu_object_fid(&fo->ofo_obj.do_lu),
+ LE_FID_ACCESSED,
+ LFSCK_TYPE_LAYOUT);
+ lfsck_in_notify(env, ofd->ofd_osd, lr, NULL);
}
if (likely(!ofd_object_exists(fo) &&
rc = dt_create(env, next, &info->fti_attr, NULL,
&info->fti_dof, th);
- if (rc)
+ if (rc < 0) {
+ if (i == 0)
+ GOTO(trans_stop, rc);
+
+ rc = 0;
break;
+ }
LASSERT(ofd_object_exists(fo));
}
ofd_seq_last_oid_set(oseq, id + i);
/* we support truncate, not punch yet */
LASSERT(end == OBD_OBJECT_EOF);
+ ofd_write_lock(env, fo);
fmd = ofd_fmd_get(info->fti_exp, &fo->ofo_header.loh_fid);
if (fmd && fmd->fmd_mactime_xid < info->fti_xid)
fmd->fmd_mactime_xid = info->fti_xid;
ofd_fmd_put(info->fti_exp, fmd);
- ofd_write_lock(env, fo);
if (!ofd_object_exists(fo))
GOTO(unlock, rc = -ENOENT);
if (IS_ERR(th))
GOTO(unlock, rc = PTR_ERR(th));
- dt_declare_ref_del(env, ofd_object_child(fo), th);
- dt_declare_destroy(env, ofd_object_child(fo), th);
+ rc = dt_declare_ref_del(env, ofd_object_child(fo), th);
+ if (rc < 0)
+ GOTO(stop, rc);
+
+ rc = dt_declare_destroy(env, ofd_object_child(fo), th);
+ if (rc < 0)
+ GOTO(stop, rc);
+
if (orphan)
rc = dt_trans_start_local(env, ofd->ofd_osd, th);
else