From: nikita Date: Fri, 28 Apr 2006 21:57:01 +0000 (+0000) Subject: split part of md_operations into md_dir_operations. Cannot test as fld does not work X-Git-Tag: v1_8_0_110~486^2~1906 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=9ae1383dae478010c91e799aa14a1c65586b7864;p=fs%2Flustre-release.git split part of md_operations into md_dir_operations. Cannot test as fld does not work --- diff --git a/lustre/cmm/cmm_object.c b/lustre/cmm/cmm_object.c index 392c4ac..4bfc375 100644 --- a/lustre/cmm/cmm_object.c +++ b/lustre/cmm/cmm_object.c @@ -35,6 +35,7 @@ #include "cmm_internal.h" static struct md_object_operations cmm_mo_ops; +static struct md_dir_operations cmm_dir_ops; static struct lu_object_operations cmm_obj_ops; static int cmm_fld_lookup(struct lu_fid *fid) @@ -69,6 +70,7 @@ struct lu_object *cmm_object_alloc(struct lu_context *ctx, o = &mo->cmo_obj.mo_lu; lu_object_init(o, NULL, d); mo->cmo_obj.mo_ops = &cmm_mo_ops; + mo->cmo_obj.mo_dir_ops = &cmm_dir_ops; o->lo_ops = &cmm_obj_ops; RETURN(o); } else @@ -184,7 +186,7 @@ int cmm_mkdir(struct lu_context *ctxt, struct lu_attr* attr, struct cmm_object *cmm_parent = md2cmm_obj(md_parent); struct md_object *next = cmm2child_obj(cmm_parent); - return next->mo_ops->moo_mkdir(ctxt, attr, next, name, md_child); + return next->mo_dir_ops->mdo_mkdir(ctxt, attr, next, name, md_child); } int cmm_attr_get(struct lu_context *ctxt, struct md_object *obj, @@ -195,12 +197,15 @@ int cmm_attr_get(struct lu_context *ctxt, struct md_object *obj, return next->mo_ops->moo_attr_get(ctxt, next, attr); } +static struct md_dir_operations cmm_dir_ops = { + .mdo_mkdir = cmm_mkdir +// .mdo_rename = cmm_rename, +// .mdo_link = cmm_link, +}; + static struct md_object_operations cmm_mo_ops = { - .moo_mkdir = cmm_mkdir, .moo_attr_get = cmm_attr_get, // .moo_attr_set = cmm_attr_set, -// .moo_rename = cmm_rename, -// .moo_link = cmm_link, // .moo_xattr_get = cmm_xattr_get, // .moo_xattr_set = cmm_xattr_set, }; diff --git a/lustre/fld/fld_iam.c b/lustre/fld/fld_iam.c index 36283d5..2fcf8f6 100644 --- a/lustre/fld/fld_iam.c +++ b/lustre/fld/fld_iam.c @@ -50,25 +50,31 @@ struct iam_rec; struct fld_info fld_info; -int fld_handle_insert(struct fld_info *fld_info, fidseq_t seq_num, mdsno_t mdsno) +int fld_handle_insert(struct fld_info *fld_info, + fidseq_t seq_num, mdsno_t mdsno) { handle_t *handle = NULL; + return 0; return iam_insert(handle, fld_info->fi_container, (struct iam_key *)&seq_num, (struct iam_rec *)&mdsno); } -int fld_handle_delete(struct fld_info *fld_info, fidseq_t seq_num, mdsno_t mds_num) +int fld_handle_delete(struct fld_info *fld_info, + fidseq_t seq_num, mdsno_t mds_num) { handle_t *handle = NULL; + return 0; return iam_delete(handle, fld_info->fi_container, (struct iam_key *)&seq_num); } -int fld_handle_lookup(struct fld_info *fld_info, fidseq_t seq_num, mdsno_t *mds_num) +int fld_handle_lookup(struct fld_info *fld_info, + fidseq_t seq_num, mdsno_t *mds_num) { mdsno_t mdsno; int result; + return 0; result = iam_lookup(fld_info->fi_container, (struct iam_key *)&seq_num, (struct iam_rec *)&mdsno); if (result == 0) @@ -152,21 +158,21 @@ int fld_info_init(struct fld_info *fld_info) int rc; ENTRY; - fld_file = filp_open("/fld", O_RDWR, S_IRWXU); + fld_file = filp_open("/dev/null", O_RDWR, S_IRWXU); /* sanity and security checks... */ OBD_ALLOC(fld_info->fi_container, sizeof(struct iam_container)); if (!fld_info->fi_container) RETURN(-ENOMEM); - rc =iam_container_init(fld_info->fi_container, &fld_param, - fld_file->f_dentry->d_inode); + rc = iam_container_init(fld_info->fi_container, &fld_param, + fld_file->f_dentry->d_inode); RETURN(rc); } void fld_info_fini(struct fld_info *fld_info) { iam_container_fini(fld_info->fi_container); - OBD_FREE(fld_info->fi_container, sizeof(struct iam_container)); + OBD_FREE(fld_info->fi_container, sizeof(struct iam_container)); OBD_FREE_PTR(fld_info); } diff --git a/lustre/include/linux/md_object.h b/lustre/include/linux/md_object.h index 9b238ce..fda7508 100644 --- a/lustre/include/linux/md_object.h +++ b/lustre/include/linux/md_object.h @@ -45,21 +45,10 @@ struct md_device; struct md_device_operations; struct md_object; +/* + * Operations implemented for each md object (both directory and leaf). + */ struct md_object_operations { - - /* meta-data object operations related handlers */ - int (*moo_mkdir)(struct lu_context *ctxt, struct lu_attr*, - struct md_object *obj, - const char *name, struct md_object *child); - - int (*moo_rename)(struct lu_context *ctxt, struct md_object *spobj, - struct md_object *tpobj, struct md_object *sobj, - const char *sname, struct md_object *tobj, - const char *tname); - - int (*moo_link)(struct lu_context *ctxt, struct md_object *tobj, - struct md_object *sobj, const char *name); - int (*moo_attr_get)(struct lu_context *ctxt, struct md_object *dt, struct lu_attr *attr); int (*moo_attr_set)(struct lu_context *ctxt, struct md_object *dt, @@ -72,6 +61,24 @@ struct md_object_operations { void *buf, int buf_len, const char *name); }; +/* + * Operations implemented for each directory object. + */ +struct md_dir_operations { + int (*mdo_mkdir)(struct lu_context *ctxt, struct lu_attr *attr, + struct md_object *obj, + const char *name, struct md_object *child); + + int (*mdo_rename)(struct lu_context *ctxt, struct md_object *spobj, + struct md_object *tpobj, struct md_object *sobj, + const char *sname, struct md_object *tobj, + const char *tname); + + int (*mdo_link)(struct lu_context *ctxt, struct md_object *tobj, + struct md_object *sobj, const char *name); + +}; + struct md_device_operations { /* method for getting/setting device wide back stored config data, like * last used meta-sequence, etc. */ @@ -94,6 +101,7 @@ struct md_device { struct md_object { struct lu_object mo_lu; struct md_object_operations *mo_ops; + struct md_dir_operations *mo_dir_ops; }; static inline int lu_device_is_md(const struct lu_device *d) diff --git a/lustre/mdd/mdd_handler.c b/lustre/mdd/mdd_handler.c index 4608129..6b25d47 100644 --- a/lustre/mdd/mdd_handler.c +++ b/lustre/mdd/mdd_handler.c @@ -58,6 +58,7 @@ static void mdd_unlock(struct lu_context *ctx, struct mdd_object *obj, enum dt_lock_mode mode); static struct md_object_operations mdd_obj_ops; +static struct md_dir_operations mdd_dir_ops; static struct lu_object_operations mdd_lu_obj_ops; static int lu_device_is_mdd(struct lu_device *d) @@ -113,6 +114,7 @@ static struct lu_object *mdd_object_alloc(struct lu_context *ctxt, o = &mdo->mod_obj.mo_lu; lu_object_init(o, NULL, d); mdo->mod_obj.mo_ops = &mdd_obj_ops; + mdo->mod_obj.mo_dir_ops = &mdd_dir_ops; o->lo_ops = &mdd_lu_obj_ops; return &mdo->mod_obj.mo_lu; } else @@ -725,10 +727,13 @@ struct md_device_operations mdd_ops = { .mdo_statfs = mdd_statfs }; +static struct md_dir_operations mdd_dir_ops = { + .mdo_mkdir = mdd_mkdir, + .mdo_rename = mdd_rename, + .mdo_link = mdd_link +}; + static struct md_object_operations mdd_obj_ops = { - .moo_mkdir = mdd_mkdir, - .moo_rename = mdd_rename, - .moo_link = mdd_link, .moo_attr_get = mdd_attr_get, .moo_attr_set = mdd_attr_set, .moo_xattr_get = mdd_xattr_get, diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index a0e7ab2..57a4556 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -59,10 +59,10 @@ static int mdt_md_mkdir(struct mdt_thread_info *info, struct lustre_handle *lock if (!IS_ERR(child)) { struct md_object *next = mdt_object_child(parent); - result = next->mo_ops->moo_mkdir(info->mti_ctxt, - &info->mti_attr, - next, info->mti_rr.rr_name, - mdt_object_child(child)); + result = next->mo_dir_ops->mdo_mkdir(info->mti_ctxt, + &info->mti_attr, + next, info->mti_rr.rr_name, + mdt_object_child(child)); mdt_object_put(info->mti_ctxt, child); } else result = PTR_ERR(child);