From d526c68a4a703d7866d2318055654095d04a3675 Mon Sep 17 00:00:00 2001 From: tappro Date: Mon, 24 Apr 2006 08:54:14 +0000 Subject: [PATCH] cmm update --- lustre/cmm/cmm_internal.h | 16 ++++++++++++---- lustre/cmm/cmm_object.c | 33 +++++++++++++++++++++++---------- 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/lustre/cmm/cmm_internal.h b/lustre/cmm/cmm_internal.h index 3012c22..8904a14 100644 --- a/lustre/cmm/cmm_internal.h +++ b/lustre/cmm/cmm_internal.h @@ -28,15 +28,23 @@ #include #include +struct cmm_mdc_device { + struct md_device mdc_md_dev; + /* other MD servers in cluster */ + __u32 cmm_tgt_count; + struct list_head cmm_tgt_linkage; +}; + struct cmm_device { - struct md_device cmm_md_dev; + struct md_device cmm_md_dev; /* underlaying device in MDS stack, usually MDD */ - struct md_device *cmm_child; + struct md_device *cmm_child; /* other MD servers in cluster */ - struct md_device *cmm_cluster; + __u32 local_num; + __u32 cmm_tgt_count; + struct list_head cmm_targets; }; - static inline struct md_device_operations *cmm_child_ops(struct cmm_device *d) { return (d->cmm_child->md_ops); diff --git a/lustre/cmm/cmm_object.c b/lustre/cmm/cmm_object.c index 547aa33..4517ebe 100644 --- a/lustre/cmm/cmm_object.c +++ b/lustre/cmm/cmm_object.c @@ -37,6 +37,25 @@ static struct md_object_operations cmm_mo_ops; static struct lu_object_operations cmm_obj_ops; +static int cmm_fld_lookup(struct lu_fid *fid) +{ + /* return master MDS for now */ + return 0; +} + +/* get child device by mdsnum*/ +static struct lu_device *cmm_get_child(struct cmm_device *d, __u32 num) +{ + struct lu_device *next; + + if (likely(num != d->local_num)) { + next = &d->cmm_child->md_lu_dev; + } else { + next = &d->cmm_child->md_lu_dev; + } + return next; +} + struct lu_object *cmm_object_alloc(struct lu_context *ctx, struct lu_device *d) { @@ -61,19 +80,13 @@ int cmm_object_init(struct lu_context *ctxt, struct lu_object *o) struct cmm_device *d = lu2cmm_dev(o->lo_dev); struct lu_device *under; struct lu_object *below; - //struct lu_fid *fid = &o->lo_header->loh_fid; - //int mds_index; + struct lu_fid *fid = &o->lo_header->loh_fid; + int mdsnum; ENTRY; /* under device can be MDD or MDC */ -#if 0 - mds = cmm_fld_lookup(fid); - if (mds_index != d->local_index) - under = &d->cmm_lmv->md_lu_dev; - else -#endif - under = &d->cmm_child->md_lu_dev; - + mdsnum = cmm_fld_lookup(fid); + under = cmm_get_child(d, mdsnum); below = under->ld_ops->ldo_object_alloc(ctxt, under); if (below != NULL) { -- 1.8.3.1