From: John L. Hammond Date: Fri, 29 Mar 2013 16:28:11 +0000 (-0500) Subject: LU-3059 dt: shrink dt_object by 8 bytes on x86_64 X-Git-Tag: 2.3.64~23 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=e1649d2115af001ead43afe927377d2edc50593c LU-3059 dt: shrink dt_object by 8 bytes on x86_64 Merge struct dt_lock_operations (containing only do_object_lock) into dt_object_operations. The DT types that use these two structures do not have enough variation in their methods to justify separate structures and it removes an 8 byte pointer member from struct dt_object. Signed-off-by: John L. Hammond Change-Id: I4372ba23f0f7691ac86e391772a6a6157311cfda Reviewed-on: http://review.whamcloud.com/5892 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/dt_object.h b/lustre/include/dt_object.h index 2d7c0df..fafe05d 100644 --- a/lustre/include/dt_object.h +++ b/lustre/include/dt_object.h @@ -449,6 +449,14 @@ struct dt_object_operations { */ int (*do_data_get)(const struct lu_env *env, struct dt_object *dt, void **data); + + /** + * Lock object. + */ + int (*do_object_lock)(const struct lu_env *env, struct dt_object *dt, + struct lustre_handle *lh, + struct ldlm_enqueue_info *einfo, + void *policy); }; /** @@ -526,12 +534,6 @@ struct dt_body_operations { struct lustre_capa *capa); }; -struct dt_lock_operations { - int (*do_object_lock)(const struct lu_env *env, struct dt_object *dt, - struct lustre_handle *lh, - struct ldlm_enqueue_info *einfo, - void *policy); -}; /** * Incomplete type of index record. */ @@ -675,7 +677,6 @@ struct dt_object { const struct dt_object_operations *do_ops; const struct dt_body_operations *do_body_ops; const struct dt_index_operations *do_index_ops; - const struct dt_lock_operations *do_lock_ops; }; /* @@ -889,9 +890,9 @@ static inline int dt_object_lock(const struct lu_env *env, void *policy) { LASSERT(o); - LASSERT(o->do_lock_ops); - LASSERT(o->do_lock_ops->do_object_lock); - return o->do_lock_ops->do_object_lock(env, o, lh, einfo, policy); + LASSERT(o->do_ops); + LASSERT(o->do_ops->do_object_lock); + return o->do_ops->do_object_lock(env, o, lh, einfo, policy); } int dt_lookup_dir(const struct lu_env *env, struct dt_object *dir, diff --git a/lustre/lod/lod_dev.c b/lustre/lod/lod_dev.c index 17dca0c..652ebf4 100644 --- a/lustre/lod/lod_dev.c +++ b/lustre/lod/lod_dev.c @@ -98,7 +98,6 @@ int lod_fld_lookup(const struct lu_env *env, struct lod_device *lod, extern struct lu_object_operations lod_lu_obj_ops; extern struct lu_object_operations lod_lu_robj_ops; extern struct dt_object_operations lod_obj_ops; -extern struct dt_lock_operations lod_lock_ops; /* Slab for OSD object allocation */ cfs_mem_cache_t *lod_object_kmem; @@ -142,7 +141,6 @@ struct lu_object *lod_object_alloc(const struct lu_env *env, lu_obj = lod2lu_obj(lod_obj); dt_object_init(&lod_obj->ldo_obj, NULL, dev); lod_obj->ldo_obj.do_ops = &lod_obj_ops; - lod_obj->ldo_obj.do_lock_ops = &lod_lock_ops; if (likely(mds == lu_site2seq(dev->ld_site)->ss_node_id)) lu_obj->lo_ops = &lod_lu_obj_ops; else diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 55067e0..e2e632c 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -1102,6 +1102,23 @@ static int lod_object_sync(const struct lu_env *env, struct dt_object *dt) return dt_object_sync(env, dt_object_child(dt)); } +static int lod_object_lock(const struct lu_env *env, + struct dt_object *dt, struct lustre_handle *lh, + struct ldlm_enqueue_info *einfo, + void *policy) +{ + struct dt_object *next = dt_object_child(dt); + int rc; + ENTRY; + + /* + * declare setattr on the local object + */ + rc = dt_object_lock(env, next, lh, einfo, policy); + + RETURN(rc); +} + struct dt_object_operations lod_obj_ops = { .do_read_lock = lod_object_read_lock, .do_write_lock = lod_object_write_lock, @@ -1129,28 +1146,9 @@ struct dt_object_operations lod_obj_ops = { .do_ref_del = lod_ref_del, .do_capa_get = lod_capa_get, .do_object_sync = lod_object_sync, + .do_object_lock = lod_object_lock, }; -static int lod_object_lock(const struct lu_env *env, - struct dt_object *dt, struct lustre_handle *lh, - struct ldlm_enqueue_info *einfo, - void *policy) -{ - struct dt_object *next = dt_object_child(dt); - int rc; - ENTRY; - - /* - * declare setattr on the local object - */ - rc = dt_object_lock(env, next, lh, einfo, policy); - - RETURN(rc); -} - -struct dt_lock_operations lod_lock_ops = { - .do_object_lock = lod_object_lock, -}; static ssize_t lod_read(const struct lu_env *env, struct dt_object *dt, struct lu_buf *buf, loff_t *pos, struct lustre_capa *capa) diff --git a/lustre/osp/osp_internal.h b/lustre/osp/osp_internal.h index c32356b..4b4f849 100644 --- a/lustre/osp/osp_internal.h +++ b/lustre/osp/osp_internal.h @@ -198,7 +198,6 @@ struct osp_object { extern struct lu_object_operations osp_lu_obj_ops; extern const struct dt_device_operations osp_dt_ops; extern struct dt_object_operations osp_md_obj_ops; -extern struct dt_lock_operations osp_md_lock_ops; struct osp_thread_info { struct lu_buf osi_lb; diff --git a/lustre/osp/osp_md_object.c b/lustre/osp/osp_md_object.c index 5dcec3c..4532233 100644 --- a/lustre/osp/osp_md_object.c +++ b/lustre/osp/osp_md_object.c @@ -1095,30 +1095,6 @@ static int osp_md_object_destroy(const struct lu_env *env, RETURN(rc); } -struct dt_object_operations osp_md_obj_ops = { - .do_read_lock = osp_md_object_read_lock, - .do_write_lock = osp_md_object_write_lock, - .do_read_unlock = osp_md_object_read_unlock, - .do_write_unlock = osp_md_object_write_unlock, - .do_write_locked = osp_md_object_write_locked, - .do_declare_create = osp_md_declare_object_create, - .do_create = osp_md_object_create, - .do_declare_ref_add = osp_md_declare_ref_add, - .do_ref_add = osp_md_object_ref_add, - .do_declare_ref_del = osp_md_declare_object_ref_del, - .do_ref_del = osp_md_object_ref_del, - .do_declare_destroy = osp_md_declare_object_destroy, - .do_destroy = osp_md_object_destroy, - .do_ah_init = osp_md_ah_init, - .do_attr_get = osp_md_attr_get, - .do_declare_attr_set = osp_md_declare_attr_set, - .do_attr_set = osp_md_attr_set, - .do_declare_xattr_set = osp_md_declare_xattr_set, - .do_xattr_set = osp_md_xattr_set, - .do_xattr_get = osp_md_xattr_get, - .do_index_try = osp_md_index_try, -}; - static int osp_md_object_lock(const struct lu_env *env, struct dt_object *dt, struct lustre_handle *lh, @@ -1157,7 +1133,27 @@ static int osp_md_object_lock(const struct lu_env *env, return rc == ELDLM_OK ? 0 : -EIO; } -struct dt_lock_operations osp_md_lock_ops = { +struct dt_object_operations osp_md_obj_ops = { + .do_read_lock = osp_md_object_read_lock, + .do_write_lock = osp_md_object_write_lock, + .do_read_unlock = osp_md_object_read_unlock, + .do_write_unlock = osp_md_object_write_unlock, + .do_write_locked = osp_md_object_write_locked, + .do_declare_create = osp_md_declare_object_create, + .do_create = osp_md_object_create, + .do_declare_ref_add = osp_md_declare_ref_add, + .do_ref_add = osp_md_object_ref_add, + .do_declare_ref_del = osp_md_declare_object_ref_del, + .do_ref_del = osp_md_object_ref_del, + .do_declare_destroy = osp_md_declare_object_destroy, + .do_destroy = osp_md_object_destroy, + .do_ah_init = osp_md_ah_init, + .do_attr_get = osp_md_attr_get, + .do_declare_attr_set = osp_md_declare_attr_set, + .do_attr_set = osp_md_attr_set, + .do_declare_xattr_set = osp_md_declare_xattr_set, + .do_xattr_set = osp_md_xattr_set, + .do_xattr_get = osp_md_xattr_get, + .do_index_try = osp_md_index_try, .do_object_lock = osp_md_object_lock, }; - diff --git a/lustre/osp/osp_object.c b/lustre/osp/osp_object.c index 3c59035..1f44a87 100644 --- a/lustre/osp/osp_object.c +++ b/lustre/osp/osp_object.c @@ -370,7 +370,6 @@ static int osp_object_init(const struct lu_env *env, struct lu_object *o, po->opo_obj.do_ops = &osp_md_obj_ops; o->lo_header->loh_attr |= LOHA_REMOTE; - po->opo_obj.do_lock_ops = &osp_md_lock_ops; rc = po->opo_obj.do_ops->do_attr_get(env, lu2dt_obj(o), la, NULL); if (rc == 0)