* single-threaded start-up shut-down procedures.
*/
struct list_head dd_txn_callbacks;
-
- /* Thread context for transaction commit callback.
- * Transaction commit is serialized, that is there is no more than one
- * transaction commit at a time (jbd journal_commit_transaction() is
- * serialized). This means that it's enough to have _one_ lu_context.
- */
- struct lu_context dd_ctx_for_commit;
};
int dt_device_init(struct dt_device *dev, struct lu_device_type *t);
int dt_device_init(struct dt_device *dev, struct lu_device_type *t)
{
- int rc;
CFS_INIT_LIST_HEAD(&dev->dd_txn_callbacks);
- rc = lu_context_init(&dev->dd_ctx_for_commit, LCT_MD_THREAD);
- if (rc == 0) {
- lu_context_enter(&dev->dd_ctx_for_commit);
- rc = lu_device_init(&dev->dd_lu_dev, t);
- if (rc != 0) {
- lu_context_exit(&dev->dd_ctx_for_commit);
- lu_context_fini(&dev->dd_ctx_for_commit);
- }
- }
- return rc;
+ return lu_device_init(&dev->dd_lu_dev, t);
}
EXPORT_SYMBOL(dt_device_init);
void dt_device_fini(struct dt_device *dev)
{
- lu_context_exit(&dev->dd_ctx_for_commit);
- lu_context_fini(&dev->dd_ctx_for_commit);
lu_device_fini(&dev->dd_lu_dev);
}
EXPORT_SYMBOL(dt_device_fini);
* is named by its fid.
*/
struct dentry *od_obj_area;
+
+ /* Thread context for transaction commit callback.
+ * Currently, OSD is based on ext3/JBD. Transaction commit in ext3/JBD
+ * is serialized, that is there is no more than one transaction commit
+ * at a time (JBD journal_commit_transaction() is serialized).
+ * This means that it's enough to have _one_ lu_context.
+ */
+ struct lu_context od_ctx_for_commit;
};
static int osd_root_get (const struct lu_context *ctxt,
/* This dd_ctx_for_commit is only for commit usage.
* see "struct dt_device"
*/
- dt_txn_hook_commit(&dev->dd_ctx_for_commit, th);
+ dt_txn_hook_commit(&osd_dt_dev(dev)->od_ctx_for_commit, th);
}
lu_device_put(&dev->dd_lu_dev);
static int osd_device_init(const struct lu_context *ctx,
struct lu_device *d, struct lu_device *next)
{
- return 0;
+ int rc;
+ rc = lu_context_init(&osd_dev(d)->od_ctx_for_commit, LCT_MD_THREAD);
+ if (rc == 0)
+ lu_context_enter(&osd_dev(d)->od_ctx_for_commit);
+ return rc;
}
static int osd_shutdown(const struct lu_context *ctx, struct osd_device *o)
struct lu_device *d)
{
ENTRY;
+ lu_context_exit(&osd_dev(d)->od_ctx_for_commit);
+ lu_context_fini(&osd_dev(d)->od_ctx_for_commit);
RETURN(NULL);
}