From: nikita Date: Fri, 19 May 2006 18:28:23 +0000 (+0000) Subject: make ->ldo_object_free() a per-object method ->loo_object_free() X-Git-Tag: v1_8_0_110~486^2~1788 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=06390459ca8412b7f3ed61bd9cab73728b41f55e;p=fs%2Flustre-release.git make ->ldo_object_free() a per-object method ->loo_object_free() --- diff --git a/lustre/cmm/cmm_device.c b/lustre/cmm/cmm_device.c index e44aa43..c97a0f1 100644 --- a/lustre/cmm/cmm_device.c +++ b/lustre/cmm/cmm_device.c @@ -150,7 +150,6 @@ static int cmm_process_config(const struct lu_context *ctx, static struct lu_device_operations cmm_lu_ops = { .ldo_object_alloc = cmm_object_alloc, - .ldo_object_free = cmm_object_free, .ldo_process_config = cmm_process_config }; diff --git a/lustre/cmm/cmm_internal.h b/lustre/cmm/cmm_internal.h index 0d6a43f..b6c7c7d 100644 --- a/lustre/cmm/cmm_internal.h +++ b/lustre/cmm/cmm_internal.h @@ -95,7 +95,5 @@ 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, struct lu_device *); -void cmm_object_free(const struct lu_context *ctx, struct lu_object *o); - #endif /* __KERNEL__ */ #endif /* _CMM_INTERNAL_H */ diff --git a/lustre/cmm/cmm_object.c b/lustre/cmm/cmm_object.c index 2b13cb9..a14faa2 100644 --- a/lustre/cmm/cmm_object.c +++ b/lustre/cmm/cmm_object.c @@ -87,14 +87,14 @@ struct lu_object *cmm_object_alloc(const struct lu_context *ctx, RETURN(lo); } -void cmm_object_free(const struct lu_context *ctx, struct lu_object *lo) +static void cmm_object_free(const struct lu_context *ctx, struct lu_object *lo) { struct cmm_object *co = lu2cmm_obj(lo); lu_object_fini(lo); OBD_FREE_PTR(co); } -int cmm_object_init(const struct lu_context *ctx, struct lu_object *lo) +static int cmm_object_init(const struct lu_context *ctx, struct lu_object *lo) { struct cmm_device *cd = lu2cmm_dev(lo->lo_dev); struct lu_device *c_dev; @@ -138,6 +138,7 @@ static int cmm_object_print(const struct lu_context *ctx, static struct lu_object_operations cmm_obj_ops = { .loo_object_init = cmm_object_init, + .loo_object_free = cmm_object_free, .loo_object_print = cmm_object_print, .loo_object_exists = cmm_object_exists }; diff --git a/lustre/cmm/mdc_device.c b/lustre/cmm/mdc_device.c index 41f5cbb..67a60d7 100644 --- a/lustre/cmm/mdc_device.c +++ b/lustre/cmm/mdc_device.c @@ -146,7 +146,6 @@ static int mdc_process_config(const struct lu_context *ctx, static struct lu_device_operations mdc_lu_ops = { .ldo_object_alloc = mdc_object_alloc, - .ldo_object_free = mdc_object_free, .ldo_process_config = mdc_process_config }; diff --git a/lustre/cmm/mdc_internal.h b/lustre/cmm/mdc_internal.h index a24e29d..667f357 100644 --- a/lustre/cmm/mdc_internal.h +++ b/lustre/cmm/mdc_internal.h @@ -77,11 +77,7 @@ static inline struct mdc_device *lu2mdc_dev(struct lu_device *ld) return container_of0(ld, struct mdc_device, mc_md_dev.md_lu_dev); } -int mdc_object_init(const struct lu_context *, struct lu_object*); struct lu_object *mdc_object_alloc(const struct lu_context *, struct lu_device *); -void mdc_object_free(const struct lu_context *, struct lu_object *); -void mdc_object_release(const struct lu_context *, struct lu_object *); - #endif /* __KERNEL__ */ #endif /* _CMM_MDC_INTERNAL_H */ diff --git a/lustre/cmm/mdc_object.c b/lustre/cmm/mdc_object.c index 64aa1c9..f717b57 100644 --- a/lustre/cmm/mdc_object.c +++ b/lustre/cmm/mdc_object.c @@ -62,7 +62,7 @@ struct lu_object *mdc_object_alloc(const struct lu_context *ctx, RETURN(NULL); } -int mdc_object_init(const struct lu_context *ctx, struct lu_object *lo) +static int mdc_object_init(const struct lu_context *ctx, struct lu_object *lo) { //struct mdc_device *d = lu2mdc_dev(o->lo_dev); //struct lu_device *under; @@ -73,14 +73,15 @@ int mdc_object_init(const struct lu_context *ctx, struct lu_object *lo) RETURN(0); } -void mdc_object_free(const struct lu_context *ctx, struct lu_object *lo) +static void mdc_object_free(const struct lu_context *ctx, struct lu_object *lo) { struct mdc_object *mco = lu2mdc_obj(lo); lu_object_fini(lo); OBD_FREE_PTR(mco); } -void mdc_object_release(const struct lu_context *ctx, struct lu_object *lo) +static void mdc_object_release(const struct lu_context *ctx, + struct lu_object *lo) { return; } @@ -166,6 +167,7 @@ static struct md_object_operations mdc_mo_ops = { static struct lu_object_operations mdc_obj_ops = { .loo_object_init = mdc_object_init, .loo_object_release = mdc_object_release, + .loo_object_free = mdc_object_free, .loo_object_print = mdc_object_print, .loo_object_exists = mdc_object_exists }; diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index 1096bc2..e368d23 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -135,12 +135,6 @@ struct lu_device_operations { struct lu_object *(*ldo_object_alloc)(const struct lu_context *ctx, struct lu_device *d); /* - * Dual to ->ldo_object_alloc(). Called when object is removed from - * memory. - */ - void (*ldo_object_free)(const struct lu_context *ctx, struct lu_object *o); - - /* * process config specific for device */ int (*ldo_process_config)(const struct lu_context *ctx, @@ -163,13 +157,20 @@ struct lu_object_operations { int (*loo_object_init)(const struct lu_context *ctx, struct lu_object *o); /* - * Called before ->ldo_object_free() to signal that object is being + * Called before ->loo_object_free() to signal that object is being * destroyed. Dual to ->loo_object_init(). */ void (*loo_object_delete)(const struct lu_context *ctx, struct lu_object *o); /* + * Dual to ->ldo_object_alloc(). Called when object is removed from + * memory. + */ + void (*loo_object_free)(const struct lu_context *ctx, + struct lu_object *o); + + /* * Called when last active reference to the object is released (and * object returns to the cache). */ diff --git a/lustre/mdd/mdd_handler.c b/lustre/mdd/mdd_handler.c index b5ef373..fa6e6b4 100644 --- a/lustre/mdd/mdd_handler.c +++ b/lustre/mdd/mdd_handler.c @@ -434,13 +434,13 @@ static int mdd_process_config(const struct lu_context *ctx, static struct lu_device_operations mdd_lu_ops = { .ldo_object_alloc = mdd_object_alloc, - .ldo_object_free = mdd_object_free, .ldo_process_config = mdd_process_config }; static struct lu_object_operations mdd_lu_obj_ops = { .loo_object_init = mdd_object_init, .loo_object_release = mdd_object_release, + .loo_object_free = mdd_object_free, .loo_object_print = mdd_object_print, .loo_object_exists = mdd_object_exists }; diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index a4bf538..32e935f 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1615,13 +1615,13 @@ static int mdt_object_print(const struct lu_context *ctxt, static struct lu_device_operations mdt_lu_ops = { .ldo_object_alloc = mdt_object_alloc, - .ldo_object_free = mdt_object_free, .ldo_process_config = mdt_process_config }; static struct lu_object_operations mdt_obj_ops = { .loo_object_init = mdt_object_init, .loo_object_release = mdt_object_release, + .loo_object_free = mdt_object_free, .loo_object_print = mdt_object_print, .loo_object_exists = mdt_object_exists }; diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index 6d3b5a9..3b03a27 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -162,7 +162,7 @@ static void lu_object_free(const struct lu_context *ctx, struct lu_object *o) -- o->lo_dev->ld_site->ls_total; /* * Then, splice object layers into stand-alone list, and call - * ->ldo_object_free() on all layers to free memory. Splice is + * ->loo_object_free() on all layers to free memory. Splice is * necessary, because lu_object_header is freed together with the * top-level slice. */ @@ -171,8 +171,8 @@ static void lu_object_free(const struct lu_context *ctx, struct lu_object *o) while (!list_empty(&splice)) { o = container_of0(splice.next, struct lu_object, lo_linkage); list_del_init(&o->lo_linkage); - LASSERT(lu_object_ops(o)->ldo_object_free != NULL); - lu_object_ops(o)->ldo_object_free(ctx, o); + LASSERT(o->lo_ops->loo_object_free != NULL); + o->lo_ops->loo_object_free(ctx, o); } } diff --git a/lustre/osd/osd_handler.c b/lustre/osd/osd_handler.c index f6d2f15..cf2bddc 100644 --- a/lustre/osd/osd_handler.c +++ b/lustre/osd/osd_handler.c @@ -1127,13 +1127,13 @@ static struct lu_object_operations osd_lu_obj_ops = { .loo_object_init = osd_object_init, .loo_object_delete = osd_object_delete, .loo_object_release = osd_object_release, + .loo_object_free = osd_object_free, .loo_object_print = osd_object_print, .loo_object_exists = osd_object_exists }; static struct lu_device_operations osd_lu_ops = { .ldo_object_alloc = osd_object_alloc, - .ldo_object_free = osd_object_free, .ldo_process_config = osd_process_config };