From 15925a22c31fada29ad39c3347408aadeb08f4c5 Mon Sep 17 00:00:00 2001 From: wangdi Date: Fri, 28 Jul 2006 08:40:55 +0000 Subject: [PATCH] Branch: b_new_cmd add tmp way to calculate lsm_object_id in mds --- lustre/lov/lov_ea.c | 6 ++---- lustre/mdd/mdd_lov.c | 11 +++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lustre/lov/lov_ea.c b/lustre/lov/lov_ea.c index 980ff24..438422f 100755 --- a/lustre/lov/lov_ea.c +++ b/lustre/lov/lov_ea.c @@ -56,15 +56,13 @@ static int lsm_lmm_verify_common(struct lov_mds_md *lmm, int lmm_bytes, lov_dump_lmm_v1(D_WARNING, lmm); return -EINVAL; } - -/* FIXME: commetted out by huanghua@clusterfs.com */ -/* + if (lmm->lmm_object_id == 0) { CERROR("zero object id\n"); lov_dump_lmm_v1(D_WARNING, lmm); return -EINVAL; } -*/ + if (lmm->lmm_pattern != cpu_to_le32(LOV_PATTERN_RAID0)) { CERROR("bad striping pattern\n"); lov_dump_lmm_v1(D_WARNING, lmm); diff --git a/lustre/mdd/mdd_lov.c b/lustre/mdd/mdd_lov.c index 495cfa7..f08bb49 100644 --- a/lustre/mdd/mdd_lov.c +++ b/lustre/mdd/mdd_lov.c @@ -44,6 +44,7 @@ #include #include #include +#include #include #include "mdd_internal.h" @@ -308,6 +309,15 @@ int mdd_lov_set_md(const struct lu_context *ctxt, struct md_object *pobj, RETURN(rc); } +/*FIXME: this is for create lsm object id, which should identify the + * lsm object unique in the whole mds, as I see. But it seems, we + * still not need it now. right? so just borrow the ll_fid_build_ino + */ +static obd_id mdd_lov_create_id(struct lu_fid *fid) +{ + return ((fid_seq(fid) - 1) * LUSTRE_SEQ_MAX_WIDTH + fid_oid(fid)); +} + int mdd_lov_create(const struct lu_context *ctxt, struct mdd_device *mdd, struct mdd_object *child, struct lov_mds_md **lmm, int *lmm_size) @@ -324,6 +334,7 @@ int mdd_lov_create(const struct lu_context *ctxt, struct mdd_device *mdd, oa->o_uid = 0; /* must have 0 uid / gid on OST */ oa->o_gid = 0; oa->o_mode = S_IFREG | 0600; + oa->o_id = mdd_lov_create_id(&mdd2lu_obj(child)->lo_header->loh_fid); oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLFLAGS | OBD_MD_FLMODE | OBD_MD_FLUID | OBD_MD_FLGID; oa->o_size = 0; -- 1.8.3.1