* @{
*/
-
+#include <obd_support.h>
/*
* super-class definitions.
*/
*/
int (*dt_trans_start)(const struct lu_env *env,
struct dt_device *dev, struct thandle *th);
- /**
- * Finish previously started transaction.
- */
- int (*dt_trans_stop)(const struct lu_env *env,
- struct thandle *th);
+ /**
+ * Finish previously started transaction.
+ */
+ int (*dt_trans_stop)(const struct lu_env *env, struct dt_device *dev,
+ struct thandle *th);
/**
* Add commit callback to the transaction.
*/
* It can contain any allocation hint in the future.
*/
struct dt_allocation_hint {
- struct dt_object *dah_parent;
- __u32 dah_mode;
+ struct dt_object *dah_parent;
+ const void *dah_eadata;
+ int dah_eadata_len;
+ __u32 dah_mode;
};
/**
return container_of0(o, struct dt_object, do_lu);
}
+struct thandle_update {
+ /* In DNE, one transaction can be disassembled into
+ * updates on several different MDTs, and these updates
+ * will be attached to tu_remote_update_list per target.
+ * Only single thread will access the list, no need lock
+ */
+ struct list_head tu_remote_update_list;
+
+ /* sent after or before local transaction */
+ unsigned int tu_sent_after_local_trans:1,
+ tu_only_remote_trans:1;
+};
+
/**
* This is the general purpose transaction handle.
* 1. Transaction Life Cycle
/** the dt device on which the transactions are executed */
struct dt_device *th_dev;
+ atomic_t th_refc;
+ /* the size of transaction */
+ int th_alloc_size;
+
/** context for this transaction, tag is LCT_TX_HANDLE */
struct lu_context th_ctx;
/* local transation, no need to inform other layers */
unsigned int th_local:1;
- /* In DNE, one transaction can be disassemblied into
- * updates on several different MDTs, and these updates
- * will be attached to th_remote_update_list per target.
- * Only single thread will access the list, no need lock
- */
- cfs_list_t th_remote_update_list;
- struct update_request *th_current_request;
+ struct thandle_update *th_update;
};
+static inline void thandle_get(struct thandle *thandle)
+{
+ atomic_inc(&thandle->th_refc);
+}
+
+static inline void thandle_put(struct thandle *thandle)
+{
+ if (atomic_dec_and_test(&thandle->th_refc)) {
+ if (thandle->th_update != NULL)
+ OBD_FREE_PTR(thandle->th_update);
+ OBD_FREE(thandle, thandle->th_alloc_size);
+ }
+}
/**
* Transaction call-backs.
*
static inline int dt_trans_stop(const struct lu_env *env,
struct dt_device *d, struct thandle *th)
{
- LASSERT(d->dd_ops->dt_trans_stop);
- return d->dd_ops->dt_trans_stop(env, th);
+ LASSERT(d->dd_ops->dt_trans_stop);
+ return d->dd_ops->dt_trans_stop(env, d, th);
}
static inline int dt_trans_cb_add(struct thandle *th,