#include <linux/lustre_fsfilt.h>
#include <linux/lustre_smfs.h>
-#include "cmobd_internal.h"
+#include "cm_internal.h"
-int lov_alloc_memmd(struct lov_stripe_md **lsmp, int stripe_count, int pattern);
void lov_free_memmd(struct lov_stripe_md **lsmp);
-int smfs_rec_unpack(struct smfs_proc_args *args, char *record, char **pbuf,
- int *opcode);
+
+int lov_alloc_memmd(struct lov_stripe_md **lsmp, int stripe_count,
+ int pattern);
+
+int smfs_rec_unpack(struct smfs_proc_args *args, char *record,
+ char **pbuf, int *opcode);
/* helper functions for cmobd to construct pseudo lsm */
int cmobd_dummy_lsm(struct lov_stripe_md **lsmp, int stripe_cnt,
}
/* reintegration functions */
-int cmobd_reint_setattr(struct obd_device *obd, void *rec)
+static int cmobd_setattr_reint(struct obd_device *obd, void *rec)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct lov_obd *lov = &cmobd->cm_master_obd->u.lov;
- struct obd_export *exp = cmobd->cm_master_exp;
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct lov_obd *lov = &cmobd->master_obd->u.lov;
+ struct obd_export *exp = cmobd->master_exp;
struct lov_stripe_md *lsm;
struct obdo *oa = (struct obdo*)rec;
int rc;
RETURN(rc);
}
-int cmobd_reint_create(struct obd_device *obd, void *rec)
+static int cmobd_create_reint(struct obd_device *obd, void *rec)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct lov_obd *lov = &cmobd->cm_master_obd->u.lov;
- struct obd_export *exp = cmobd->cm_master_exp;
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct lov_obd *lov = &cmobd->master_obd->u.lov;
+ struct obd_export *exp = cmobd->master_exp;
struct lov_stripe_md *lsm;
struct obd_trans_info oti = { 0 };
struct obdo *oa=(struct obdo*)rec;
(__u32)lov->desc.ld_default_stripe_size);
if (rc)
GOTO(out, rc);
- if (cmobd->cm_master_group != oa->o_gr) {
+ if (cmobd->master_group != oa->o_gr) {
int group = oa->o_gr;
int valsize = sizeof(group);
rc = obd_set_info(exp, strlen("mds_conn"), "mds_conn",
valsize, &group);
if (rc)
GOTO(out, rc = -EINVAL);
- cmobd->cm_master_group = oa->o_gr;
+ cmobd->master_group = oa->o_gr;
}
rc = obd_create(exp, oa, &lsm, &oti);
static int cmobd_write_extents(struct obd_device *obd, struct obdo *oa,
struct ldlm_extent *extent)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct obd_device *cache = cmobd->cm_cache_obd;
- struct lov_obd *lov = &cmobd->cm_master_obd->u.lov;
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct obd_device *cache = cmobd->cache_obd;
+ struct lov_obd *lov = &cmobd->master_obd->u.lov;
struct ldlm_res_id res_id;
ldlm_policy_data_t policy;
struct lustre_handle lockh_src = { 0 };
if (rc)
GOTO(out_lock, rc);
- rc = obd_enqueue(cmobd->cm_master_exp, lsm, LDLM_EXTENT, &policy,
+ rc = obd_enqueue(cmobd->master_exp, lsm, LDLM_EXTENT, &policy,
LCK_PW, &flags, master_blocking_ast,
ldlm_completion_ast, NULL,
NULL, 0, NULL, &lockh_dst);
err = cmobd_replay_write(obd, oa, &policy.l_extent);
- rc = obd_cancel(cmobd->cm_master_exp, lsm, LCK_PW, &lockh_dst);
+ rc = obd_cancel(cmobd->master_exp, lsm, LCK_PW, &lockh_dst);
if (rc)
GOTO(out_lsm, rc);
/* XXX in fact, I just want to cancel the only lockh_dst
* instantly. */
- rc = obd_cancel_unused(cmobd->cm_master_exp, lsm, 0, NULL);
+ rc = obd_cancel_unused(cmobd->master_exp, lsm, 0, NULL);
if (err)
rc = err;
out_lsm:
ldlm_lock_decref(&lockh_src, LCK_PR);
RETURN(rc);
}
-int cmobd_reint_write(struct obd_device *obd, void *rec)
+
+static int cmobd_write_reint(struct obd_device *obd, void *rec)
{
- struct cache_manager_obd *cmobd = &obd->u.cmobd;
- struct obd_device *cache = cmobd->cm_cache_obd;
+ struct cm_obd *cmobd = &obd->u.cm;
+ struct obd_device *cache = cmobd->cache_obd;
struct obdo *oa = (struct obdo *)rec;
struct ldlm_extent *extent = NULL;
unsigned long csb, ino;
size = sizeof(csb);
- obd_get_info(cmobd->cm_cache_exp, strlen("cache_sb") + 1,
+ obd_get_info(cmobd->cache_exp, strlen("cache_sb") + 1,
"cache_sb", &size, &csb);
ino = *(int*)(&oa->o_inline[0]);
}
out:
if (extents_buf)
- fsfilt_free_write_extents(cache, (struct super_block *)csb, ino,
- extents_buf, ext_num);
+ fsfilt_free_write_extents(cache, (struct super_block *)csb,
+ ino, extents_buf, ext_num);
RETURN(rc);
}
+int cmobd_reint_oss(struct obd_device *obd, void *record, int opcode)
+{
+ switch (opcode) {
+ case OST_CREATE:
+ return cmobd_create_reint(obd, record);
+ case OST_SETATTR:
+ return cmobd_setattr_reint(obd, record);
+ case OST_WRITE:
+ return cmobd_write_reint(obd, record);
+ default:
+ CERROR("unrecognized oss reint opcode %d\n",
+ opcode);
+ return -EINVAL;
+ }
+}