From 40cacd2bc01d00f856f437dc97a62917688a0d07 Mon Sep 17 00:00:00 2001 From: yury Date: Fri, 18 Jun 2004 16:04:20 +0000 Subject: [PATCH] - added lmv_destroy_obj() which will be used for destroying splitted object on inode deleting. --- lustre/lmv/lmv_internal.h | 18 +++++++++++------- lustre/lmv/lmv_objmgr.c | 24 +++++++++++++++++++++++- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/lustre/lmv/lmv_internal.h b/lustre/lmv/lmv_internal.h index a8eb88c..6a40f09 100644 --- a/lustre/lmv/lmv_internal.h +++ b/lustre/lmv/lmv_internal.h @@ -21,46 +21,50 @@ struct lmv_obj { struct obd_device *obd; /* pointer to LMV itself */ }; -int lmv_dirobj_blocking_ast(struct ldlm_lock *, - struct ldlm_lock_desc *, - void *, int); +int lmv_setup_mgr(struct obd_device *obd); +void lmv_cleanup_mgr(struct obd_device *obd); +int lmv_check_connect(struct obd_device *obd); void lmv_put_obj(struct lmv_obj *obj); struct lmv_obj *lmv_get_obj(struct lmv_obj *obj); -int lmv_setup_mgr(struct obd_device *obd); -void lmv_cleanup_mgr(struct obd_device *obd); - struct lmv_obj *lmv_grab_obj(struct obd_device *obd, struct ll_fid *fid); int lmv_create_obj(struct obd_export *exp, struct ll_fid *fid, struct mea *mea); +int lmv_destroy_obj(struct obd_export *exp, struct ll_fid *fid); + int lmv_intent_lock(struct obd_export *, struct ll_uctxt *, struct ll_fid *, const char *, int, void *, int, struct ll_fid *, struct lookup_intent *, int, struct ptlrpc_request **, ldlm_blocking_callback); + int lmv_intent_lookup(struct obd_export *, struct ll_uctxt *, struct ll_fid *, const char *, int, void *, int, struct ll_fid *, struct lookup_intent *, int, struct ptlrpc_request **, ldlm_blocking_callback); + int lmv_intent_getattr(struct obd_export *, struct ll_uctxt *, struct ll_fid *, const char *, int, void *, int, struct ll_fid *, struct lookup_intent *, int, struct ptlrpc_request **, ldlm_blocking_callback); + int lmv_intent_open(struct obd_export *, struct ll_uctxt *, struct ll_fid *, const char *, int, void *, int, struct ll_fid *, struct lookup_intent *, int, struct ptlrpc_request **, ldlm_blocking_callback); -int lmv_check_connect(struct obd_device *obd); int lmv_revalidate_slaves(struct obd_export *, struct ptlrpc_request **, struct ll_fid *, struct lookup_intent *, int, ldlm_blocking_callback cb_blocking); int lmv_get_mea_and_update_object(struct obd_export *, struct ll_fid *); +int lmv_dirobj_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *, + void *, int); + static inline struct mea * is_body_of_splitted_dir(struct ptlrpc_request *req, int offset) { diff --git a/lustre/lmv/lmv_objmgr.c b/lustre/lmv/lmv_objmgr.c index c395748..95c20e6 100644 --- a/lustre/lmv/lmv_objmgr.c +++ b/lustre/lmv/lmv_objmgr.c @@ -172,7 +172,7 @@ __lmv_create_obj(struct obd_device *obd, struct ll_fid *fid, if (obj) RETURN(obj); - /* no such object yet, allocate and initialize them. */ + /* no such object yet, allocate and initialize it. */ obj = __lmv_alloc_obj(obd, fid, mea); if (!obj) RETURN(NULL); @@ -264,6 +264,28 @@ cleanup: } int +lmv_destroy_obj(struct obd_export *exp, struct ll_fid *fid) +{ + struct obd_device *obd = exp->exp_obd; + struct lmv_obj *obj; + int rc = 0; + ENTRY; + + spin_lock(&lmv_obj_list_lock); + + obj = __lmv_grab_obj(obd, fid); + if (obj) { + list_del(&obj->list); + lmv_put_obj(obj); + lmv_put_obj(obj); + rc = 1; + } + + spin_unlock(&lmv_obj_list_lock); + RETURN(rc); +} + +int lmv_setup_mgr(struct obd_device *obd) { CWARN("LMV object manager setup\n"); -- 1.8.3.1