1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * This file is part of Lustre, http://www.lustre.org
7 * See also lustre_idl.h for wire formats of requests.
14 # include <linux/fs.h>
15 # include <linux/dcache.h>
16 # ifdef CONFIG_FS_POSIX_ACL
17 # include <linux/xattr_acl.h>
20 #include <linux/lustre_handles.h>
21 #include <libcfs/kp30.h>
22 #include <linux/lustre_idl.h>
23 #include <linux/lustre_lib.h>
24 #include <linux/lustre_dlm.h>
25 #include <linux/lustre_log.h>
26 #include <linux/lustre_export.h>
28 struct ldlm_lock_desc;
30 struct ptlrpc_connection;
33 struct ptlrpc_request;
38 struct mds_body *body;
39 struct lov_stripe_md *lsm;
40 #ifdef CONFIG_FS_POSIX_ACL
41 struct posix_acl *posix_acl;
55 struct mds_update_record {
57 struct ll_fid *ur_fid1;
58 struct ll_fid *ur_fid2;
66 struct llog_cookie *ur_logcookies;
67 struct iattr ur_iattr;
68 struct lvfs_ucred ur_uc;
73 struct lvfs_grp_hash_entry *ur_grp_entry;
76 /* file data for open files on MDS */
77 struct mds_file_data {
78 struct portals_handle mfd_handle; /* must be first */
79 atomic_t mfd_refcount;
80 struct list_head mfd_list; /* protected by med_open_lock */
83 struct dentry *mfd_dentry;
87 #ifdef CONFIG_FS_POSIX_ACL
88 #define LUSTRE_POSIX_ACL_MAX_ENTRIES (32)
89 #define LUSTRE_POSIX_ACL_MAX_SIZE \
90 (xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES))
92 #define LUSTRE_POSIX_ACL_MAX_SIZE 0
96 int mds_reint_rec(struct mds_update_record *r, int offset,
97 struct ptlrpc_request *req, struct lustre_handle *);
101 struct dentry *mds_fid2locked_dentry(struct obd_device *obd, struct ll_fid *fid,
102 struct vfsmount **mnt, int lock_mode,
103 struct lustre_handle *lockh,
105 struct dentry *mds_fid2dentry(struct mds_obd *mds, struct ll_fid *fid,
106 struct vfsmount **mnt);
107 int mds_update_server_data(struct obd_device *, int force_sync);
110 int mds_fs_setup(struct obd_device *obddev, struct vfsmount *mnt);
111 int mds_fs_cleanup(struct obd_device *obddev);
116 /* mdc/mdc_locks.c */
117 int it_disposition(struct lookup_intent *it, int flag);
118 void it_set_disposition(struct lookup_intent *it, int flag);
119 int it_open_error(int phase, struct lookup_intent *it);
120 void mdc_set_lock_data(__u64 *lockh, void *data);
121 int mdc_change_cbdata(struct obd_export *exp, struct ll_fid *fid,
122 ldlm_iterator_t it, void *data);
123 int mdc_intent_lock(struct obd_export *exp,
124 struct mdc_op_data *,
125 void *lmm, int lmmsize,
126 struct lookup_intent *, int,
127 struct ptlrpc_request **reqp,
128 ldlm_blocking_callback cb_blocking, int extra_lock_flags);
129 int mdc_enqueue(struct obd_export *exp,
131 struct lookup_intent *it,
133 struct mdc_op_data *data,
134 struct lustre_handle *lockh,
137 ldlm_completion_callback cb_completion,
138 ldlm_blocking_callback cb_blocking,
139 void *cb_data, int extra_lock_flags);
141 /* mdc/mdc_request.c */
142 int mdc_init_ea_size(struct obd_export *mdc_exp, struct obd_export *lov_exp);
144 int mdc_req2lustre_md(struct ptlrpc_request *req, int offset,
145 struct obd_export *exp, struct lustre_md *md);
146 void mdc_free_lustre_md(struct obd_export *exp, struct lustre_md *md);
148 int mdc_getstatus(struct obd_export *exp, struct ll_fid *rootfid);
149 int mdc_getattr(struct obd_export *exp, struct ll_fid *fid,
150 obd_valid valid, unsigned int ea_size,
151 struct ptlrpc_request **request);
152 int mdc_getattr_name(struct obd_export *exp, struct ll_fid *fid,
153 const char *filename, int namelen, unsigned long valid,
154 unsigned int ea_size, struct ptlrpc_request **request);
155 int mdc_setattr(struct obd_export *exp, struct mdc_op_data *data,
156 struct iattr *iattr, void *ea, int ealen, void *ea2, int ea2len,
157 struct ptlrpc_request **request);
158 int mdc_setxattr(struct obd_export *exp, struct ll_fid *fid,
159 obd_valid valid, const char *xattr_name,
160 const char *input, int input_size,
161 int output_size, int flags,
162 struct ptlrpc_request **request);
163 int mdc_getxattr(struct obd_export *exp, struct ll_fid *fid,
164 obd_valid valid, const char *xattr_name,
165 const char *input, int input_size,
166 int output_size, struct ptlrpc_request **request);
167 int mdc_open(struct obd_export *exp, obd_id ino, int type, int flags,
168 struct lov_mds_md *lmm, int lmm_size, struct lustre_handle *fh,
169 struct ptlrpc_request **);
170 struct obd_client_handle;
171 void mdc_set_open_replay_data(struct obd_client_handle *och,
172 struct ptlrpc_request *open_req);
173 void mdc_clear_open_replay_data(struct obd_client_handle *och);
174 int mdc_close(struct obd_export *, struct obdo *, struct obd_client_handle *,
175 struct ptlrpc_request **);
176 int mdc_readpage(struct obd_export *exp, struct ll_fid *mdc_fid, __u64 offset,
177 struct page *, struct ptlrpc_request **);
178 int mdc_create(struct obd_export *exp, struct mdc_op_data *op_data,
179 const void *data, int datalen, int mode, __u32 uid, __u32 gid,
180 __u32 cap_effective, __u64 rdev,struct ptlrpc_request **request);
181 int mdc_unlink(struct obd_export *exp, struct mdc_op_data *data,
182 struct ptlrpc_request **request);
183 int mdc_link(struct obd_export *exp, struct mdc_op_data *data,
184 struct ptlrpc_request **);
185 int mdc_rename(struct obd_export *exp, struct mdc_op_data *data,
186 const char *old, int oldlen, const char *new, int newlen,
187 struct ptlrpc_request **request);
188 int mdc_sync(struct obd_export *exp, struct ll_fid *fid,
189 struct ptlrpc_request **);
190 int mdc_create_client(struct obd_uuid uuid, struct ptlrpc_client *cl);
192 /* Store the generation of a newly-created inode in |req| for replay. */
193 void mdc_store_inode_generation(struct ptlrpc_request *req, int reqoff,
195 int mdc_llog_process(struct obd_export *, char *logname, llog_cb_t, void *data);
196 int mdc_done_writing(struct obd_export *exp, struct obdo *);
198 static inline void mdc_pack_fid(struct ll_fid *fid, obd_id ino, __u32 gen,
202 fid->generation = gen;
206 /* ioctls for trying requests */
207 #define IOC_REQUEST_TYPE 'f'
208 #define IOC_REQUEST_MIN_NR 30
210 #define IOC_REQUEST_GETATTR _IOWR('f', 30, long)
211 #define IOC_REQUEST_READPAGE _IOWR('f', 31, long)
212 #define IOC_REQUEST_SETATTR _IOWR('f', 32, long)
213 #define IOC_REQUEST_CREATE _IOWR('f', 33, long)
214 #define IOC_REQUEST_OPEN _IOWR('f', 34, long)
215 #define IOC_REQUEST_CLOSE _IOWR('f', 35, long)
216 #define IOC_REQUEST_MAX_NR 35