int md_lov_start_synchronize(struct obd_device *obd, struct md_lov_info *mli,
struct obd_device *watched,
void *data, int nonblock, const void *ctxt);
+int mds_log_op_unlink(struct obd_device *obd, struct inode *inode,
+ struct lov_mds_md *lmm, int lmm_size,
+ struct llog_cookie *logcookies, int cookies_size);
+int mds_log_op_setattr(struct obd_device *obd, struct inode *inode,
+ struct lov_mds_md *lmm, int lmm_size,
+ struct llog_cookie *logcookies, int cookies_size);
+
/* ioctls for trying requests */
#define IOC_REQUEST_TYPE 'f'
#define IOC_REQUEST_MIN_NR 30
/* metadata attributes */
enum ma_valid {
MA_INODE = (1 << 0),
- MA_LOV = (1 << 1)
+ MA_LOV = (1 << 1),
+ MA_COOKIE = (1 << 2)
};
struct md_attr {
struct lu_attr ma_attr;
struct lov_mds_md *ma_lmm;
int ma_lmm_size;
+ struct llog_cookie *ma_cookie;
+ int ma_cookie_size;
};
/*
/* unlink dotdot */
__mdd_ref_del(ctxt, mdd_pobj, handle, NULL);
}
-
+ if (S_ISREG(ma->ma_attr.la_mode) &&
+ ma->ma_attr.la_nlink == 0 && cobj->mo_lu.lo_header->loh_ref == 1) {
+ rc = mdd_unlink_log(ctxt, mdd, mdd_cobj, ma);
+ }
cleanup:
mdd_unlock2(ctxt, mdd_pobj, mdd_cobj);
mdd_trans_stop(ctxt, mdd, handle);
int *lmm_size);
int mdd_get_md(const struct lu_context *ctxt, struct md_object *obj,
void *md, int *md_size, int lock);
-
-
+int mdd_unlink_log(const struct lu_context *ctxt, struct mdd_device *mdd,
+ struct mdd_object *mdd_cobj, struct md_attr *ma);
struct mdd_thread_info *mdd_ctx_info(const struct lu_context *ctx);
+
extern struct lu_device_operations mdd_lu_ops;
static inline int lu_device_is_mdd(struct lu_device *d)
{
return container_of0(lu_object_next(mdd2lu_obj(o)),
struct dt_object, do_lu);
}
-
+static inline struct obd_device *mdd2_obd(struct mdd_device *mdd)
+{
+ return mdd->mdd_md_dev.md_lu_dev.ld_obd;
+}
#endif
struct mdd_object *child, struct lov_mds_md **lmm,
int *lmm_size)
{
- struct obd_device *obd = mdd->mdd_md_dev.md_lu_dev.ld_obd;
+ struct obd_device *obd = mdd2_obd(mdd);
struct obd_export *lov_exp = obd->u.mds.mds_osc_exp;
struct obdo *oa;
struct lov_stripe_md *lsm = NULL;
obdo_free(oa);
RETURN(rc);
}
+
+int mdd_unlink_log(const struct lu_context *ctxt, struct mdd_device *mdd,
+ struct mdd_object *mdd_cobj, struct md_attr *ma)
+{
+ struct obd_device *obd = mdd2_obd(mdd);
+
+ if (mds_log_op_unlink(obd, NULL, ma->ma_lmm, ma->ma_lmm_size,
+ ma->ma_cookie, ma->ma_cookie_size)) {
+ ma->ma_valid |= MA_COOKIE;
+ }
+ return 0;
+}
/* mds/mds_log.c */
-int mds_log_op_unlink(struct obd_device *obd, struct inode *inode,
- struct lov_mds_md *lmm, int lmm_size,
- struct llog_cookie *logcookies, int cookies_size);
-int mds_log_op_setattr(struct obd_device *obd, struct inode *inode,
- struct lov_mds_md *lmm, int lmm_size,
- struct llog_cookie *logcookies, int cookies_size);
int mds_llog_init(struct obd_device *obd, struct obd_device *tgt, int count,
struct llog_catid *logid);
int mds_llog_finish(struct obd_device *obd, int count);
obd_free_memmd(mds->mds_osc_exp, &lsm);
RETURN(rc);
}
-
+EXPORT_SYMBOL(mds_log_op_unlink);
int mds_log_op_setattr(struct obd_device *obd, struct inode *inode,
struct lov_mds_md *lmm, int lmm_size,
struct llog_cookie *logcookies, int cookies_size)
repbody->eadatasize = ma->ma_lmm_size;
repbody->valid |= OBD_MD_FLEASIZE;
}
+
+ if (ma->ma_cookie_size && ma->ma_valid & MA_COOKIE)
+ repbody->valid |= OBD_MD_FLCOOKIE;
}
RETURN(rc);
ma->ma_lmm_size = req_capsule_get_size(&info->mti_pill,
&RMF_MDT_MD, RCL_SERVER);
+ ma->ma_cookie = req_capsule_server_get(&info->mti_pill,
+ &RMF_LOGCOOKIES);
+ ma->ma_cookie_size = req_capsule_get_size(&info->mti_pill,
+ &RMF_LOGCOOKIES, RCL_SERVER);
+
+ if (!ma->ma_lmm || !ma->ma_cookie)
+ GOTO(out_unlock_parent, rc = -EINVAL);
+
rc = mdo_unlink(info->mti_ctxt, mdt_object_child(mp),
mdt_object_child(mc), rr->rr_name, ma);
if (rc)