lustre_dlm.h
来自「lustre 1.6.5 source code」· C头文件 代码 · 共 835 行 · 第 1/3 页
H
835 行
static cfs_debug_limit_state_t _ldlm_cdls; \ ldlm_lock_debug(&_ldlm_cdls, D_ERROR, lock, \ __FILE__, __FUNCTION__, __LINE__, \ "### " fmt , ##a); \} while (0)#define LDLM_DEBUG(lock, fmt, a...) do { \ ldlm_lock_debug(NULL, D_DLMTRACE, lock, \ __FILE__, __FUNCTION__, __LINE__, \ "### " fmt , ##a); \} while (0)#define LDLM_DEBUG_NOLOCK(format, a...) \ CDEBUG(D_DLMTRACE, "### " format "\n" , ##a)typedef int (*ldlm_processing_policy)(struct ldlm_lock *lock, int *flags, int first_enq, ldlm_error_t *err, struct list_head *work_list);/* * Iterators. */#define LDLM_ITER_CONTINUE 1 /* keep iterating */#define LDLM_ITER_STOP 2 /* stop iterating */typedef int (*ldlm_iterator_t)(struct ldlm_lock *, void *);typedef int (*ldlm_res_iterator_t)(struct ldlm_resource *, void *);int ldlm_resource_foreach(struct ldlm_resource *res, ldlm_iterator_t iter, void *closure);int ldlm_namespace_foreach(struct ldlm_namespace *ns, ldlm_iterator_t iter, void *closure);int ldlm_namespace_foreach_res(struct ldlm_namespace *ns, ldlm_res_iterator_t iter, void *closure);int ldlm_replay_locks(struct obd_import *imp);void ldlm_resource_iterate(struct ldlm_namespace *, struct ldlm_res_id *, ldlm_iterator_t iter, void *data);/* ldlm_flock.c */int ldlm_flock_completion_ast(struct ldlm_lock *lock, int flags, void *data);/* ldlm_extent.c */__u64 ldlm_extent_shift_kms(struct ldlm_lock *lock, __u64 old_kms);/* ldlm_lockd.c */int ldlm_server_blocking_ast(struct ldlm_lock *, struct ldlm_lock_desc *, void *data, int flag);int ldlm_server_completion_ast(struct ldlm_lock *lock, int flags, void *data);int ldlm_server_glimpse_ast(struct ldlm_lock *lock, void *data);int ldlm_handle_enqueue(struct ptlrpc_request *req, ldlm_completion_callback, ldlm_blocking_callback, ldlm_glimpse_callback);int ldlm_handle_convert(struct ptlrpc_request *req);int ldlm_handle_cancel(struct ptlrpc_request *req);int ldlm_request_cancel(struct ptlrpc_request *req, struct ldlm_request *dlm_req, int first);int ldlm_del_waiting_lock(struct ldlm_lock *lock);int ldlm_refresh_waiting_lock(struct ldlm_lock *lock);int ldlm_get_ref(void);void ldlm_put_ref(int force);/* ldlm_lock.c */ldlm_processing_policy ldlm_get_processing_policy(struct ldlm_resource *res);void ldlm_register_intent(struct ldlm_namespace *ns, ldlm_res_policy arg);void ldlm_lock2handle(struct ldlm_lock *lock, struct lustre_handle *lockh);struct ldlm_lock *__ldlm_handle2lock(struct lustre_handle *, int flags);void ldlm_cancel_callback(struct ldlm_lock *);int ldlm_lock_set_data(struct lustre_handle *, void *data);int ldlm_lock_remove_from_lru(struct ldlm_lock *);struct ldlm_lock *ldlm_handle2lock_ns(struct ldlm_namespace *, struct lustre_handle *);static inline struct ldlm_lock *ldlm_handle2lock(struct lustre_handle *h){ return __ldlm_handle2lock(h, 0);}static inline int ldlm_res_lvbo_update(struct ldlm_resource *res, struct lustre_msg *m, int buf_idx, int increase){ if (res->lr_namespace->ns_lvbo && res->lr_namespace->ns_lvbo->lvbo_update) { return res->lr_namespace->ns_lvbo->lvbo_update(res, m, buf_idx, increase); } return 0;}#define LDLM_LOCK_PUT(lock) \do { \ /*LDLM_DEBUG((lock), "put");*/ \ ldlm_lock_put(lock); \} while (0)#define LDLM_LOCK_GET(lock) \({ \ ldlm_lock_get(lock); \ /*LDLM_DEBUG((lock), "get");*/ \ lock; \})#define ldlm_lock_list_put(head, member, count) \({ \ struct ldlm_lock *_lock, *_next; \ int c = count; \ list_for_each_entry_safe(_lock, _next, head, member) { \ if (c-- == 0) \ break; \ list_del_init(&_lock->member); \ LDLM_LOCK_PUT(_lock); \ } \ LASSERT(c <= 0); \})struct ldlm_lock *ldlm_lock_get(struct ldlm_lock *lock);void ldlm_lock_put(struct ldlm_lock *lock);void ldlm_lock_destroy(struct ldlm_lock *lock);void ldlm_lock2desc(struct ldlm_lock *lock, struct ldlm_lock_desc *desc);void ldlm_lock_addref(struct lustre_handle *lockh, __u32 mode);void ldlm_lock_decref(struct lustre_handle *lockh, __u32 mode);void ldlm_lock_decref_and_cancel(struct lustre_handle *lockh, __u32 mode);void ldlm_lock_allow_match(struct ldlm_lock *lock);ldlm_mode_t ldlm_lock_match(struct ldlm_namespace *ns, int flags, struct ldlm_res_id *, ldlm_type_t type, ldlm_policy_data_t *, ldlm_mode_t mode, struct lustre_handle *);struct ldlm_resource *ldlm_lock_convert(struct ldlm_lock *lock, int new_mode, __u32 *flags);void ldlm_lock_cancel(struct ldlm_lock *lock);void ldlm_cancel_locks_for_export(struct obd_export *export);void ldlm_reprocess_all(struct ldlm_resource *res);void ldlm_reprocess_all_ns(struct ldlm_namespace *ns);void ldlm_lock_dump(int level, struct ldlm_lock *lock, int pos);void ldlm_lock_dump_handle(int level, struct lustre_handle *);void ldlm_unlink_lock_skiplist(struct ldlm_lock *req);/* resource.c */struct ldlm_namespace *ldlm_namespace_new(char *name, ldlm_side_t client, ldlm_appetite_t apt);int ldlm_namespace_cleanup(struct ldlm_namespace *ns, int flags);int ldlm_namespace_free(struct ldlm_namespace *ns, int force);void ldlm_namespace_move(struct ldlm_namespace *ns, ldlm_side_t client);struct ldlm_namespace *ldlm_namespace_first(ldlm_side_t client);void ldlm_namespace_get(struct ldlm_namespace *ns);void ldlm_namespace_put(struct ldlm_namespace *ns, int wakeup);void ldlm_namespace_get_nolock(struct ldlm_namespace *ns);void ldlm_namespace_put_nolock(struct ldlm_namespace *ns, int wakeup);int ldlm_proc_setup(void);#ifdef LPROCFSvoid ldlm_proc_cleanup(void);#elsestatic inline void ldlm_proc_cleanup(void) {}#endif/* resource.c - internal */struct ldlm_resource *ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent, struct ldlm_res_id, ldlm_type_t type, int create);struct ldlm_resource *ldlm_resource_getref(struct ldlm_resource *res);int ldlm_resource_putref(struct ldlm_resource *res);void ldlm_resource_add_lock(struct ldlm_resource *res, struct list_head *head, struct ldlm_lock *lock);void ldlm_resource_unlink_lock(struct ldlm_lock *lock);void ldlm_res2desc(struct ldlm_resource *res, struct ldlm_resource_desc *desc);void ldlm_dump_all_namespaces(ldlm_side_t client, int level);void ldlm_namespace_dump(int level, struct ldlm_namespace *);void ldlm_resource_dump(int level, struct ldlm_resource *);int ldlm_lock_change_resource(struct ldlm_namespace *, struct ldlm_lock *, struct ldlm_res_id);/* ldlm_request.c */int ldlm_expired_completion_wait(void *data);int ldlm_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, void *data, int flag);int ldlm_glimpse_ast(struct ldlm_lock *lock, void *reqp);int ldlm_completion_ast(struct ldlm_lock *lock, int flags, void *data);int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **req, struct ldlm_enqueue_info *einfo, struct ldlm_res_id res_id, ldlm_policy_data_t *policy, int *flags, void *lvb, __u32 lvb_len, void *lvb_swabber, struct lustre_handle *lockh, int async);struct ptlrpc_request *ldlm_prep_enqueue_req(struct obd_export *exp, int bufcount, int *size, struct list_head *head, int count);struct ptlrpc_request *ldlm_prep_elc_req(struct obd_export *exp, int version, int opc, int bufcount, int *size, int bufoff, int canceloff, struct list_head *cancels, int count);int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req, ldlm_type_t type, __u8 with_policy, ldlm_mode_t mode, int *flags, void *lvb, __u32 lvb_len, void *lvb_swabber, struct lustre_handle *lockh, int rc);int ldlm_cli_enqueue_local(struct ldlm_namespace *ns, struct ldlm_res_id *res_id, ldlm_type_t type, ldlm_policy_data_t *policy, ldlm_mode_t mode, int *flags, ldlm_blocking_callback blocking, ldlm_completion_callback completion, ldlm_glimpse_callback glimpse, void *data, __u32 lvb_len, void *lvb_swabber, struct lustre_handle *lockh);int ldlm_server_ast(struct lustre_handle *lockh, struct ldlm_lock_desc *new, void *data, __u32 data_len);int ldlm_cli_convert(struct lustre_handle *, int new_mode, __u32 *flags);int ldlm_cli_update_pool(struct ptlrpc_request *req);int ldlm_cli_cancel(struct lustre_handle *lockh);int ldlm_cli_cancel_unused(struct ldlm_namespace *, struct ldlm_res_id *, int flags, void *opaque);int ldlm_cli_cancel_req(struct obd_export *exp, struct list_head *head, int count);int ldlm_cli_join_lru(struct ldlm_namespace *, struct ldlm_res_id *, int join);int ldlm_cancel_resource_local(struct ldlm_resource *res, struct list_head *cancels, ldlm_policy_data_t *policy, ldlm_mode_t mode, int lock_flags, int cancel_flags, void *opaque);int ldlm_cli_cancel_list(struct list_head *head, int count, struct ptlrpc_request *req, int off);/* mds/handler.c *//* This has to be here because recursive inclusion sucks. */int intent_disposition(struct ldlm_reply *rep, int flag);void intent_set_disposition(struct ldlm_reply *rep, int flag);/* ioctls for trying requests */#define IOC_LDLM_TYPE 'f'#define IOC_LDLM_MIN_NR 40#define IOC_LDLM_TEST _IOWR('f', 40, long)#define IOC_LDLM_DUMP _IOWR('f', 41, long)#define IOC_LDLM_REGRESS_START _IOWR('f', 42, long)#define IOC_LDLM_REGRESS_STOP _IOWR('f', 43, long)#define IOC_LDLM_MAX_NR 43static inline void lock_res(struct ldlm_resource *res){ spin_lock(&res->lr_lock);}static inline void unlock_res(struct ldlm_resource *res){ spin_unlock(&res->lr_lock);}static inline void check_res_locked(struct ldlm_resource *res){ LASSERT_SPIN_LOCKED(&res->lr_lock);}struct ldlm_resource * lock_res_and_lock(struct ldlm_lock *lock);void unlock_res_and_lock(struct ldlm_lock *lock);/* ldlm_pool.c */void ldlm_pools_recalc(ldlm_side_t client);int ldlm_pools_init(void);void ldlm_pools_fini(void);void ldlm_pools_wakeup(void);int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns, int idx, ldlm_side_t client);int ldlm_pool_shrink(struct ldlm_pool *pl, int nr, unsigned int gfp_mask);void ldlm_pool_fini(struct ldlm_pool *pl);int ldlm_pool_setup(struct ldlm_pool *pl, int limit);int ldlm_pool_recalc(struct ldlm_pool *pl);__u64 ldlm_pool_get_slv(struct ldlm_pool *pl);__u32 ldlm_pool_get_limit(struct ldlm_pool *pl);void ldlm_pool_set_slv(struct ldlm_pool *pl, __u64 slv);void ldlm_pool_set_limit(struct ldlm_pool *pl, __u32 limit);void ldlm_pool_add(struct ldlm_pool *pl, struct ldlm_lock *lock);void ldlm_pool_del(struct ldlm_pool *pl, struct ldlm_lock *lock);#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?