return rc;
}
+/*
+ * last_rcvd update callbacks
+ */
+
+#define MDT_TXN_LAST_RCVD_CREDITS 1
+/* add credits for last_rcvd update */
+static int mdt_txn_start_cb(const struct lu_context *ctx,
+ struct dt_device *dev,
+ struct txn_param *param, void *cookie)
+{
+ param->tp_credits += MDT_TXN_LAST_RCVD_CREDITS;
+ return 0;
+}
+/* Update last_rcvd records with latests transaction data */
+static int mdt_txn_stop_cb(const struct lu_context *ctx,
+ struct dt_device *dev,
+ struct thandle *txn, void *cookie)
+{
+/*
+ struct mdt_device *mdt = cookie;
+ TODO: write last_rcvd
+*/
+ return 0;
+}
+/*
+ * commit callback, need to update last_commited value */
+static int mdt_txn_commit_cb(const struct lu_context *ctx,
+ struct dt_device *dev,
+ struct thandle *txn, void *cookie)
+{
+ struct mdt_device *mdt = cookie;
+ /* TODO: update mdt_last_commited, need current transno here */
+ ++ mdt->mdt_last_committed;
+ return 0;
+}
+
int mdt_fs_setup(const struct lu_context *ctxt,
struct mdt_device *mdt)
{
int rc;
ENTRY;
+ /* prepare transactions callbacks */
+ mdt->mdt_txn_cb.dtc_txn_start = mdt_txn_start_cb;
+ mdt->mdt_txn_cb.dtc_txn_stop = mdt_txn_stop_cb;
+ mdt->mdt_txn_cb.dtc_txn_commit = mdt_txn_commit_cb;
+ mdt->mdt_txn_cb.dtc_cookie = mdt;
+
+ dt_txn_callback_add(mdt->mdt_bottom, &mdt->mdt_txn_cb);
+/*
last = dt_store_open(ctxt, mdt->mdt_bottom, LAST_RCVD, &last_fid);
if(!IS_ERR(last)) {
- mdt->mdt_last = last;
+ mdt->mdt_last_rcvd = last;
rc = mdt_init_server_data(ctxt, mdt);
if (rc) {
lu_object_put(ctxt, &last->do_lu);
rc = PTR_ERR(last);
CERROR("cannot open %s: rc = %d\n", LAST_RCVD, rc);
}
+*/
return rc;
}
struct mdt_device *mdt)
{
struct obd_device *obd = mdt->mdt_md_dev.md_lu_dev.ld_obd;
+
+ /* remove transaction callback */
+ dt_txn_callback_del(mdt->mdt_bottom, &mdt->mdt_txn_cb);
class_disconnect_exports(obd); /* cleans up client info too */
- if (mdt->mdt_last)
- lu_object_put(ctxt, &mdt->mdt_last->do_lu);
- mdt->mdt_last = NULL;
+ if (mdt->mdt_last_rcvd)
+ lu_object_put(ctxt, &mdt->mdt_last_rcvd->do_lu);
+ mdt->mdt_last_rcvd = NULL;
}
spinlock_t mdt_transno_lock;
__u64 mdt_last_transno;
__u64 mdt_last_committed;
+ /* transaction callbacks */
+ struct dt_txn_callback mdt_txn_cb;
+ /* last_rcvd file */
+ struct dt_object *mdt_last_rcvd;
+
/* these values should be updated from lov if necessary.
* or should be placed somewhere else. */
int mdt_max_mdsize;
__u64 mdt_mount_count;
struct mdt_server_data mdt_msd;
- unsigned long mdt_client_bitmap[LR_MAX_CLIENTS / sizeof(long)];
- struct dt_object *mdt_last;
+ unsigned long mdt_client_bitmap[(LR_MAX_CLIENTS >> 3) / sizeof(long)];
};
/*XXX copied from mds_internal.h */
* XXX this is probably huge overkill, because statfs is not that
* frequent.
*/
+
struct kstatfs mti_sfs;
/* temporary stuff used by thread */