1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
8 #if defined(__KERNEL__)
11 * struct ptlrpc_client
13 #include <linux/lustre_net.h>
15 * struct obd_connect_data
16 * struct lustre_handle
18 #include <linux/lustre_idl.h>
20 #include <linux/lu_object.h>
22 struct md_device_operations;
24 struct ptlrpc_service_conf {
28 int psc_max_reply_size;
31 int psc_watchdog_timeout; /* in ms */
38 struct lu_device md_lu_dev;
39 struct md_device_operations *md_ops;
42 struct md_device_operations {
43 int (*mdo_root_get)(struct md_device *m, struct lu_fid *f);
44 int (*mdo_mkdir)(struct md_object *o, const char *name,
45 struct md_object *child);
50 struct md_device mdt_md_dev;
51 struct ptlrpc_service *mdt_service;
52 struct ptlrpc_service_conf mdt_service_conf;
53 /* DLM name-space for meta-data locks maintained by this server */
54 struct ldlm_namespace *mdt_namespace;
55 /* ptlrpc handle for MDS->client connections (for lock ASTs). */
56 struct ptlrpc_client mdt_ldlm_client;
57 /* underlying device */
58 struct md_device *mdt_child;
62 struct lu_object mo_lu;
65 static inline int lu_device_is_md(struct lu_device *d)
67 return d->ld_type->ldt_tags & LU_DEVICE_MD;
70 static inline struct md_object *lu2md(struct lu_object *o)
72 LASSERT(lu_device_is_md(o->lo_dev));
73 return container_of(o, struct md_object, mo_lu);
76 static inline struct md_device *md_device_get(struct md_object *o)
78 LASSERT(lu_device_is_md(o->mo_lu.lo_dev));
79 return container_of(o->mo_lu.lo_dev, struct md_device, md_lu_dev);
83 struct lu_object_header mot_header;
84 struct md_object mot_obj;
87 struct mdt_lock_handle {
88 struct lustre_handle mlh_lh;
93 void mdt_lock_handle_init(struct mdt_lock_handle *lh);
94 void mdt_lock_handle_fini(struct mdt_lock_handle *lh);
97 struct md_object mod_obj;
101 struct lu_object oo_lu;
102 struct dentry *oo_dentry;
105 int md_device_init(struct md_device *md, struct lu_device_type *t);
106 void md_device_fini(struct md_device *md);
109 MDT_REP_BUF_NR_MAX = 8
119 * Common data shared by mdt-level handlers. This is allocated per-thread to
120 * reduce stack consumption.
122 struct mdt_thread_info {
123 struct mdt_device *mti_mdt;
125 * number of buffers in reply message.
129 * sizes of reply buffers.
131 int mti_rep_buf_size[MDT_REP_BUF_NR_MAX];
133 * Body for "habeo corpus" operations.
135 struct mdt_body *mti_body;
137 * Host object. This is released at the end of mdt_handler().
139 struct mdt_object *mti_object;
141 * Additional fail id that can be set by handler. Passed to
142 * target_send_reply().
146 * A couple of lock handles.
148 struct mdt_lock_handle mti_lh[MDT_LH_NR];
152 int fid_lock(struct ldlm_namespace *, const struct lu_fid *,
153 struct lustre_handle *, ldlm_mode_t, __u64);
155 void fid_unlock(struct ldlm_namespace *, const struct lu_fid *,
156 struct lustre_handle *, ldlm_mode_t);
158 #endif /* __KERNEL__ */