};
struct dt_device {
- struct lu_device dd_lu_dev;
- struct dt_device_operations *dd_ops;
+ struct lu_device dd_lu_dev;
+ struct dt_device_operations *dd_ops;
};
static inline int lu_device_is_dt(const struct lu_device *d)
struct dt_object {
struct lu_object do_lu;
- struct dt_object_operations *do_ops;
- struct dt_body_operations *do_body_ops;
- struct dt_index_operations *do_index_ops;
+ struct dt_object_operations *do_ops;
+ struct dt_body_operations *do_body_ops;
+ struct dt_index_operations *do_index_ops;
};
struct txn_param {
#define TXN_PARAM(...) ((struct txn_param)TXN_PARAM_INIT(__VA_ARGS__))
+struct thandle {
+ struct dt_device *th_dev;
+};
+
#endif /* __LINUX_DT_OBJECT_H */
/* LUSTRE_VERSION_CODE */
#include <linux/lustre_ver.h>
/*
+ * XXX temporary stuff: direct access to ldiskfs/jdb. Interface between osd
+ * and file system is not yet specified.
+ */
+/* handle_t, journal_start(), journal_stop() */
+#include <linux/jbd.h>
+/* LDISKFS_SB() */
+#include <linux/ldiskfs_fs.h>
+
+/*
* struct OBD_{ALLOC,FREE}*()
* OBD_FAIL_CHECK
*/
struct osd_device *dev,
const struct osd_inode_id *id);
static struct super_block *osd_sb (const struct osd_device *dev);
+static journal_t *osd_journal (const struct osd_device *dev);
static struct lu_device_type_operations osd_device_type_ops;
static struct lu_device_type osd_device_type;
static struct dt_body_operations osd_body_ops;
static struct dt_index_operations osd_index_ops;
+struct osd_thandle {
+ struct thandle ot_super;
+ handle_t *ot_handle;
+};
+
/*
* DT methods.
*/
ENTRY;
- memset(sfs, 0, sizeof(*sfs));
+ memset(sfs, 0, sizeof *sfs);
result = sb->s_op->statfs(sb, sfs);
RETURN (result);
struct dt_device *d,
struct txn_param *p)
{
- RETURN (NULL);
+ struct osd_device *dev = osd_dt_dev(d);
+ handle_t *handle;
+ struct osd_thandle *oh;
+ struct thandle *result;
+
+ ENTRY;
+
+ OBD_ALLOC_PTR(oh);
+ if (oh != NULL) {
+ /*
+ * XXX temporary stuff. Some abstraction layer should be used.
+ */
+ /*
+ * XXX Here, run transaction start hook, so that modules can
+ * change @p.
+ */
+ handle = journal_start(osd_journal(dev), p->tp_credits);
+ if (!IS_ERR(handle)) {
+ result = &oh->ot_super;
+ result->th_dev = d;
+ lu_device_get(&d->dd_lu_dev);
+ } else {
+ OBD_FREE_PTR(oh);
+ result = (void *)handle;
+ }
+ } else
+ result = ERR_PTR(-ENOMEM);
+
+ RETURN(result);
}
-static void osd_trans_stop(struct lu_context *ctx,
- struct thandle *th)
+static void osd_trans_stop(struct lu_context *ctx, struct thandle *th)
{
+ int result;
+ struct osd_thandle *oh;
+
+ ENTRY;
+ oh = container_of0(th, struct osd_thandle, ot_super);
+ /*
+ * XXX temporary stuff. Some abstraction layer should be used.
+ */
+ /*
+ * XXX Here, run transaction stop hook.
+ */
+ result = journal_stop(oh->ot_handle);
+ if (result != 0)
+ CERROR("Failure to stop transaction: %d\n", result);
EXIT;
}
if (lu_object_exists(ctxt, &dt->do_lu))
RETURN(-EEXIST);
else {
-
+
const struct osd_inode_id i_id = {
.oii_ino = fid_seq(lf),
.oii_gen = fid_oid(lf)
return dev->od_mount->lmi_mnt->mnt_sb;
}
+static journal_t *osd_journal(const struct osd_device *dev)
+{
+ return LDISKFS_SB(osd_sb(dev))->s_journal;
+}
+
static struct lu_object_operations osd_lu_obj_ops = {
.loo_object_init = osd_object_init,
.loo_object_delete = osd_object_delete,