4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.gnu.org/licenses/gpl-2.0.html
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
26 * Copyright (c) 2011, 2016, Intel Corporation.
29 * This file is part of Lustre, http://www.lustre.org/
30 * Lustre is a trademark of Sun Microsystems, Inc.
32 * lustre/include/lustre_req_layout.h
34 * Lustre Metadata Target (mdt) request handler
36 * Author: Nikita Danilov <nikita@clusterfs.com>
39 #ifndef _LUSTRE_REQ_LAYOUT_H__
40 #define _LUSTRE_REQ_LAYOUT_H__
42 #include <linux/types.h>
44 /** \defgroup req_layout req_layout
53 struct ptlrpc_request;
61 /* Maximal number of fields (buffers) in a request message. */
62 #define REQ_MAX_FIELD_NR 10
65 struct ptlrpc_request *rc_req;
66 const struct req_format *rc_fmt;
67 enum req_location rc_loc;
68 __u32 rc_area[RCL_NR][REQ_MAX_FIELD_NR];
71 void req_capsule_init(struct req_capsule *pill, struct ptlrpc_request *req,
72 enum req_location location);
73 void req_capsule_fini(struct req_capsule *pill);
75 void req_capsule_set(struct req_capsule *pill, const struct req_format *fmt);
76 void req_capsule_client_dump(struct req_capsule *pill);
77 void req_capsule_server_dump(struct req_capsule *pill);
78 void req_capsule_init_area(struct req_capsule *pill);
79 size_t req_capsule_filled_sizes(struct req_capsule *pill,
80 enum req_location loc);
81 int req_capsule_server_pack(struct req_capsule *pill);
83 void *req_capsule_client_get(struct req_capsule *pill,
84 const struct req_msg_field *field);
85 void *req_capsule_client_swab_get(struct req_capsule *pill,
86 const struct req_msg_field *field,
88 void *req_capsule_client_sized_get(struct req_capsule *pill,
89 const struct req_msg_field *field,
91 void *req_capsule_server_get(struct req_capsule *pill,
92 const struct req_msg_field *field);
93 void *req_capsule_server_sized_get(struct req_capsule *pill,
94 const struct req_msg_field *field,
96 void *req_capsule_server_swab_get(struct req_capsule *pill,
97 const struct req_msg_field *field,
99 void *req_capsule_server_sized_swab_get(struct req_capsule *pill,
100 const struct req_msg_field *field,
101 __u32 len, void *swabber);
102 const void *req_capsule_other_get(struct req_capsule *pill,
103 const struct req_msg_field *field);
105 void req_capsule_set_size(struct req_capsule *pill,
106 const struct req_msg_field *field,
107 enum req_location loc, __u32 size);
108 __u32 req_capsule_get_size(const struct req_capsule *pill,
109 const struct req_msg_field *field,
110 enum req_location loc);
111 __u32 req_capsule_msg_size(struct req_capsule *pill, enum req_location loc);
112 __u32 req_capsule_fmt_size(__u32 magic, const struct req_format *fmt,
113 enum req_location loc);
114 void req_capsule_extend(struct req_capsule *pill, const struct req_format *fmt);
116 int req_capsule_has_field(const struct req_capsule *pill,
117 const struct req_msg_field *field,
118 enum req_location loc);
119 int req_capsule_field_present(const struct req_capsule *pill,
120 const struct req_msg_field *field,
121 enum req_location loc);
122 void req_capsule_shrink(struct req_capsule *pill,
123 const struct req_msg_field *field,
125 enum req_location loc);
126 int req_capsule_server_grow(struct req_capsule *pill,
127 const struct req_msg_field *field,
129 int req_layout_init(void);
130 void req_layout_fini(void);
132 extern struct req_format RQF_OBD_PING;
133 extern struct req_format RQF_OBD_SET_INFO;
134 extern struct req_format RQF_SEC_CTX;
135 extern struct req_format RQF_OBD_IDX_READ;
137 extern struct req_format RQF_MGS_TARGET_REG;
138 extern struct req_format RQF_MGS_SET_INFO;
139 extern struct req_format RQF_MGS_CONFIG_READ;
140 /* fid/fld req_format */
141 extern struct req_format RQF_SEQ_QUERY;
142 extern struct req_format RQF_FLD_QUERY;
143 extern struct req_format RQF_FLD_READ;
145 extern struct req_format RQF_MDS_CONNECT;
146 extern struct req_format RQF_MDS_DISCONNECT;
147 extern struct req_format RQF_MDS_STATFS;
148 extern struct req_format RQF_MDS_GET_ROOT;
149 extern struct req_format RQF_MDS_SYNC;
150 extern struct req_format RQF_MDS_GETXATTR;
151 extern struct req_format RQF_MDS_GETATTR;
152 extern struct req_format RQF_OUT_UPDATE;
155 * This is format of direct (non-intent) MDS_GETATTR_NAME request.
157 extern struct req_format RQF_MDS_GETATTR_NAME;
158 extern struct req_format RQF_MDS_CLOSE;
159 extern struct req_format RQF_MDS_INTENT_CLOSE;
160 extern struct req_format RQF_MDS_CONNECT;
161 extern struct req_format RQF_MDS_DISCONNECT;
162 extern struct req_format RQF_MDS_GET_INFO;
163 extern struct req_format RQF_MDS_READPAGE;
164 extern struct req_format RQF_MDS_REINT;
165 extern struct req_format RQF_MDS_REINT_CREATE;
166 extern struct req_format RQF_MDS_REINT_CREATE_ACL;
167 extern struct req_format RQF_MDS_REINT_CREATE_SLAVE;
168 extern struct req_format RQF_MDS_REINT_CREATE_SYM;
169 extern struct req_format RQF_MDS_REINT_OPEN;
170 extern struct req_format RQF_MDS_REINT_UNLINK;
171 extern struct req_format RQF_MDS_REINT_LINK;
172 extern struct req_format RQF_MDS_REINT_RENAME;
173 extern struct req_format RQF_MDS_REINT_SETATTR;
174 extern struct req_format RQF_MDS_REINT_SETXATTR;
175 extern struct req_format RQF_MDS_QUOTACTL;
176 extern struct req_format RQF_QUOTA_DQACQ;
177 extern struct req_format RQF_MDS_SWAP_LAYOUTS;
178 extern struct req_format RQF_MDS_REINT_MIGRATE;
179 /* MDS hsm formats */
180 extern struct req_format RQF_MDS_HSM_STATE_GET;
181 extern struct req_format RQF_MDS_HSM_STATE_SET;
182 extern struct req_format RQF_MDS_HSM_ACTION;
183 extern struct req_format RQF_MDS_HSM_PROGRESS;
184 extern struct req_format RQF_MDS_HSM_CT_REGISTER;
185 extern struct req_format RQF_MDS_HSM_CT_UNREGISTER;
186 extern struct req_format RQF_MDS_HSM_REQUEST;
188 extern struct req_format RQF_OST_CONNECT;
189 extern struct req_format RQF_OST_DISCONNECT;
190 extern struct req_format RQF_OST_QUOTACTL;
191 extern struct req_format RQF_OST_GETATTR;
192 extern struct req_format RQF_OST_SETATTR;
193 extern struct req_format RQF_OST_CREATE;
194 extern struct req_format RQF_OST_PUNCH;
195 extern struct req_format RQF_OST_SYNC;
196 extern struct req_format RQF_OST_DESTROY;
197 extern struct req_format RQF_OST_BRW_READ;
198 extern struct req_format RQF_OST_BRW_WRITE;
199 extern struct req_format RQF_OST_STATFS;
200 extern struct req_format RQF_OST_SET_GRANT_INFO;
201 extern struct req_format RQF_OST_GET_INFO;
202 extern struct req_format RQF_OST_GET_INFO_LAST_ID;
203 extern struct req_format RQF_OST_GET_INFO_LAST_FID;
204 extern struct req_format RQF_OST_SET_INFO_LAST_FID;
205 extern struct req_format RQF_OST_GET_INFO_FIEMAP;
206 extern struct req_format RQF_OST_LADVISE;
208 /* LDLM req_format */
209 extern struct req_format RQF_LDLM_ENQUEUE;
210 extern struct req_format RQF_LDLM_ENQUEUE_LVB;
211 extern struct req_format RQF_LDLM_CONVERT;
212 extern struct req_format RQF_LDLM_INTENT;
213 extern struct req_format RQF_LDLM_INTENT_BASIC;
214 extern struct req_format RQF_LDLM_INTENT_LAYOUT;
215 extern struct req_format RQF_LDLM_INTENT_GETATTR;
216 extern struct req_format RQF_LDLM_INTENT_OPEN;
217 extern struct req_format RQF_LDLM_INTENT_CREATE;
218 extern struct req_format RQF_LDLM_INTENT_UNLINK;
219 extern struct req_format RQF_LDLM_INTENT_GETXATTR;
220 extern struct req_format RQF_LDLM_INTENT_QUOTA;
221 extern struct req_format RQF_LDLM_CANCEL;
222 extern struct req_format RQF_LDLM_CALLBACK;
223 extern struct req_format RQF_LDLM_CP_CALLBACK;
224 extern struct req_format RQF_LDLM_BL_CALLBACK;
225 extern struct req_format RQF_LDLM_GL_CALLBACK;
226 extern struct req_format RQF_LDLM_GL_DESC_CALLBACK;
228 extern struct req_format RQF_LOG_CANCEL;
229 extern struct req_format RQF_LLOG_ORIGIN_HANDLE_CREATE;
230 extern struct req_format RQF_LLOG_ORIGIN_HANDLE_DESTROY;
231 extern struct req_format RQF_LLOG_ORIGIN_HANDLE_NEXT_BLOCK;
232 extern struct req_format RQF_LLOG_ORIGIN_HANDLE_PREV_BLOCK;
233 extern struct req_format RQF_LLOG_ORIGIN_HANDLE_READ_HEADER;
234 extern struct req_format RQF_LLOG_ORIGIN_CONNECT;
236 extern struct req_format RQF_CONNECT;
238 /* LFSCK req_format */
239 extern struct req_format RQF_LFSCK_NOTIFY;
240 extern struct req_format RQF_LFSCK_QUERY;
242 extern struct req_msg_field RMF_GENERIC_DATA;
243 extern struct req_msg_field RMF_PTLRPC_BODY;
244 extern struct req_msg_field RMF_MDT_BODY;
245 extern struct req_msg_field RMF_MDT_EPOCH;
246 extern struct req_msg_field RMF_OBD_STATFS;
247 extern struct req_msg_field RMF_NAME;
248 extern struct req_msg_field RMF_SYMTGT;
249 extern struct req_msg_field RMF_TGTUUID;
250 extern struct req_msg_field RMF_CLUUID;
251 extern struct req_msg_field RMF_SETINFO_VAL;
252 extern struct req_msg_field RMF_SETINFO_KEY;
253 extern struct req_msg_field RMF_GETINFO_VAL;
254 extern struct req_msg_field RMF_GETINFO_VALLEN;
255 extern struct req_msg_field RMF_GETINFO_KEY;
256 extern struct req_msg_field RMF_IDX_INFO;
257 extern struct req_msg_field RMF_CLOSE_DATA;
258 extern struct req_msg_field RMF_FILE_SECCTX_NAME;
259 extern struct req_msg_field RMF_FILE_SECCTX;
262 * connection handle received in MDS_CONNECT request.
264 extern struct req_msg_field RMF_CONN;
265 extern struct req_msg_field RMF_CONNECT_DATA;
266 extern struct req_msg_field RMF_DLM_REQ;
267 extern struct req_msg_field RMF_DLM_REP;
268 extern struct req_msg_field RMF_DLM_LVB;
269 extern struct req_msg_field RMF_DLM_GL_DESC;
270 extern struct req_msg_field RMF_LDLM_INTENT;
271 extern struct req_msg_field RMF_LAYOUT_INTENT;
272 extern struct req_msg_field RMF_MDT_MD;
273 extern struct req_msg_field RMF_REC_REINT;
274 extern struct req_msg_field RMF_EADATA;
275 extern struct req_msg_field RMF_EAVALS;
276 extern struct req_msg_field RMF_EAVALS_LENS;
277 extern struct req_msg_field RMF_ACL;
278 extern struct req_msg_field RMF_LOGCOOKIES;
279 extern struct req_msg_field RMF_CAPA1;
280 extern struct req_msg_field RMF_CAPA2;
281 extern struct req_msg_field RMF_OBD_QUOTACHECK;
282 extern struct req_msg_field RMF_OBD_QUOTACTL;
283 extern struct req_msg_field RMF_QUOTA_BODY;
284 extern struct req_msg_field RMF_STRING;
285 extern struct req_msg_field RMF_SWAP_LAYOUTS;
286 extern struct req_msg_field RMF_MDS_HSM_PROGRESS;
287 extern struct req_msg_field RMF_MDS_HSM_REQUEST;
288 extern struct req_msg_field RMF_MDS_HSM_USER_ITEM;
289 extern struct req_msg_field RMF_MDS_HSM_ARCHIVE;
290 extern struct req_msg_field RMF_HSM_USER_STATE;
291 extern struct req_msg_field RMF_HSM_STATE_SET;
292 extern struct req_msg_field RMF_MDS_HSM_CURRENT_ACTION;
293 extern struct req_msg_field RMF_MDS_HSM_REQUEST;
296 extern struct req_msg_field RMF_SEQ_OPC;
297 extern struct req_msg_field RMF_SEQ_RANGE;
298 extern struct req_msg_field RMF_FID_SPACE;
301 extern struct req_msg_field RMF_FLD_OPC;
302 extern struct req_msg_field RMF_FLD_MDFLD;
304 extern struct req_msg_field RMF_LLOGD_BODY;
305 extern struct req_msg_field RMF_LLOG_LOG_HDR;
306 extern struct req_msg_field RMF_LLOGD_CONN_BODY;
308 extern struct req_msg_field RMF_MGS_TARGET_INFO;
309 extern struct req_msg_field RMF_MGS_SEND_PARAM;
311 extern struct req_msg_field RMF_OST_BODY;
312 extern struct req_msg_field RMF_OBD_IOOBJ;
313 extern struct req_msg_field RMF_OBD_ID;
314 extern struct req_msg_field RMF_FID;
315 extern struct req_msg_field RMF_NIOBUF_REMOTE;
316 extern struct req_msg_field RMF_RCS;
317 extern struct req_msg_field RMF_FIEMAP_KEY;
318 extern struct req_msg_field RMF_FIEMAP_VAL;
319 extern struct req_msg_field RMF_OST_ID;
321 /* MGS config read message format */
322 extern struct req_msg_field RMF_MGS_CONFIG_BODY;
323 extern struct req_msg_field RMF_MGS_CONFIG_RES;
326 extern struct req_msg_field RMF_U32;
328 /* OBJ update format */
329 extern struct req_msg_field RMF_OUT_UPDATE;
330 extern struct req_msg_field RMF_OUT_UPDATE_REPLY;
331 extern struct req_msg_field RMF_OUT_UPDATE_HEADER;
332 extern struct req_msg_field RMF_OUT_UPDATE_BUF;
335 extern struct req_msg_field RMF_LFSCK_REQUEST;
336 extern struct req_msg_field RMF_LFSCK_REPLY;
338 extern struct req_msg_field RMF_OST_LADVISE_HDR;
339 extern struct req_msg_field RMF_OST_LADVISE;
342 #endif /* _LUSTRE_REQ_LAYOUT_H__ */