Whamcloud - gitweb
Branch b_hd_kdmu
authorrcorreia <rcorreia>
Wed, 11 Mar 2009 08:00:15 +0000 (08:00 +0000)
committerrcorreia <rcorreia>
Wed, 11 Mar 2009 08:00:15 +0000 (08:00 +0000)
b=17577

Fixed kDMU OSD to use the latest commit callback API.

lustre/dmu-osd/osd_handler.c
lustre/dmu-osd/udmu.c
lustre/dmu-osd/udmu.h

index e05df3e..187ed4a 100644 (file)
@@ -758,7 +758,8 @@ static void osd_trans_commit_cb(void *cb_data, int error)
         th->th_dev = NULL;
         lu_context_exit(&th->th_ctx);
         lu_context_fini(&th->th_ctx);
-        udmu_tx_cb_destroy(oh);
+        OBD_FREE_PTR(oh);
+
         EXIT;
 }
 
@@ -769,14 +770,20 @@ static struct thandle *osd_trans_create(const struct lu_env *env,
         struct osd_thandle *oh;
         struct thandle *th;
         dmu_tx_t *tx;
-        int hook_res, rc;
+        int hook_res;
         ENTRY;
+
         tx = udmu_tx_create(&osd->od_objset);
         if (tx == NULL)
                 RETURN(ERR_PTR(-ENOMEM));
 
         /* alloc callback data */
-        oh = udmu_tx_cb_create(sizeof(*oh));
+        OBD_ALLOC_PTR(oh);
+        if (oh == NULL) {
+                udmu_tx_abort(tx);
+                RETURN(ERR_PTR(-ENOMEM));
+        }
+
 #if 0
         oh->ot_sync = p->tp_sync;
 #endif
@@ -788,8 +795,7 @@ static struct thandle *osd_trans_create(const struct lu_env *env,
         lu_context_init(&th->th_ctx, LCT_TX_HANDLE);
         lu_context_enter(&th->th_ctx);
         /* add commit callback */
-        rc = udmu_tx_cb_add(tx, osd_trans_commit_cb, (void *)oh);
-        LASSERT(rc == 0);
+        udmu_tx_cb_register(tx, osd_trans_commit_cb, (void *)oh);
 
         hook_res = dt_txn_hook_start(env, dt, th);
         if (hook_res != 0)
index 7894671..7e270ab 100644 (file)
@@ -851,19 +851,9 @@ void udmu_tx_commit(dmu_tx_t *tx)
 }
 
 /* commit callback API */
-void * udmu_tx_cb_create(size_t bytes)
+void udmu_tx_cb_register(dmu_tx_t *tx, udmu_tx_callback_func_t *func, void *data)
 {
-        return dmu_tx_callback_data_create(bytes);
-}
-
-int udmu_tx_cb_add(dmu_tx_t *tx, void *func, void *data)
-{
-        return dmu_tx_callback_commit_add(tx, func, data);
-}
-
-int udmu_tx_cb_destroy(void *data)
-{
-        return dmu_tx_callback_data_destroy(data);
+        dmu_tx_callback_register(tx, func, data);
 }
 
 int udmu_indblk_overhead(dmu_buf_t *db, unsigned long *used,
index 8e27114..1bbe46c 100644 (file)
@@ -258,11 +258,10 @@ int udmu_indblk_overhead(dmu_buf_t *db, unsigned long *used,
 
 void udmu_tx_commit(dmu_tx_t *tx);
 
-void * udmu_tx_cb_create(size_t bytes);
+/* Commit callbacks */
+typedef void udmu_tx_callback_func_t(void *dcb_data, int error);
+void udmu_tx_cb_register(dmu_tx_t *tx, udmu_tx_callback_func_t *func, void *data);
 
-int udmu_tx_cb_add(dmu_tx_t *tx, void *func, void *data);
-
-int udmu_tx_cb_destroy(void *data);
 
 int udmu_object_is_zap(dmu_buf_t *);