1 /* 2 * GPL HEADER START 3 * 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 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. 9 * 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). 15 * 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.sun.com/software/products/lustre/docs/GPLv2.pdf 19 * 20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 21 * CA 95054 USA or visit www.sun.com if you need additional information or 22 * have any questions. 23 * 24 * GPL HEADER END 25 */ 26 /* 27 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 28 * Use is subject to license terms. 29 * 30 * Copyright (c) 2011, 2012, Intel Corporation. 31 */ 32 /* 33 * This file is part of Lustre, http://www.lustre.org/ 34 * Lustre is a trademark of Sun Microsystems, Inc. 35 * 36 * lustre/include/lustre_req_layout.h 37 * 38 * Lustre Metadata Target (mdt) request handler 39 * 40 * Author: Nikita Danilov <nikita@clusterfs.com> 41 */ 42 43 #ifndef _LUSTRE_REQ_LAYOUT_H__ 44 #define _LUSTRE_REQ_LAYOUT_H__ 45 46 /** \defgroup req_layout req_layout 47 * 48 * @{ 49 */ 50 51 struct req_msg_field; 52 struct req_format; 53 struct req_capsule; 54 55 struct ptlrpc_request; 56 57 enum req_location { 58 RCL_CLIENT, 59 RCL_SERVER, 60 RCL_NR 61 }; 62 63 /* Maximal number of fields (buffers) in a request message. */ 64 #define REQ_MAX_FIELD_NR 9 65 66 struct req_capsule { 67 struct ptlrpc_request *rc_req; 68 const struct req_format *rc_fmt; 69 enum req_location rc_loc; 70 __u32 rc_area[RCL_NR][REQ_MAX_FIELD_NR]; 71 }; 72 73 #if !defined(__REQ_LAYOUT_USER__) 74 75 /* struct ptlrpc_request, lustre_msg* */ 76 #include "lustre_net.h" 77 78 void req_capsule_init(struct req_capsule *pill, struct ptlrpc_request *req, 79 enum req_location location); 80 void req_capsule_fini(struct req_capsule *pill); 81 82 void req_capsule_set(struct req_capsule *pill, const struct req_format *fmt); 83 int req_capsule_filled_sizes(struct req_capsule *pill, enum req_location loc); 84 int req_capsule_server_pack(struct req_capsule *pill); 85 86 void *req_capsule_client_get(struct req_capsule *pill, 87 const struct req_msg_field *field); 88 void *req_capsule_client_swab_get(struct req_capsule *pill, 89 const struct req_msg_field *field, 90 void *swabber); 91 void *req_capsule_client_sized_get(struct req_capsule *pill, 92 const struct req_msg_field *field, 93 int len); 94 void *req_capsule_server_get(struct req_capsule *pill, 95 const struct req_msg_field *field); 96 void *req_capsule_server_sized_get(struct req_capsule *pill, 97 const struct req_msg_field *field, 98 int len); 99 void *req_capsule_server_swab_get(struct req_capsule *pill, 100 const struct req_msg_field *field, 101 void *swabber); 102 void *req_capsule_server_sized_swab_get(struct req_capsule *pill, 103 const struct req_msg_field *field, 104 int len, void *swabber); 105 106 void req_capsule_set_size(struct req_capsule *pill, 107 const struct req_msg_field *field, 108 enum req_location loc, int size); 109 int req_capsule_get_size(const struct req_capsule *pill, 110 const struct req_msg_field *field, 111 enum req_location loc); 112 int req_capsule_msg_size(struct req_capsule *pill, enum req_location loc); 113 int req_capsule_fmt_size(__u32 magic, const struct req_format *fmt, 114 enum req_location loc); 115 void req_capsule_extend(struct req_capsule *pill, const struct req_format *fmt); 116 117 int req_capsule_has_field(const struct req_capsule *pill, 118 const struct req_msg_field *field, 119 enum req_location loc); 120 void req_capsule_shrink(struct req_capsule *pill, 121 const struct req_msg_field *field, 122 unsigned int newlen, 123 enum req_location loc); 124 int req_layout_init(void); 125 void req_layout_fini(void); 126 127 /* __REQ_LAYOUT_USER__ */ 128 #endif 129 130 extern struct req_format RQF_OBD_PING; 131 extern struct req_format RQF_OBD_SET_INFO; 132 extern struct req_format RQF_SEC_CTX; 133 extern struct req_format RQF_OBD_IDX_READ; 134 /* MGS req_format */ 135 extern struct req_format RQF_MGS_TARGET_REG; 136 extern struct req_format RQF_MGS_SET_INFO; 137 extern struct req_format RQF_MGS_CONFIG_READ; 138 /* fid/fld req_format */ 139 extern struct req_format RQF_SEQ_QUERY; 140 extern struct req_format RQF_FLD_QUERY; 141 /* MDS req_format */ 142 extern struct req_format RQF_MDS_CONNECT; 143 extern struct req_format RQF_MDS_DISCONNECT; 144 extern struct req_format RQF_MDS_STATFS; 145 extern struct req_format RQF_MDS_GETSTATUS; 146 extern struct req_format RQF_MDS_SYNC; 147 extern struct req_format RQF_MDS_GETXATTR; 148 extern struct req_format RQF_MDS_GETATTR; 149 extern struct req_format RQF_UPDATE_OBJ; 150 151 /* 152 * This is format of direct (non-intent) MDS_GETATTR_NAME request. 153 */ 154 extern struct req_format RQF_MDS_GETATTR_NAME; 155 extern struct req_format RQF_MDS_CLOSE; 156 extern struct req_format RQF_MDS_RELEASE_CLOSE; 157 extern struct req_format RQF_MDS_PIN; 158 extern struct req_format RQF_MDS_UNPIN; 159 extern struct req_format RQF_MDS_CONNECT; 160 extern struct req_format RQF_MDS_DISCONNECT; 161 extern struct req_format RQF_MDS_GET_INFO; 162 extern struct req_format RQF_MDS_READPAGE; 163 extern struct req_format RQF_MDS_WRITEPAGE; 164 extern struct req_format RQF_MDS_IS_SUBDIR; 165 extern struct req_format RQF_MDS_DONE_WRITING; 166 extern struct req_format RQF_MDS_REINT; 167 extern struct req_format RQF_MDS_REINT_CREATE; 168 extern struct req_format RQF_MDS_REINT_CREATE_RMT_ACL; 169 extern struct req_format RQF_MDS_REINT_CREATE_SLAVE; 170 extern struct req_format RQF_MDS_REINT_CREATE_SYM; 171 extern struct req_format RQF_MDS_REINT_OPEN; 172 extern struct req_format RQF_MDS_REINT_UNLINK; 173 extern struct req_format RQF_MDS_REINT_LINK; 174 extern struct req_format RQF_MDS_REINT_RENAME; 175 extern struct req_format RQF_MDS_REINT_SETATTR; 176 extern struct req_format RQF_MDS_REINT_SETXATTR; 177 extern struct req_format RQF_MDS_QUOTACHECK; 178 extern struct req_format RQF_MDS_QUOTACTL; 179 extern struct req_format RQF_QC_CALLBACK; 180 extern struct req_format RQF_QUOTA_DQACQ; 181 extern struct req_format RQF_MDS_SWAP_LAYOUTS; 182 /* MDS hsm formats */ 183 extern struct req_format RQF_MDS_HSM_STATE_GET; 184 extern struct req_format RQF_MDS_HSM_STATE_SET; 185 extern struct req_format RQF_MDS_HSM_ACTION; 186 extern struct req_format RQF_MDS_HSM_PROGRESS; 187 extern struct req_format RQF_MDS_HSM_CT_REGISTER; 188 extern struct req_format RQF_MDS_HSM_CT_UNREGISTER; 189 extern struct req_format RQF_MDS_HSM_REQUEST; 190 /* OST req_format */ 191 extern struct req_format RQF_OST_CONNECT; 192 extern struct req_format RQF_OST_DISCONNECT; 193 extern struct req_format RQF_OST_QUOTACHECK; 194 extern struct req_format RQF_OST_QUOTACTL; 195 extern struct req_format RQF_OST_GETATTR; 196 extern struct req_format RQF_OST_SETATTR; 197 extern struct req_format RQF_OST_CREATE; 198 extern struct req_format RQF_OST_PUNCH; 199 extern struct req_format RQF_OST_SYNC; 200 extern struct req_format RQF_OST_DESTROY; 201 extern struct req_format RQF_OST_BRW_READ; 202 extern struct req_format RQF_OST_BRW_WRITE; 203 extern struct req_format RQF_OST_STATFS; 204 extern struct req_format RQF_OST_SET_GRANT_INFO; 205 extern struct req_format RQF_OST_GET_INFO_GENERIC; 206 extern struct req_format RQF_OST_GET_INFO_LAST_ID; 207 extern struct req_format RQF_OST_GET_INFO_LAST_FID; 208 extern struct req_format RQF_OST_SET_INFO_LAST_FID; 209 extern struct req_format RQF_OST_GET_INFO_FIEMAP; 210 211 /* LDLM req_format */ 212 extern struct req_format RQF_LDLM_ENQUEUE; 213 extern struct req_format RQF_LDLM_ENQUEUE_LVB; 214 extern struct req_format RQF_LDLM_CONVERT; 215 extern struct req_format RQF_LDLM_INTENT; 216 extern struct req_format RQF_LDLM_INTENT_BASIC; 217 extern struct req_format RQF_LDLM_INTENT_LAYOUT; 218 extern struct req_format RQF_LDLM_INTENT_GETATTR; 219 extern struct req_format RQF_LDLM_INTENT_OPEN; 220 extern struct req_format RQF_LDLM_INTENT_CREATE; 221 extern struct req_format RQF_LDLM_INTENT_UNLINK; 222 extern struct req_format RQF_LDLM_INTENT_GETXATTR; 223 extern struct req_format RQF_LDLM_INTENT_QUOTA; 224 extern struct req_format RQF_LDLM_CANCEL; 225 extern struct req_format RQF_LDLM_CALLBACK; 226 extern struct req_format RQF_LDLM_CP_CALLBACK; 227 extern struct req_format RQF_LDLM_BL_CALLBACK; 228 extern struct req_format RQF_LDLM_GL_CALLBACK; 229 extern struct req_format RQF_LDLM_GL_DESC_CALLBACK; 230 /* LOG req_format */ 231 extern struct req_format RQF_LOG_CANCEL; 232 extern struct req_format RQF_LLOG_ORIGIN_HANDLE_CREATE; 233 extern struct req_format RQF_LLOG_ORIGIN_HANDLE_DESTROY; 234 extern struct req_format RQF_LLOG_ORIGIN_HANDLE_NEXT_BLOCK; 235 extern struct req_format RQF_LLOG_ORIGIN_HANDLE_PREV_BLOCK; 236 extern struct req_format RQF_LLOG_ORIGIN_HANDLE_READ_HEADER; 237 extern struct req_format RQF_LLOG_ORIGIN_CONNECT; 238 239 extern struct req_format RQF_CONNECT; 240 241 extern struct req_msg_field RMF_GENERIC_DATA; 242 extern struct req_msg_field RMF_PTLRPC_BODY; 243 extern struct req_msg_field RMF_MDT_BODY; 244 extern struct req_msg_field RMF_MDT_EPOCH; 245 extern struct req_msg_field RMF_OBD_STATFS; 246 extern struct req_msg_field RMF_NAME; 247 extern struct req_msg_field RMF_SYMTGT; 248 extern struct req_msg_field RMF_TGTUUID; 249 extern struct req_msg_field RMF_CLUUID; 250 extern struct req_msg_field RMF_SETINFO_VAL; 251 extern struct req_msg_field RMF_SETINFO_KEY; 252 extern struct req_msg_field RMF_GETINFO_VAL; 253 extern struct req_msg_field RMF_GETINFO_VALLEN; 254 extern struct req_msg_field RMF_GETINFO_KEY; 255 extern struct req_msg_field RMF_IDX_INFO; 256 extern struct req_msg_field RMF_CLOSE_DATA; 257 258 /* 259 * connection handle received in MDS_CONNECT request. 260 */ 261 extern struct req_msg_field RMF_CONN; 262 extern struct req_msg_field RMF_CONNECT_DATA; 263 extern struct req_msg_field RMF_DLM_REQ; 264 extern struct req_msg_field RMF_DLM_REP; 265 extern struct req_msg_field RMF_DLM_LVB; 266 extern struct req_msg_field RMF_DLM_GL_DESC; 267 extern struct req_msg_field RMF_LDLM_INTENT; 268 extern struct req_msg_field RMF_LAYOUT_INTENT; 269 extern struct req_msg_field RMF_MDT_MD; 270 extern struct req_msg_field RMF_REC_REINT; 271 extern struct req_msg_field RMF_EADATA; 272 extern struct req_msg_field RMF_EAVALS; 273 extern struct req_msg_field RMF_EAVALS_LENS; 274 extern struct req_msg_field RMF_ACL; 275 extern struct req_msg_field RMF_LOGCOOKIES; 276 extern struct req_msg_field RMF_CAPA1; 277 extern struct req_msg_field RMF_CAPA2; 278 extern struct req_msg_field RMF_OBD_QUOTACHECK; 279 extern struct req_msg_field RMF_OBD_QUOTACTL; 280 extern struct req_msg_field RMF_QUOTA_BODY; 281 extern struct req_msg_field RMF_STRING; 282 extern struct req_msg_field RMF_SWAP_LAYOUTS; 283 extern struct req_msg_field RMF_MDS_HSM_PROGRESS; 284 extern struct req_msg_field RMF_MDS_HSM_REQUEST; 285 extern struct req_msg_field RMF_MDS_HSM_USER_ITEM; 286 extern struct req_msg_field RMF_MDS_HSM_ARCHIVE; 287 extern struct req_msg_field RMF_HSM_USER_STATE; 288 extern struct req_msg_field RMF_HSM_STATE_SET; 289 extern struct req_msg_field RMF_MDS_HSM_CURRENT_ACTION; 290 extern struct req_msg_field RMF_MDS_HSM_REQUEST; 291 292 /* seq-mgr fields */ 293 extern struct req_msg_field RMF_SEQ_OPC; 294 extern struct req_msg_field RMF_SEQ_RANGE; 295 extern struct req_msg_field RMF_FID_SPACE; 296 297 /* FLD fields */ 298 extern struct req_msg_field RMF_FLD_OPC; 299 extern struct req_msg_field RMF_FLD_MDFLD; 300 301 extern struct req_msg_field RMF_LLOGD_BODY; 302 extern struct req_msg_field RMF_LLOG_LOG_HDR; 303 extern struct req_msg_field RMF_LLOGD_CONN_BODY; 304 305 extern struct req_msg_field RMF_MGS_TARGET_INFO; 306 extern struct req_msg_field RMF_MGS_SEND_PARAM; 307 308 extern struct req_msg_field RMF_OST_BODY; 309 extern struct req_msg_field RMF_OBD_IOOBJ; 310 extern struct req_msg_field RMF_OBD_ID; 311 extern struct req_msg_field RMF_FID; 312 extern struct req_msg_field RMF_NIOBUF_REMOTE; 313 extern struct req_msg_field RMF_RCS; 314 extern struct req_msg_field RMF_FIEMAP_KEY; 315 extern struct req_msg_field RMF_FIEMAP_VAL; 316 extern struct req_msg_field RMF_OST_ID; 317 318 /* MGS config read message format */ 319 extern struct req_msg_field RMF_MGS_CONFIG_BODY; 320 extern struct req_msg_field RMF_MGS_CONFIG_RES; 321 322 /* generic uint32 */ 323 extern struct req_msg_field RMF_U32; 324 325 /* OBJ update format */ 326 extern struct req_msg_field RMF_UPDATE; 327 extern struct req_msg_field RMF_UPDATE_REPLY; 328 /** @} req_layout */ 329 330 #endif /* _LUSTRE_REQ_LAYOUT_H__ */ 331