struct lov_mds_md *lmm, int lmm_size,
struct llog_cookie *logcookies, int cookies_size);
+int mds_lov_write_objids(struct obd_device *obd);
+void mds_lov_update_objids(struct obd_device *obd, obd_id *ids);
/* ioctls for trying requests */
#define IOC_REQUEST_TYPE 'f'
#define IOC_REQUEST_MIN_NR 30
RETURN(rc);
}
+static int mdd_txn_start_cb(const struct lu_context *ctx,
+ struct txn_param *param, void *cookie)
+{
+ return 0;
+}
+
+static int mdd_txn_stop_cb(const struct lu_context *ctx,
+ struct thandle *txn, void *cookie)
+{
+ struct mdd_device *mdd = cookie;
+ struct obd_device *obd = mdd2obd_dev(mdd);
+
+ return mds_lov_write_objids(obd);
+}
+
+static int mdd_txn_commit_cb(const struct lu_context *ctx,
+ struct thandle *txn, void *cookie)
+{
+ return 0;
+}
+
static int mdd_device_init(const struct lu_context *ctx,
struct lu_device *d, struct lu_device *next)
{
struct mdd_device *mdd = lu2mdd_dev(d);
+ struct dt_device *dt;
int rc = 0;
ENTRY;
mdd->mdd_child = lu2dt_dev(next);
+ dt = mdd->mdd_child;
+ /* prepare transactions callbacks */
+ mdd->mdd_txn_cb.dtc_txn_start = mdd_txn_start_cb;
+ mdd->mdd_txn_cb.dtc_txn_stop = mdd_txn_stop_cb;
+ mdd->mdd_txn_cb.dtc_txn_commit = mdd_txn_commit_cb;
+ mdd->mdd_txn_cb.dtc_cookie = mdd;
+
+ dt_txn_callback_add(dt, &mdd->mdd_txn_cb);
+
RETURN(rc);
}
static struct lu_device *mdd_device_fini(const struct lu_context *ctx,
struct lu_device *d)
{
- struct mdd_device *m = lu2mdd_dev(d);
- struct lu_device *next = &m->mdd_child->dd_lu_dev;
+ struct mdd_device *mdd = lu2mdd_dev(d);
+ struct lu_device *next = &mdd->mdd_child->dd_lu_dev;
+ dt_txn_callback_del(mdd->mdd_child, &mdd->mdd_txn_cb);
+
return next;
}
+
static void mdd_device_shutdown(const struct lu_context *ctxt,
struct mdd_device *m)
{
struct lu_fid mdd_root_fid;
struct dt_device_param mdd_dt_conf;
struct dt_object *mdd_orphans;
+ struct dt_txn_callback mdd_txn_cb;
};
enum mod_flags {
struct lov_mds_md mti_lmm;
struct obd_info mti_oi;
struct orph_key mti_orph_key;
+ struct obd_trans_info mti_oti;
};
int mdd_init_obd(const struct lu_context *ctxt, struct mdd_device *mdd,
const void *eadata = spec->u.sp_ea.eadata;
__u32 create_flags = spec->sp_cr_flags;
int rc = 0;
+ struct obd_trans_info *oti = &mdd_ctx_info(ctxt)->mti_oti;
+ obd_id *ids = NULL; /* object IDs created */
ENTRY;
if (create_flags & MDS_OPEN_DELAY_CREATE ||
OBD_MD_FLMODE | OBD_MD_FLUID | OBD_MD_FLGID | OBD_MD_FLGROUP;
oa->o_size = 0;
+ OBD_ALLOC(ids, obd->u.mds.mds_lov_desc.ld_tgt_count * sizeof(*ids));
+ if (ids == NULL)
+ RETURN(-ENOMEM);
+
+ oti_init(oti, NULL);
+ oti->oti_objid = ids;
+
if (!(create_flags & MDS_OPEN_HAS_OBJS)) {
if (create_flags & MDS_OPEN_HAS_EA) {
LASSERT(eadata != NULL);
if (rc)
GOTO(out_oa, rc);
}
- rc = obd_create(lov_exp, oa, &lsm, NULL);
+ rc = obd_create(lov_exp, oa, &lsm, oti);
if (rc) {
if (rc > 0) {
CERROR("create errro for "DFID": %d \n",
/* blksize should be changed after create data object */
la->la_valid |= LA_BLKSIZE;
la->la_blksize = oa->o_blksize;
+
+ mds_lov_update_objids(obd, ids);
+
rc = obd_packmd(lov_exp, lmm, lsm);
if (rc < 0) {
*lmm_size = rc;
rc = 0;
out_oa:
+ if (ids)
+ OBD_FREE(ids, sizeof(*ids) *
+ obd->u.mds.mds_lov_desc.ld_tgt_count);
obdo_free(oa);
if (lsm)
obd_free_memmd(lov_exp, &lsm);
unlock_kernel();
EXIT;
}
+EXPORT_SYMBOL(mds_lov_update_objids);
static int mds_lov_read_objids(struct obd_device *obd)
{
RETURN(rc);
}
+EXPORT_SYMBOL(mds_lov_write_objids);
int mds_lov_clear_orphans(struct mds_obd *mds, struct obd_uuid *ost_uuid)
{