Whamcloud - gitweb
LU-9753 ofd: 64-bits diff variable to avoid overflow
[fs/lustre-release.git] / lustre / target / update_trans.c
index 9fccd3b..36ab331 100644 (file)
@@ -87,8 +87,8 @@ static void top_multiple_thandle_dump(struct top_multiple_thandle *tmt,
                       st->st_committed, st->st_stopped, st->st_sub_th);
 
                list_for_each_entry(stc, &st->st_cookie_list, stc_list) {
-                       CDEBUG(mask, " cookie "DOSTID": %u\n",
-                              POSTID(&stc->stc_cookie.lgc_lgl.lgl_oi),
+                       CDEBUG(mask, " cookie "DFID".%u\n",
+                              PFID(&stc->stc_cookie.lgc_lgl.lgl_oi.oi_fid),
                               stc->stc_cookie.lgc_index);
                }
        }
@@ -210,9 +210,9 @@ static int sub_updates_write(const struct lu_env *env,
                rc = llog_add(env, ctxt->loc_handle, &record->lur_hdr,
                              &stc->stc_cookie, sub_th->st_sub_th);
 
-               CDEBUG(D_INFO, "%s: Add update log "DOSTID":%u: rc = %d\n",
+               CDEBUG(D_INFO, "%s: Add update log "DFID".%u: rc = %d\n",
                       dt->dd_lu_dev.ld_obd->obd_name,
-                      POSTID(&stc->stc_cookie.lgc_lgl.lgl_oi),
+                      PFID(&stc->stc_cookie.lgc_lgl.lgl_oi.oi_fid),
                       stc->stc_cookie.lgc_index, rc);
 
                if (rc > 0) {
@@ -290,9 +290,9 @@ static int sub_updates_write(const struct lu_env *env,
                rc = llog_add(env, ctxt->loc_handle, &lur->lur_hdr,
                              &stc->stc_cookie, sub_th->st_sub_th);
 
-               CDEBUG(D_INFO, "%s: Add update log "DOSTID":%u rc = %d\n",
+               CDEBUG(D_INFO, "%s: Add update log "DFID".%u: rc = %d\n",
                        dt->dd_lu_dev.ld_obd->obd_name,
-                       POSTID(&stc->stc_cookie.lgc_lgl.lgl_oi),
+                       PFID(&stc->stc_cookie.lgc_lgl.lgl_oi.oi_fid),
                        stc->stc_cookie.lgc_index, rc);
 
                if (rc > 0) {
@@ -1297,9 +1297,9 @@ static int distribute_txn_cancel_records(const struct lu_env *env,
                        rc = llog_cat_cancel_records(env, ctxt->loc_handle, 1,
                                                     cookie);
                        CDEBUG(D_HA, "%s: batchid %llu cancel update log "
-                              DOSTID ".%u : rc = %d\n", obd->obd_name,
+                              DFID".%u: rc = %d\n", obd->obd_name,
                               tmt->tmt_batchid,
-                              POSTID(&cookie->lgc_lgl.lgl_oi),
+                              PFID(&cookie->lgc_lgl.lgl_oi.oi_fid),
                               cookie->lgc_index, rc);
                }
 
@@ -1420,6 +1420,7 @@ distribute_txn_commit_batchid_update(const struct lu_env *env,
 
        th = dt_trans_create(env, tdtd->tdtd_lut->lut_bottom);
        if (IS_ERR(th)) {
+               atomic_dec(&tdtd->tdtd_refcount);
                OBD_FREE_PTR(dtbd);
                RETURN(PTR_ERR(th));
        }
@@ -1450,8 +1451,10 @@ distribute_txn_commit_batchid_update(const struct lu_env *env,
 
 stop:
        dt_trans_stop(env, tdtd->tdtd_lut->lut_bottom, th);
-       if (rc < 0)
+       if (rc < 0) {
+               atomic_dec(&tdtd->tdtd_refcount);
                OBD_FREE_PTR(dtbd);
+       }
        RETURN(rc);
 }
 
@@ -1519,7 +1522,7 @@ distribute_txn_commit_batchid_init(const struct lu_env *env,
 
 out_put:
        if (rc < 0 && dt_obj != NULL) {
-               lu_object_put(env, &dt_obj->do_lu);
+               dt_object_put(env, dt_obj);
                tdtd->tdtd_batchid_obj = NULL;
        }
        return rc;
@@ -1701,11 +1704,14 @@ int distribute_txn_init(const struct lu_env *env,
        atomic_set(&tdtd->tdtd_recovery_threads_count, 0);
 
        tdtd->tdtd_lut = lut;
+       if (lut->lut_bottom->dd_rdonly)
+               RETURN(0);
+
        rc = distribute_txn_commit_batchid_init(env, tdtd);
        if (rc != 0)
                RETURN(rc);
 
-       task = kthread_run(distribute_txn_commit_thread, tdtd, "tdtd-%u",
+       task = kthread_run(distribute_txn_commit_thread, tdtd, "dist_txn-%u",
                           index);
        if (IS_ERR(task))
                RETURN(PTR_ERR(task));
@@ -1743,7 +1749,7 @@ void distribute_txn_fini(const struct lu_env *env,
 
        dtrq_list_destroy(tdtd);
        if (tdtd->tdtd_batchid_obj != NULL) {
-               lu_object_put(env, &tdtd->tdtd_batchid_obj->do_lu);
+               dt_object_put(env, tdtd->tdtd_batchid_obj);
                tdtd->tdtd_batchid_obj = NULL;
        }
 }