From: nikita Date: Sun, 28 May 2006 18:16:36 +0000 (+0000) Subject: ->ldo_object_alloc(): add lu_object_headers to arguments, so that allocation may... X-Git-Tag: v1_8_0_110~486^2~1748 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=2e1cfac07a267ec3de6d0d604b53325260857bc7;p=fs%2Flustre-release.git ->ldo_object_alloc(): add lu_object_headers to arguments, so that allocation may depend on fid (needed for cmm) --- diff --git a/lustre/cmm/cmm_internal.h b/lustre/cmm/cmm_internal.h index b6c7c7d..78b762a 100644 --- a/lustre/cmm/cmm_internal.h +++ b/lustre/cmm/cmm_internal.h @@ -94,6 +94,7 @@ static inline struct md_object *cmm2child_obj(struct cmm_object *o) /* cmm_object.c */ struct lu_object *cmm_object_alloc(const struct lu_context *ctx, + const struct lu_object_header *hdr, struct lu_device *); #endif /* __KERNEL__ */ #endif /* _CMM_INTERNAL_H */ diff --git a/lustre/cmm/cmm_object.c b/lustre/cmm/cmm_object.c index b9fddd7..5f0a5dd 100644 --- a/lustre/cmm/cmm_object.c +++ b/lustre/cmm/cmm_object.c @@ -68,6 +68,7 @@ static struct lu_device *cmm_get_child(struct cmm_device *d, __u32 num) } struct lu_object *cmm_object_alloc(const struct lu_context *ctx, + const struct lu_object_header *hdr, struct lu_device *ld) { struct cmm_object *co; @@ -110,7 +111,8 @@ static int cmm_object_init(const struct lu_context *ctx, struct lu_object *lo) if (c_dev == NULL) { rc = -ENOENT; } else { - c_obj = c_dev->ld_ops->ldo_object_alloc(ctx, c_dev); + c_obj = c_dev->ld_ops->ldo_object_alloc(ctx, + lo->lo_header, c_dev); if (c_obj != NULL) { struct cmm_object *co = lu2cmm_obj(lo); diff --git a/lustre/cmm/mdc_internal.h b/lustre/cmm/mdc_internal.h index 667f357..6a2d3df 100644 --- a/lustre/cmm/mdc_internal.h +++ b/lustre/cmm/mdc_internal.h @@ -78,6 +78,7 @@ static inline struct mdc_device *lu2mdc_dev(struct lu_device *ld) } struct lu_object *mdc_object_alloc(const struct lu_context *, + const struct lu_object_header *, struct lu_device *); #endif /* __KERNEL__ */ #endif /* _CMM_MDC_INTERNAL_H */ diff --git a/lustre/cmm/mdc_object.c b/lustre/cmm/mdc_object.c index f717b57..6543256 100644 --- a/lustre/cmm/mdc_object.c +++ b/lustre/cmm/mdc_object.c @@ -43,6 +43,7 @@ static struct md_dir_operations mdc_dir_ops; static struct lu_object_operations mdc_obj_ops; struct lu_object *mdc_object_alloc(const struct lu_context *ctx, + const struct lu_object_header *hdr, struct lu_device *ld) { struct mdc_object *mco; diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index e368d23..017d0f0 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -133,6 +133,7 @@ struct lu_device_operations { * result->lo_ops != NULL); */ struct lu_object *(*ldo_object_alloc)(const struct lu_context *ctx, + const struct lu_object_header *h, struct lu_device *d); /* * process config specific for device diff --git a/lustre/include/lustre_dlm.h b/lustre/include/lustre_dlm.h index 98b5044..e45f18c 100644 --- a/lustre/include/lustre_dlm.h +++ b/lustre/include/lustre_dlm.h @@ -476,7 +476,7 @@ void ldlm_lock_remove_from_lru(struct ldlm_lock *); struct ldlm_lock *ldlm_handle2lock_ns(struct ldlm_namespace *, const struct lustre_handle *); -static inline struct ldlm_lock *ldlm_handle2lock(struct lustre_handle *h) +static inline struct ldlm_lock *ldlm_handle2lock(const struct lustre_handle *h) { return __ldlm_handle2lock(h, 0); } diff --git a/lustre/mdd/mdd_handler.c b/lustre/mdd/mdd_handler.c index e76ad0d..ea9a3bb 100644 --- a/lustre/mdd/mdd_handler.c +++ b/lustre/mdd/mdd_handler.c @@ -119,6 +119,7 @@ static inline struct dt_device_operations *mdd_child_ops(struct mdd_device *d) } static struct lu_object *mdd_object_alloc(const struct lu_context *ctxt, + const struct lu_object_header *hdr, struct lu_device *d) { struct mdd_object *mdo; @@ -146,7 +147,7 @@ static int mdd_object_init(const struct lu_context *ctxt, struct lu_object *o) ENTRY; under = &d->mdd_child->dd_lu_dev; - below = under->ld_ops->ldo_object_alloc(ctxt, under); + below = under->ld_ops->ldo_object_alloc(ctxt, o->lo_header, under); if (below == NULL) RETURN(-ENOMEM); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 374ed2a..4dd3d63 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1739,6 +1739,7 @@ static int mdt_process_config(const struct lu_context *ctx, } static struct lu_object *mdt_object_alloc(const struct lu_context *ctxt, + const struct lu_object_header *hdr, struct lu_device *d) { struct mdt_object *mo; @@ -1768,7 +1769,7 @@ static int mdt_object_init(const struct lu_context *ctxt, struct lu_object *o) struct lu_object *below; under = &d->mdt_child->md_lu_dev; - below = under->ld_ops->ldo_object_alloc(ctxt, under); + below = under->ld_ops->ldo_object_alloc(ctxt, o->lo_header, under); if (below != NULL) { lu_object_add(o, below); return 0; diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index 3bc8ee7..9a57cd3 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -111,7 +111,8 @@ static struct lu_object *lu_object_alloc(const struct lu_context *ctxt, * Create top-level object slice. This will also create * lu_object_header. */ - top = s->ls_top_dev->ld_ops->ldo_object_alloc(ctxt, s->ls_top_dev); + top = s->ls_top_dev->ld_ops->ldo_object_alloc(ctxt, + NULL, s->ls_top_dev); if (IS_ERR(top)) RETURN(top); s->ls_total ++; @@ -496,7 +497,7 @@ EXPORT_SYMBOL(lu_object_add); int lu_object_header_init(struct lu_object_header *h) { memset(h, 0, sizeof *h); - h->loh_ref = 1; + h->loh_ref = 1; INIT_HLIST_NODE(&h->loh_hash); CFS_INIT_LIST_HEAD(&h->loh_lru); CFS_INIT_LIST_HEAD(&h->loh_layers); diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index 6dc3e71..d7a8feb5 100644 --- a/lustre/osd/osd_handler.c +++ b/lustre/osd/osd_handler.c @@ -124,6 +124,7 @@ static struct lu_device *osd_device_alloc (const struct lu_context *ctx, struct lu_device_type *t, struct lustre_cfg *cfg); static struct lu_object *osd_object_alloc (const struct lu_context *ctx, + const struct lu_object_header *hdr, struct lu_device *d); static struct inode *osd_iget (struct osd_thread_info *info, struct osd_device *dev, @@ -186,6 +187,7 @@ EXPORT_SYMBOL(dt_object_find); */ static struct lu_object *osd_object_alloc(const struct lu_context *ctx, + const struct lu_object_header *hdr, struct lu_device *d) { struct osd_object *mo; @@ -221,8 +223,6 @@ static int osd_object_init(const struct lu_context *ctxt, struct lu_object *l) result = osd_fid_lookup(ctxt, obj, lu_object_fid(l)); if (result == 0) { - /*FIXME: put osd_index_ops here for tmp fix WANGDI*/ - obj->oo_dt.do_index_ops = &osd_index_ops; if (obj->oo_inode != NULL) osd_object_init0(obj); } @@ -855,7 +855,7 @@ static int osd_index_init(const struct lu_context *ctx, dentry = osd_open(osd_sb(osd)->s_root, osd_fld_name, S_IFREG); if (IS_ERR(dentry)) { - CERROR("can not open %s, rc = %d \n", osd_fld_name, + CERROR("can not open %s, rc = %ld\n", osd_fld_name, PTR_ERR(dentry)); return (PTR_ERR(dentry)); } @@ -885,8 +885,6 @@ static struct dt_index_operations osd_index_ops = { .dio_lookup = osd_index_lookup, .dio_insert = osd_index_insert, .dio_probe = osd_index_probe, - .dio_init = osd_index_init, - .dio_fini = osd_index_fini, }; /*