1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 only,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License version 2 for more details (a copy is included
16 * in the LICENSE file that accompanied this code).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see
20 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
30 * Use is subject to license terms.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/include/lustre/lustre_idl.h
38 * Lustre wire protocol definitions.
40 * ALL structs passing over the wire should be declared here. Structs
41 * that are used in interfaces with userspace should go in lustre_user.h.
43 * All structs being declared here should be built from simple fixed-size
44 * types (__u8, __u16, __u32, __u64) or be built from other types or
45 * structs also declared in this file. Similarly, all flags and magic
46 * values in those structs should also be declared here. This ensures
47 * that the Lustre wire protocol is not influenced by external dependencies.
49 * The only other acceptable items in this file are VERY SIMPLE accessor
50 * functions to avoid callers grubbing inside the structures, and the
51 * prototypes of the swabber functions for each struct. Nothing that
52 * depends on external functions or definitions should be in here.
54 * Structs must be properly aligned to put 64-bit values on an 8-byte
55 * boundary. Any structs being added here must also be added to
56 * utils/wirecheck.c and "make newwiretest" run to regenerate the
57 * utils/wiretest.c sources. This allows us to verify that wire structs
58 * have the proper alignment/size on all architectures.
60 * DO NOT CHANGE any of the structs, flags, values declared here and used
61 * in released Lustre versions. Some structs may have padding fields that
62 * can be used. Some structs might allow addition at the end (verify this
63 * in the code to ensure that new/old clients that see this larger struct
64 * do not fail, otherwise you need to implement protocol compatibility).
66 * We assume all nodes are either little-endian or big-endian, and we
67 * always send messages in the sender's native format. The receiver
68 * detects the message format by checking the 'magic' field of the message.
70 * Each wire type has corresponding 'lustre_swab_xxxtypexxx()' routines,
71 * implemented either here, inline (trivial implementations) or in
72 * ptlrpc/pack_generic.c. These 'swabbers' convert the type from "other"
73 * endian, in-place in the message buffer.
75 * A swabber takes a single pointer argument. The caller must already have
76 * verified that the length of the message buffer >= sizeof (type).
78 * For variable length types, a second 'lustre_swab_v_xxxtypexxx()' routine
79 * may be defined that swabs just the variable part, after the caller has
80 * verified that the message buffer is large enough.
83 #ifndef _LUSTRE_IDL_H_
84 #define _LUSTRE_IDL_H_
86 #if defined(__linux__)
87 #include <linux/lustre_types.h>
88 #elif defined(__APPLE__)
89 #include <darwin/lustre_types.h>
90 #elif defined(__WINNT__)
91 #include <winnt/lustre_types.h>
93 #error Unsupported operating system.
96 /* Defn's shared with user-space. */
97 #include <lustre/lustre_user.h>
98 #include <lustre/ll_fiemap.h>
101 * this file contains all data structures used in Lustre interfaces:
102 * - obdo and obd_request records
103 * - mds_request records
111 /* FOO_REQUEST_PORTAL is for incoming requests on the FOO
112 * FOO_REPLY_PORTAL is for incoming replies on the FOO
113 * FOO_BULK_PORTAL is for incoming bulk on the FOO
116 #define CONNMGR_REQUEST_PORTAL 1
117 #define CONNMGR_REPLY_PORTAL 2
118 //#define OSC_REQUEST_PORTAL 3
119 #define OSC_REPLY_PORTAL 4
120 //#define OSC_BULK_PORTAL 5
121 #define OST_IO_PORTAL 6
122 #define OST_CREATE_PORTAL 7
123 #define OST_BULK_PORTAL 8
124 //#define MDC_REQUEST_PORTAL 9
125 #define MDC_REPLY_PORTAL 10
126 //#define MDC_BULK_PORTAL 11
127 #define MDS_REQUEST_PORTAL 12
128 //#define MDS_REPLY_PORTAL 13
129 #define MDS_BULK_PORTAL 14
130 #define LDLM_CB_REQUEST_PORTAL 15
131 #define LDLM_CB_REPLY_PORTAL 16
132 #define LDLM_CANCEL_REQUEST_PORTAL 17
133 #define LDLM_CANCEL_REPLY_PORTAL 18
134 //#define PTLBD_REQUEST_PORTAL 19
135 //#define PTLBD_REPLY_PORTAL 20
136 //#define PTLBD_BULK_PORTAL 21
137 #define MDS_SETATTR_PORTAL 22
138 #define MDS_READPAGE_PORTAL 23
139 #define MDS_MDS_PORTAL 24
141 #define MGC_REPLY_PORTAL 25
142 #define MGS_REQUEST_PORTAL 26
143 #define MGS_REPLY_PORTAL 27
144 #define OST_REQUEST_PORTAL 28
145 #define FLD_REQUEST_PORTAL 29
146 #define SEQ_METADATA_PORTAL 30
147 #define SEQ_DATA_PORTAL 31
148 #define SEQ_CONTROLLER_PORTAL 32
150 /* Portal 63 is reserved for the Cray Inc DVS - nic@cray.com, roe@cray.com, n8851@cray.com */
155 #define SVC_RUNNING 8
156 #define SVC_STOPPING 16
157 #define SVC_STOPPED 32
160 #define PTL_RPC_MSG_REQUEST 4711
161 #define PTL_RPC_MSG_ERR 4712
162 #define PTL_RPC_MSG_REPLY 4713
164 /* DON'T use swabbed values of MAGIC as magic! */
165 #define LUSTRE_MSG_MAGIC_V1 0x0BD00BD0
166 #define LUSTRE_MSG_MAGIC_V2 0x0BD00BD3
168 #define LUSTRE_MSG_MAGIC_V1_SWABBED 0xD00BD00B
169 #define LUSTRE_MSG_MAGIC_V2_SWABBED 0xD30BD00B
171 #define LUSTRE_MSG_MAGIC LUSTRE_MSG_MAGIC_V2
173 #define PTLRPC_MSG_VERSION 0x00000003
174 #define LUSTRE_VERSION_MASK 0xffff0000
175 #define LUSTRE_OBD_VERSION 0x00010000
176 #define LUSTRE_MDS_VERSION 0x00020000
177 #define LUSTRE_OST_VERSION 0x00030000
178 #define LUSTRE_DLM_VERSION 0x00040000
179 #define LUSTRE_LOG_VERSION 0x00050000
180 #define LUSTRE_MGS_VERSION 0x00060000
182 struct lustre_handle {
185 #define DEAD_HANDLE_MAGIC 0xdeadbeefcafebabeULL
187 static inline int lustre_handle_is_used(struct lustre_handle *lh)
189 return lh->cookie != 0ull;
192 static inline int lustre_handle_equal(struct lustre_handle *lh1,
193 struct lustre_handle *lh2)
195 return lh1->cookie == lh2->cookie;
198 static inline void lustre_handle_copy(struct lustre_handle *tgt,
199 struct lustre_handle *src)
201 tgt->cookie = src->cookie;
204 /* we depend on this structure to be 8-byte aligned */
205 /* this type is only endian-adjusted in lustre_unpack_msg() */
206 struct lustre_msg_v1 {
207 struct lustre_handle lm_handle;
213 __u64 lm_last_committed;
222 /* flags for lm_flags */
223 #define MSGHDR_AT_SUPPORT 0x1
225 #define lustre_msg lustre_msg_v2
226 /* we depend on this structure to be 8-byte aligned */
227 /* this type is only endian-adjusted in lustre_unpack_msg() */
228 struct lustre_msg_v2 {
240 /* without gss, ptlrpc_body is put at the first buffer. */
241 #define PTLRPC_NUM_VERSIONS 4
243 struct lustre_handle pb_handle;
249 __u64 pb_last_seen; /* not used */
250 __u64 pb_last_committed;
255 __u32 pb_timeout; /* for req, the deadline, for rep, the service est */
256 __u32 pb_service_time; /* for rep, actual service time */
259 /* VBR: pre-versions */
260 __u64 pb_pre_versions[PTLRPC_NUM_VERSIONS];
261 /* padding for future needs */
265 extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb, int msgsize);
267 /* message body offset for lustre_msg_v2 */
268 /* ptlrpc body offset in all request/reply messages */
269 #define MSG_PTLRPC_BODY_OFF 0
271 /* normal request/reply message record offset */
272 #define REQ_REC_OFF 1
273 #define REPLY_REC_OFF 1
275 /* ldlm request message body offset */
276 #define DLM_LOCKREQ_OFF 1 /* lockreq offset */
277 #define DLM_REQ_REC_OFF 2 /* normal dlm request record offset */
279 /* ldlm intent lock message body offset */
280 #define DLM_INTENT_IT_OFF 2 /* intent lock it offset */
281 #define DLM_INTENT_REC_OFF 3 /* intent lock record offset */
283 /* ldlm reply message body offset */
284 #define DLM_LOCKREPLY_OFF 1 /* lockrep offset */
285 #define DLM_REPLY_REC_OFF 2 /* reply record offset */
287 /* only use in req->rq_{req,rep}_swab_mask */
288 #define MSG_PTLRPC_HEADER_OFF 31
290 /* Flags that are operation-specific go in the top 16 bits. */
291 #define MSG_OP_FLAG_MASK 0xffff0000
292 #define MSG_OP_FLAG_SHIFT 16
294 /* Flags that apply to all requests are in the bottom 16 bits */
295 #define MSG_GEN_FLAG_MASK 0x0000ffff
296 #define MSG_LAST_REPLAY 0x0001
297 #define MSG_RESENT 0x0002
298 #define MSG_REPLAY 0x0004
299 /* #define MSG_AT_SUPPORT 0x0008
300 * This was used in early prototypes of adaptive timeouts, and while there
301 * shouldn't be any users of that code there also isn't a need for using this
302 * bits. Defer usage until at least 1.10 to avoid potential conflict. */
303 #define MSG_DELAY_REPLAY 0x0010
304 #define MSG_VERSION_REPLAY 0x0020
305 #define MSG_REQ_REPLAY_DONE 0x0040
306 #define MSG_LOCK_REPLAY_DONE 0x0080
309 * Flags for all connect opcodes (MDS_CONNECT, OST_CONNECT)
312 #define MSG_CONNECT_RECOVERING 0x00000001
313 #define MSG_CONNECT_RECONNECT 0x00000002
314 #define MSG_CONNECT_REPLAYABLE 0x00000004
315 //#define MSG_CONNECT_PEER 0x8
316 #define MSG_CONNECT_LIBCLIENT 0x00000010
317 #define MSG_CONNECT_INITIAL 0x00000020
318 #define MSG_CONNECT_ASYNC 0x00000040
319 #define MSG_CONNECT_NEXT_VER 0x00000080 /* use next version of lustre_msg */
320 #define MSG_CONNECT_TRANSNO 0x00000100 /* report transno */
321 #define MSG_CONNECT_DELAYED 0x00000200
324 #define OBD_CONNECT_RDONLY 0x1ULL /*client allowed read-only access*/
325 #define OBD_CONNECT_INDEX 0x2ULL /*connect to specific LOV idx */
326 #define OBD_CONNECT_MDS 0x4ULL /*connect from MDT to OST */
327 #define OBD_CONNECT_GRANT 0x8ULL /*OSC acquires grant at connect */
328 #define OBD_CONNECT_SRVLOCK 0x10ULL /*server takes locks for client */
329 #define OBD_CONNECT_VERSION 0x20ULL /*Lustre versions in ocd */
330 #define OBD_CONNECT_REQPORTAL 0x40ULL /*Separate non-IO request portal */
331 #define OBD_CONNECT_ACL 0x80ULL /*access control lists */
332 #define OBD_CONNECT_XATTR 0x100ULL /*client use extended attributes */
333 #define OBD_CONNECT_CROW 0x200ULL /*MDS+OST create objects on write*/
334 #define OBD_CONNECT_TRUNCLOCK 0x400ULL /*locks on server for punch */
335 #define OBD_CONNECT_TRANSNO 0x800ULL /*replay sends initial transno */
336 #define OBD_CONNECT_IBITS 0x1000ULL /*support for inodebits locks */
337 #define OBD_CONNECT_JOIN 0x2000ULL /*files can be concatenated */
338 #define OBD_CONNECT_ATTRFID 0x4000ULL /*Server supports GetAttr By Fid */
339 #define OBD_CONNECT_NODEVOH 0x8000ULL /*No open handle on special nodes*/
340 #define OBD_CONNECT_RMT_CLIENT 0x10000ULL /*Remote client */
341 #define OBD_CONNECT_RMT_CLIENT_FORCE 0x20000ULL /*Remote client by force */
342 #define OBD_CONNECT_BRW_SIZE 0x40000ULL /*Max bytes per rpc */
343 #define OBD_CONNECT_QUOTA64 0x80000ULL /*64bit qunit_data.qd_count */
344 #define OBD_CONNECT_MDS_CAPA 0x100000ULL /*MDS capability */
345 #define OBD_CONNECT_OSS_CAPA 0x200000ULL /*OSS capability */
346 #define OBD_CONNECT_CANCELSET 0x400000ULL /*Early batched cancels. */
347 #define OBD_CONNECT_SOM 0x00800000ULL /*Size on MDS */
348 #define OBD_CONNECT_AT 0x01000000ULL /*client uses adaptive timeouts */
349 #define OBD_CONNECT_LRU_RESIZE 0x02000000ULL /*LRU resize feature. */
350 #define OBD_CONNECT_MDS_MDS 0x04000000ULL /*MDS-MDS connection */
351 #define OBD_CONNECT_REAL 0x08000000ULL /*real connection */
352 #define OBD_CONNECT_CHANGE_QS 0x10000000ULL /*shrink/enlarge qunit b=10600 */
353 #define OBD_CONNECT_CKSUM 0x20000000ULL /*support several cksum algos */
354 #define OBD_CONNECT_FID 0x40000000ULL /*FID is supported by server */
355 #define OBD_CONNECT_VBR 0x80000000ULL /*version based recovery */
356 #define OBD_CONNECT_LOV_V3 0x100000000ULL /*client supports LOV v3 EA */
357 #define OBD_CONNECT_GRANT_SHRINK 0x200000000ULL /* support grant shrink */
358 #define OBD_CONNECT_SKIP_ORPHAN 0x400000000ULL /* don't reuse orphan objids */
359 #define OBD_CONNECT_MAX_EASIZE 0x800000000ULL /* preserved for large EA */
360 #define OBD_CONNECT_FULL20 0x1000000000ULL /* this flag is only used for
361 * 2.0 client, don't reuse it
362 * on b1_8 or older releases */
363 /* also update obd_connect_names[] for lprocfs_rd_connect_flags()
364 * and lustre/utils/wirecheck.c */
366 #ifdef HAVE_LRU_RESIZE_SUPPORT
367 #define LRU_RESIZE_CONNECT_FLAG OBD_CONNECT_LRU_RESIZE
369 #define LRU_RESIZE_CONNECT_FLAG 0
372 #define MDS_CONNECT_SUPPORTED (OBD_CONNECT_RDONLY | OBD_CONNECT_VERSION | \
373 OBD_CONNECT_ACL | OBD_CONNECT_XATTR | \
374 OBD_CONNECT_IBITS | OBD_CONNECT_JOIN | \
375 OBD_CONNECT_NODEVOH | OBD_CONNECT_ATTRFID | \
376 OBD_CONNECT_CANCELSET | OBD_CONNECT_AT | \
377 LRU_RESIZE_CONNECT_FLAG | OBD_CONNECT_VBR |\
379 #define OST_CONNECT_SUPPORTED (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \
380 OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \
381 OBD_CONNECT_TRUNCLOCK | OBD_CONNECT_INDEX | \
382 OBD_CONNECT_BRW_SIZE | OBD_CONNECT_QUOTA64 | \
383 OBD_CONNECT_CANCELSET | OBD_CONNECT_AT | \
384 LRU_RESIZE_CONNECT_FLAG | OBD_CONNECT_CKSUM | \
385 OBD_CONNECT_VBR | OBD_CONNECT_CHANGE_QS | \
386 OBD_CONNECT_MDS | OBD_CONNECT_SKIP_ORPHAN)
387 #define ECHO_CONNECT_SUPPORTED (0)
388 #define MGS_CONNECT_SUPPORTED (OBD_CONNECT_VERSION | OBD_CONNECT_AT)
390 #define OBD_OCD_VERSION(major,minor,patch,fix) (((major)<<24) + ((minor)<<16) +\
391 ((patch)<<8) + (fix))
392 #define OBD_OCD_VERSION_MAJOR(version) ((int)((version)>>24)&255)
393 #define OBD_OCD_VERSION_MINOR(version) ((int)((version)>>16)&255)
394 #define OBD_OCD_VERSION_PATCH(version) ((int)((version)>>8)&255)
395 #define OBD_OCD_VERSION_FIX(version) ((int)(version)&255)
397 /* This structure is used for both request and reply.
399 * If we eventually have separate connect data for different types, which we
400 * almost certainly will, then perhaps we stick a union in here. */
401 struct obd_connect_data {
402 __u64 ocd_connect_flags; /* OBD_CONNECT_* per above */
403 __u32 ocd_version; /* lustre release version number */
404 __u32 ocd_grant; /* initial cache grant amount (bytes) */
405 __u32 ocd_index; /* LOV index to connect to */
406 __u32 ocd_brw_size; /* Maximum BRW size in bytes */
407 __u64 ocd_ibits_known; /* inode bits this client understands */
408 __u32 ocd_nllu; /* non-local-lustre-user */
409 __u32 ocd_nllg; /* non-local-lustre-group */
410 __u64 ocd_transno; /* Used in lustre 1.8 */
411 __u32 ocd_group; /* Used in lustre 1.8 */
412 __u32 ocd_cksum_types; /* supported checksum algorithms */
413 __u64 padding1; /* also fix lustre_swab_connect */
414 __u64 padding2; /* also fix lustre_swab_connect */
417 extern void lustre_swab_connect(struct obd_connect_data *ocd);
419 #define PTLRPC_INTEROP_1_6 1
420 #define PTLRPC_BODY_MIN_SIZE offsetof(struct ptlrpc_body, pb_pre_versions)
423 * Supported checksum algorithms. Up to 32 checksum types are supported.
424 * (32-bit mask stored in obd_connect_data::ocd_cksum_types)
425 * Please update DECLARE_CKSUM_NAME/OBD_CKSUM_ALL in obd.h when adding a new
426 * algorithm and also the OBD_FL_CKSUM* flags.
429 OBD_CKSUM_CRC32 = 0x00000001,
430 OBD_CKSUM_ADLER = 0x00000002,
434 * OST requests: OBDO & OBD request records
439 OST_REPLY = 0, /* reply ? */
453 /* OST_SAN_READ = 14, deprecated */
454 /* OST_SAN_WRITE = 15, deprecated */
459 OST_QUOTA_ADJUST_QUNIT = 20,
462 #define OST_FIRST_OPC OST_REPLY
464 typedef __u64 obd_id;
465 typedef __u64 obd_gr;
466 typedef __u64 obd_time;
467 typedef __u64 obd_size;
468 typedef __u64 obd_off;
469 typedef __u64 obd_blocks;
470 typedef __u64 obd_valid;
471 typedef __u32 obd_blksize;
472 typedef __u32 obd_mode;
473 typedef __u32 obd_uid;
474 typedef __u32 obd_gid;
475 typedef __u32 obd_flag;
476 typedef __u32 obd_count;
479 OBD_FL_INLINEDATA = 0x00000001,
480 OBD_FL_OBDMDEXISTS = 0x00000002,
481 OBD_FL_DELORPHAN = 0x00000004, /* if set in o_flags delete orphans */
482 OBD_FL_NORPC = 0x00000008, /* set in o_flags do in OSC not OST */
483 OBD_FL_IDONLY = 0x00000010, /* set in o_flags only adjust obj id*/
484 OBD_FL_RECREATE_OBJS= 0x00000020, /* recreate missing obj */
485 OBD_FL_DEBUG_CHECK = 0x00000040, /* echo client/server debug check */
486 OBD_FL_NO_USRQUOTA = 0x00000100, /* the object's owner is over quota */
487 OBD_FL_NO_GRPQUOTA = 0x00000200, /* the object's group is over quota */
488 OBD_FL_CREATE_CROW = 0x00000400, /* object should be create on write */
489 OBD_FL_TRUNCLOCK = 0x00000800, /* delegate DLM locking during punch*/
490 OBD_FL_CKSUM_CRC32 = 0x00001000, /* CRC32 checksum type */
491 OBD_FL_CKSUM_ADLER = 0x00002000, /* ADLER checksum type */
492 OBD_FL_CKSUM_RSVD1 = 0x00004000, /* for future cksum types */
493 OBD_FL_CKSUM_RSVD2 = 0x00008000, /* for future cksum types */
494 OBD_FL_CKSUM_RSVD3 = 0x00010000, /* for future cksum types */
495 OBD_FL_SHRINK_GRANT = 0x00020000, /* object shrink the grant */
496 OBD_FL_MMAP = 0x00040000, /* object is mmapped on the client */
498 OBD_FL_CKSUM_ALL = OBD_FL_CKSUM_CRC32 | OBD_FL_CKSUM_ADLER,
500 /* mask for local-only flag, which won't be sent over network */
501 OBD_FL_LOCAL_MASK = 0xF0000000,
502 /* temporary OBDO used by osc_brw_async (see bug 18364) */
503 OBD_FL_TEMPORARY = 0x10000000,
506 #define LOV_MAGIC_V1 0x0BD10BD0
507 #define LOV_MAGIC LOV_MAGIC_V1
508 #define LOV_MAGIC_JOIN 0x0BD20BD0
509 #define LOV_MAGIC_V3 0x0BD30BD0
511 #define LOV_PATTERN_RAID0 0x001 /* stripes are used round-robin */
512 #define LOV_PATTERN_RAID1 0x002 /* stripes are mirrors of each other */
513 #define LOV_PATTERN_FIRST 0x100 /* first stripe is not in round-robin */
514 #define LOV_PATTERN_CMOBD 0x200
516 #define LOV_OBJECT_GROUP_DEFAULT ~0ULL
517 #define LOV_OBJECT_GROUP_CLEAR 0ULL
519 #define lov_ost_data lov_ost_data_v1
520 struct lov_ost_data_v1 { /* per-stripe data structure (little-endian)*/
521 __u64 l_object_id; /* OST object ID */
522 __u64 l_object_gr; /* OST object group (creating MDS number) */
523 __u32 l_ost_gen; /* generation of this l_ost_idx */
524 __u32 l_ost_idx; /* OST index in LOV (lov_tgt_desc->tgts) */
527 #define lov_mds_md lov_mds_md_v1
528 struct lov_mds_md_v1 { /* LOV EA mds/wire data (little-endian) */
529 __u32 lmm_magic; /* magic number = LOV_MAGIC_V1 */
530 __u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */
531 __u64 lmm_object_id; /* LOV object ID */
532 __u64 lmm_object_gr; /* LOV object group */
533 __u32 lmm_stripe_size; /* size of stripe in bytes */
534 __u32 lmm_stripe_count; /* num stripes in use for this object */
535 struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */
538 struct lov_mds_md_v3 { /* LOV EA mds/wire data (little-endian) */
539 __u32 lmm_magic; /* magic number = LOV_MAGIC_V3 */
540 __u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */
541 __u64 lmm_object_id; /* LOV object ID */
542 __u64 lmm_object_gr; /* LOV object group */
543 __u32 lmm_stripe_size; /* size of stripe in bytes */
544 __u32 lmm_stripe_count; /* num stripes in use for this object */
545 char lmm_pool_name[LOV_MAXPOOLNAME]; /* must be 32bit aligned */
546 struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */
550 #define OBD_MD_FLID (0x00000001ULL) /* object ID */
551 #define OBD_MD_FLATIME (0x00000002ULL) /* access time */
552 #define OBD_MD_FLMTIME (0x00000004ULL) /* data modification time */
553 #define OBD_MD_FLCTIME (0x00000008ULL) /* change time */
554 #define OBD_MD_FLSIZE (0x00000010ULL) /* size */
555 #define OBD_MD_FLBLOCKS (0x00000020ULL) /* allocated blocks count */
556 #define OBD_MD_FLBLKSZ (0x00000040ULL) /* block size */
557 #define OBD_MD_FLMODE (0x00000080ULL) /* access bits (mode & ~S_IFMT) */
558 #define OBD_MD_FLTYPE (0x00000100ULL) /* object type (mode & S_IFMT) */
559 #define OBD_MD_FLUID (0x00000200ULL) /* user ID */
560 #define OBD_MD_FLGID (0x00000400ULL) /* group ID */
561 #define OBD_MD_FLFLAGS (0x00000800ULL) /* flags word */
562 #define OBD_MD_FLNLINK (0x00002000ULL) /* link count */
563 #define OBD_MD_FLGENER (0x00004000ULL) /* generation number */
564 /*#define OBD_MD_FLINLINE (0x00008000ULL) inline data. used until 1.6.5 */
565 #define OBD_MD_FLRDEV (0x00010000ULL) /* device number */
566 #define OBD_MD_FLEASIZE (0x00020000ULL) /* extended attribute data */
567 #define OBD_MD_LINKNAME (0x00040000ULL) /* symbolic link target */
568 #define OBD_MD_FLHANDLE (0x00080000ULL) /* file/lock handle */
569 #define OBD_MD_FLCKSUM (0x00100000ULL) /* bulk data checksum */
570 #define OBD_MD_FLQOS (0x00200000ULL) /* quality of service stats */
571 /*#define OBD_MD_FLOSCOPQ (0x00400000ULL) osc opaque data, never used */
572 #define OBD_MD_FLCOOKIE (0x00800000ULL) /* log cancellation cookie */
573 #define OBD_MD_FLGROUP (0x01000000ULL) /* group */
574 #define OBD_MD_FLFID (0x02000000ULL) /* ->ost write inline fid */
575 #define OBD_MD_FLEPOCH (0x04000000ULL) /* ->ost write easize is epoch */
576 /* ->mds if epoch opens or closes */
577 #define OBD_MD_FLGRANT (0x08000000ULL) /* ost preallocation space grant */
578 #define OBD_MD_FLDIREA (0x10000000ULL) /* dir's extended attribute data */
579 #define OBD_MD_FLUSRQUOTA (0x20000000ULL) /* over quota flags sent from ost */
580 #define OBD_MD_FLGRPQUOTA (0x40000000ULL) /* over quota flags sent from ost */
581 #define OBD_MD_FLMODEASIZE (0x80000000ULL) /* EA size will be changed */
583 #define OBD_MD_MDS (0x0000000100000000ULL) /* where an inode lives on */
584 #define OBD_MD_REINT (0x0000000200000000ULL) /* reintegrate oa */
585 #define OBD_MD_MEA (0x0000000400000000ULL) /* CMD split EA */
587 #define OBD_MD_FLXATTR (0x0000001000000000ULL) /* xattr */
588 #define OBD_MD_FLXATTRLS (0x0000002000000000ULL) /* xattr list */
589 #define OBD_MD_FLXATTRRM (0x0000004000000000ULL) /* xattr remove */
590 #define OBD_MD_FLACL (0x0000008000000000ULL) /* ACL */
591 #define OBD_MD_FLRMTPERM (0x0000010000000000ULL) /* remote permission */
592 #define OBD_MD_FLMDSCAPA (0x0000020000000000ULL) /* MDS capability */
593 #define OBD_MD_FLOSSCAPA (0x0000040000000000ULL) /* OSS capability */
594 #define OBD_MD_FLCKSPLIT (0x0000080000000000ULL) /* Check split on server */
595 #define OBD_MD_FLCROSSREF (0x0000100000000000ULL) /* Cross-ref case */
597 #define OBD_FL_TRUNC (0x0000200000000000ULL) /* for filter_truncate */
599 #define OBD_MD_FLRMTLSETFACL (0x0001000000000000ULL) /* lfs lsetfacl case */
600 #define OBD_MD_FLRMTLGETFACL (0x0002000000000000ULL) /* lfs lgetfacl case */
601 #define OBD_MD_FLRMTRSETFACL (0x0004000000000000ULL) /* lfs rsetfacl case */
602 #define OBD_MD_FLRMTRGETFACL (0x0008000000000000ULL) /* lfs rgetfacl case */
604 #define OBD_MD_FLGETATTR (OBD_MD_FLID | OBD_MD_FLATIME | OBD_MD_FLMTIME | \
605 OBD_MD_FLCTIME | OBD_MD_FLSIZE | OBD_MD_FLBLKSZ | \
606 OBD_MD_FLMODE | OBD_MD_FLTYPE | OBD_MD_FLUID | \
607 OBD_MD_FLGID | OBD_MD_FLFLAGS | OBD_MD_FLNLINK | \
608 OBD_MD_FLGENER | OBD_MD_FLRDEV | OBD_MD_FLGROUP)
610 /* don't forget obdo_fid which is way down at the bottom so it can
611 * come after the definition of llog_cookie */
614 extern void lustre_swab_obd_statfs (struct obd_statfs *os);
615 #define OBD_STATFS_NODELAY 0x0001 /* requests should be send without delay
616 * and resends for avoid deadlocks */
617 #define OBD_STATFS_FROM_CACHE 0x0002 /* the statfs callback should not update
619 #define OBD_STATFS_PTLRPCD 0x0004 /* requests will be sent via ptlrpcd
620 * instead of a specific set. This
621 * means that we cannot rely on the set
622 * interpret routine to be called.
623 * lov_statfs_fini() must thus be called
624 * by the request interpret routine */
626 /* ost_body.data values for OST_BRW */
628 #define OBD_BRW_READ 0x01
629 #define OBD_BRW_WRITE 0x02
630 #define OBD_BRW_RWMASK (OBD_BRW_READ | OBD_BRW_WRITE)
631 #define OBD_BRW_SYNC 0x08
632 #define OBD_BRW_CHECK 0x10
633 #define OBD_BRW_FROM_GRANT 0x20 /* the osc manages this under llite */
634 #define OBD_BRW_GRANTED 0x40 /* the ost manages this */
635 #define OBD_BRW_DROP 0x80 /* drop the page after IO */
636 #define OBD_BRW_NOQUOTA 0x100
637 #define OBD_BRW_SRVLOCK 0x200 /* Client holds no lock over this page */
638 #define OBD_BRW_ASYNC 0x400 /* Server may delay commit to disk */
639 #define OBD_BRW_MEMALLOC 0x800 /* Client runs in the "kswapd" context */
641 #define OBD_OBJECT_EOF 0xffffffffffffffffULL
643 #define OST_MIN_PRECREATE 32
644 #define OST_MAX_PRECREATE 20000
653 extern void lustre_swab_obd_ioobj (struct obd_ioobj *ioo);
655 /* multiple of 8 bytes => can array */
656 struct niobuf_remote {
662 extern void lustre_swab_niobuf_remote (struct niobuf_remote *nbr);
664 /* lock value block communicated between the filter and llite */
666 /* OST_LVB_ERR_INIT is needed because the return code in rc is
667 * negative, i.e. because ((MASK + rc) & MASK) != MASK. */
668 #define OST_LVB_ERR_INIT 0xffbadbad80000000ULL
669 #define OST_LVB_ERR_MASK 0xffbadbad00000000ULL
670 #define OST_LVB_IS_ERR(blocks) \
671 ((blocks & OST_LVB_ERR_MASK) == OST_LVB_ERR_MASK)
672 #define OST_LVB_SET_ERR(blocks, rc) \
673 do { blocks = OST_LVB_ERR_INIT + rc; } while (0)
674 #define OST_LVB_GET_ERR(blocks) (int)(blocks - OST_LVB_ERR_INIT)
684 extern void lustre_swab_ost_lvb(struct ost_lvb *);
693 MDS_GETATTR_NAME = 34,
704 MDS_DONE_WRITING = 45,
715 #define MDS_FIRST_OPC MDS_GETATTR
734 /* the disposition of the intent outlines what was executed */
735 #define DISP_IT_EXECD 0x00000001
736 #define DISP_LOOKUP_EXECD 0x00000002
737 #define DISP_LOOKUP_NEG 0x00000004
738 #define DISP_LOOKUP_POS 0x00000008
739 #define DISP_OPEN_CREATE 0x00000010
740 #define DISP_OPEN_OPEN 0x00000020
741 #define DISP_ENQ_COMPLETE 0x00400000
742 #define DISP_ENQ_OPEN_REF 0x00800000
743 #define DISP_ENQ_CREATE_REF 0x01000000
744 #define DISP_OPEN_LOCK 0x02000000
746 /* INODE LOCK PARTS */
747 #define MDS_INODELOCK_LOOKUP 0x000001 /* dentry, mode, owner, group */
748 #define MDS_INODELOCK_UPDATE 0x000002 /* size, links, timestamps */
749 #define MDS_INODELOCK_OPEN 0x000004 /* For opened files */
751 /* Do not forget to increase MDS_INODELOCK_MAXSHIFT when adding new bits */
752 #define MDS_INODELOCK_MAXSHIFT 2
753 /* This FULL lock is useful to take on unlink sort of operations */
754 #define MDS_INODELOCK_FULL ((1<<(MDS_INODELOCK_MAXSHIFT+1))-1)
758 * Enumeration of possible directory entry attributes.
760 * Attributes follow directory entry header in the order they appear in this
763 enum lu_dirent_attrs {
769 extern void lustre_swab_ll_fid (struct ll_fid *fid);
772 /** put FID sequence at this offset in ldlm_res_id. */
773 LUSTRE_RES_ID_SEQ_OFF = 0,
774 /** put FID oid at this offset in ldlm_res_id. */
775 LUSTRE_RES_ID_OID_OFF = 1,
776 /** put FID version at this offset in ldlm_res_id. */
777 LUSTRE_RES_ID_VER_OFF = 2,
778 /** put pdo hash at this offset in ldlm_res_id. */
779 LUSTRE_RES_ID_HSH_OFF = 3
782 typedef __u64 seqno_t;
785 * Describes a range of sequence, lsr_start is included but lsr_end is
788 struct lu_seq_range {
791 /** this feild is not used in 1.8 client interop */
797 * returns width of given range \a r
800 static inline __u64 range_space(const struct lu_seq_range *r)
802 return r->lsr_end - r->lsr_start;
806 * initialize range to zero
808 static inline void range_init(struct lu_seq_range *r)
810 r->lsr_start = r->lsr_end = 0;
814 * check if given seq id \a s is within given range \a r
816 static inline int range_within(const struct lu_seq_range *r,
819 return s >= r->lsr_start && s < r->lsr_end;
823 * sanity check for range \a r
825 static inline int range_is_sane(const struct lu_seq_range *r)
827 return (r->lsr_end >= r->lsr_start);
830 static inline int range_is_zero(struct lu_seq_range *r)
832 return (r->lsr_start == 0 && r->lsr_end == 0);
835 static inline int range_is_exhausted(const struct lu_seq_range *r)
837 return range_space(r) == 0;
840 #define DRANGE "[%#16.16"LPF64"x-%#16.16"LPF64"x)"
842 #define PRANGE(range) \
843 (range)->lsr_start, \
848 * This is how may FIDs may be allocated in one sequence.
850 LUSTRE_SEQ_MAX_WIDTH = 0x0000000000004000ULL,
862 /* initial fid id value */
863 LUSTRE_FID_INIT_OID = 1UL
866 extern void lustre_swab_lu_fid(struct lu_fid *fid);
868 /* get object sequence */
869 static inline __u64 fid_seq(const struct lu_fid *fid)
875 static inline __u32 fid_oid(const struct lu_fid *fid)
880 /* get object version */
881 static inline __u32 fid_ver(const struct lu_fid *fid)
886 static inline void fid_init(struct lu_fid *fid)
888 memset(fid, 0, sizeof(*fid));
891 /* Normal FID sequence starts from this value, i.e. 1<<33 */
892 #define FID_SEQ_START 0x200000000ULL
894 /* IDIF sequence starts from this value, i.e. 1<<32 */
895 #define IDIF_SEQ_START 0x100000000ULL
898 * Check if a fid is igif or not.
899 * \param fid the fid to be tested.
900 * \return true if the fid is a igif; otherwise false.
902 static inline int fid_is_igif(const struct lu_fid *fid)
904 return fid_seq(fid) > 0 && fid_seq(fid) < IDIF_SEQ_START;
908 * Check if a fid is idif or not.
909 * \param fid the fid to be tested.
910 * \return true if the fid is a idif; otherwise false.
912 static inline int fid_is_idif(const struct lu_fid *fid)
914 return fid_seq(fid) >= IDIF_SEQ_START && fid_seq(fid) < FID_SEQ_START;
918 * Check if a fid sequence is sane or not
919 * \param seq the sequence to be tested.
920 * \return true if the sequence is a sane sequence; otherwise false.
922 static inline int fid_seq_is_sane(__u64 seq)
928 * Check if a fid is sane or not
929 * \param fid the fid to be tested.
930 * \return true if the fid is sane; otherwise false.
932 static inline int fid_is_sane(const struct lu_fid *fid)
936 ((fid_seq_is_sane(fid_seq(fid)) && fid_oid(fid) != 0
937 && fid_ver(fid) == 0) ||
941 * Check if a fid is zero.
942 * \param fid the fid to be tested.
943 * \return true if the fid is zero; otherwise false.
945 static inline int fid_is_zero(const struct lu_fid *fid)
947 return fid_seq(fid) == 0 && fid_oid(fid) == 0;
951 * Get inode number from a igif.
952 * \param fid a igif to get inode number from.
953 * \return inode number for the igif.
955 static inline ino_t lu_igif_ino(const struct lu_fid *fid)
961 * Get inode generation from a igif.
962 * \param fid a igif to get inode generation from.
963 * \return inode generation for the igif.
965 static inline __u32 lu_igif_gen(const struct lu_fid *fid)
971 * Check if two fids are equal or not.
972 * \param f0 the first fid
973 * \param f1 the second fid
974 * \return true if the two fids are equal; otherwise false.
976 static inline int lu_fid_eq(const struct lu_fid *f0,
977 const struct lu_fid *f1)
979 /* Check that there is no alignment padding. */
980 CLASSERT(sizeof *f0 ==
981 sizeof f0->f_seq + sizeof f0->f_oid + sizeof f0->f_ver);
982 LASSERTF(fid_is_igif(f0) || fid_ver(f0) == 0, DFID"\n", PFID(f0));
983 LASSERTF(fid_is_igif(f1) || fid_ver(f1) == 0, DFID"\n", PFID(f1));
984 return memcmp(f0, f1, sizeof *f0) == 0;
987 void fid_cpu_to_le(struct lu_fid *dst, const struct lu_fid *src);
988 void fid_le_to_cpu(struct lu_fid *dst, const struct lu_fid *src);
991 fid_build_reg_res_name(const struct lu_fid *f, struct ldlm_res_id *name);
992 int fid_res_name_eq(const struct lu_fid *f, const struct ldlm_res_id *name);
994 #define MDS_STATUS_CONN 1
995 #define MDS_STATUS_LOV 2
997 struct mds_status_req {
1002 extern void lustre_swab_mds_status_req (struct mds_status_req *r);
1004 #define MDS_BFLAG_UNCOMMITTED_WRITES 0x1
1005 #define MDS_BFLAG_EXT_FLAGS 0x80000000 /* == EXT3_RESERVED_FL */
1007 /* these should be identical to their EXT3_*_FL counterparts, and are
1008 * redefined here only to avoid dragging in ext3_fs.h */
1009 #define MDS_SYNC_FL 0x00000008 /* Synchronous updates */
1010 #define MDS_IMMUTABLE_FL 0x00000010 /* Immutable file */
1011 #define MDS_APPEND_FL 0x00000020 /* writes to file may only append */
1012 #define MDS_NOATIME_FL 0x00000080 /* do not update atime */
1013 #define MDS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (dir only) */
1016 /* If MDS_BFLAG_IOC_FLAGS is set it means we requested EXT3_*_FL inode flags
1017 * and we need to decode these into local S_* flags in the inode. Otherwise
1018 * we pass flags straight through (see bug 9486). */
1019 static inline int ll_ext_to_inode_flags(int flags)
1021 return (flags & MDS_BFLAG_EXT_FLAGS) ?
1022 (((flags & MDS_SYNC_FL) ? S_SYNC : 0) |
1023 ((flags & MDS_NOATIME_FL) ? S_NOATIME : 0) |
1024 ((flags & MDS_APPEND_FL) ? S_APPEND : 0) |
1025 #if defined(S_DIRSYNC)
1026 ((flags & MDS_DIRSYNC_FL) ? S_DIRSYNC : 0) |
1028 ((flags & MDS_IMMUTABLE_FL) ? S_IMMUTABLE : 0)) :
1029 (flags & ~MDS_BFLAG_EXT_FLAGS);
1032 /* If keep is set, we do not do anything with iflags, if it is not set, we
1033 * assume that iflags are inode flags and we need to conver those to
1034 * EXT3_*_FL flags (see bug 9486 and 12848) */
1035 static inline int ll_inode_to_ext_flags(int iflags, int keep)
1037 return keep ? (iflags & ~MDS_BFLAG_EXT_FLAGS) :
1038 (((iflags & S_SYNC) ? MDS_SYNC_FL : 0) |
1039 ((iflags & S_NOATIME) ? MDS_NOATIME_FL : 0) |
1040 ((iflags & S_APPEND) ? MDS_APPEND_FL : 0) |
1041 #if defined(S_DIRSYNC)
1042 ((iflags & S_DIRSYNC) ? MDS_DIRSYNC_FL : 0) |
1044 ((iflags & S_IMMUTABLE) ? MDS_IMMUTABLE_FL : 0));
1049 * while mds_body is to interact with 1.6, mdt_body is to interact with 2.0.
1050 * both of them should have the same fields layout, because at client side
1051 * one could be dynamically cast to the other.
1053 * mdt_body has large size than mds_body, with unused padding (48 bytes)
1054 * at the end. client always use size of mdt_body to prepare request/reply
1055 * buffers, and actual data could be interepeted as mdt_body or mds_body
1061 struct lustre_handle handle;
1063 __u64 size; /* Offset, in the case of MDS_READPAGE */
1067 __u64 blocks; /* XID, in the case of MDS_READPAGE */
1076 __u32 flags; /* from vfs for pin/unpin, MDS_BFLAG for close */
1078 __u32 nlink; /* #bytes to read in the case of MDS_READPAGE */
1084 __u32 max_cookiesize;
1085 __u32 padding_4; /* also fix lustre_swab_mds_body */
1088 extern void lustre_swab_mds_body (struct mds_body *b);
1093 struct lustre_handle handle;
1095 __u64 size; /* Offset, in the case of MDS_READPAGE */
1099 __u64 blocks; /* XID, in the case of MDS_READPAGE */
1101 __u64 ino; /* for 1.6 compatibility */
1108 __u32 flags; /* from vfs for pin/unpin, MDS_BFLAG for close */
1110 __u32 nlink; /* #bytes to read in the case of MDS_READPAGE */
1111 __u32 generation; /* for 1.6 compatibility */
1116 __u32 max_cookiesize;
1117 __u32 padding_4; /* also fix lustre_swab_mdt_body */
1126 #define Q_QUOTACHECK 0x800100
1127 #define Q_INITQUOTA 0x800101 /* init slave limits */
1128 #define Q_GETOINFO 0x800102 /* get obd quota info */
1129 #define Q_GETOQUOTA 0x800103 /* get obd quotas */
1130 #define Q_FINVALIDATE 0x800104 /* invalidate operational quotas */
1132 #define Q_TYPEMATCH(id, type) \
1133 ((id) == (type) || (id) == UGQUOTA)
1135 #define Q_TYPESET(oqc, type) Q_TYPEMATCH((oqc)->qc_type, type)
1137 #define Q_GETOCMD(oqc) \
1138 ((oqc)->qc_cmd == Q_GETOINFO || (oqc)->qc_cmd == Q_GETOQUOTA)
1140 struct obd_quotactl {
1145 struct obd_dqinfo qc_dqinfo;
1146 struct obd_dqblk qc_dqblk;
1149 extern void lustre_swab_obd_quotactl(struct obd_quotactl *q);
1151 struct quota_adjust_qunit {
1158 extern void lustre_swab_quota_adjust_qunit(struct quota_adjust_qunit *q);
1160 /* flags is shared among quota structures */
1161 #define LQUOTA_FLAGS_GRP 1UL /* 0 is user, 1 is group */
1162 #define LQUOTA_FLAGS_BLK 2UL /* 0 is inode, 1 is block */
1163 #define LQUOTA_FLAGS_ADJBLK 4UL /* adjust the block qunit size */
1164 #define LQUOTA_FLAGS_ADJINO 8UL /* adjust the inode qunit size */
1165 #define LQUOTA_FLAGS_CHG_QS 16UL /* indicate whether it has capability of
1166 * OBD_CONNECT_CHANGE_QS */
1168 /* flags is specific for quota_adjust_qunit */
1169 #define LQUOTA_QAQ_CREATE_LQS (1 << 31) /* when it is set, need create lqs */
1171 /* the status of lqs_flags in struct lustre_qunit_size */
1172 #define LQUOTA_QUNIT_FLAGS (LQUOTA_FLAGS_GRP | LQUOTA_FLAGS_BLK)
1174 #define QAQ_IS_GRP(qaq) ((qaq)->qaq_flags & LQUOTA_FLAGS_GRP)
1175 #define QAQ_IS_ADJBLK(qaq) ((qaq)->qaq_flags & LQUOTA_FLAGS_ADJBLK)
1176 #define QAQ_IS_ADJINO(qaq) ((qaq)->qaq_flags & LQUOTA_FLAGS_ADJINO)
1177 #define QAQ_IS_CREATE_LQS(qaq) ((qaq)->qaq_flags & LQUOTA_QAQ_CREATE_LQS)
1179 #define QAQ_SET_GRP(qaq) ((qaq)->qaq_flags |= LQUOTA_FLAGS_GRP)
1180 #define QAQ_SET_ADJBLK(qaq) ((qaq)->qaq_flags |= LQUOTA_FLAGS_ADJBLK)
1181 #define QAQ_SET_ADJINO(qaq) ((qaq)->qaq_flags |= LQUOTA_FLAGS_ADJINO)
1182 #define QAQ_SET_CREATE_LQS(qaq) ((qaq)->qaq_flags |= LQUOTA_QAQ_CREATE_LQS)
1184 struct mds_rec_setattr {
1191 struct ll_fid sa_fid;
1192 __u64 sa_valid; /* MDS_ATTR_* attributes */
1199 __u32 sa_attr_flags;
1200 __u32 sa_padding; /* also fix lustre_swab_mds_rec_setattr */
1203 extern void lustre_swab_mds_rec_setattr (struct mds_rec_setattr *sa);
1206 * Attribute flags used in mds_rec_setattr::sa_valid.
1207 * The kernel's #defines for ATTR_* should not be used over the network
1208 * since the client and MDS may run different kernels (see bug 13828)
1209 * Therefore, we should only use MDS_ATTR_* attributes for sa_valid.
1211 #define MDS_ATTR_MODE 0x1ULL /* = 1 */
1212 #define MDS_ATTR_UID 0x2ULL /* = 2 */
1213 #define MDS_ATTR_GID 0x4ULL /* = 4 */
1214 #define MDS_ATTR_SIZE 0x8ULL /* = 8 */
1215 #define MDS_ATTR_ATIME 0x10ULL /* = 16 */
1216 #define MDS_ATTR_MTIME 0x20ULL /* = 32 */
1217 #define MDS_ATTR_CTIME 0x40ULL /* = 64 */
1218 #define MDS_ATTR_ATIME_SET 0x80ULL /* = 128 */
1219 #define MDS_ATTR_MTIME_SET 0x100ULL /* = 256 */
1220 #define MDS_ATTR_FORCE 0x200ULL /* = 512, Not a change, but a change it */
1221 #define MDS_ATTR_ATTR_FLAG 0x400ULL /* = 1024 */
1222 #define MDS_ATTR_KILL_SUID 0x800ULL /* = 2048 */
1223 #define MDS_ATTR_KILL_SGID 0x1000ULL /* = 4096 */
1224 #define MDS_ATTR_CTIME_SET 0x2000ULL /* = 8192 */
1225 #define MDS_ATTR_FROM_OPEN 0x4000ULL /* = 16384, called from open path, ie O_TRUNC */
1226 #define MDS_ATTR_BLOCKS 0x8000ULL /* = 32768 */
1229 #define FMODE_READ 00000001
1230 #define FMODE_WRITE 00000002
1232 #define MDS_FMODE_EXEC 00000004
1233 #define MDS_OPEN_CREAT 00000100
1234 #define MDS_OPEN_EXCL 00000200
1235 #define MDS_OPEN_TRUNC 00001000
1236 #define MDS_OPEN_APPEND 00002000
1237 #define MDS_OPEN_SYNC 00010000
1238 #define MDS_OPEN_DIRECTORY 00200000
1240 #define MDS_OPEN_DELAY_CREATE 0100000000 /* delay initial object create */
1241 #define MDS_OPEN_OWNEROVERRIDE 0200000000 /* NFSD rw-reopen ro file for owner */
1242 #define MDS_OPEN_JOIN_FILE 0400000000 /* open for join file*/
1243 #define MDS_CREATE_RMT_ACL 01000000000 /* indicate create on remote server
1244 * with default ACL */
1245 #define MDS_CREATE_SLAVE_OBJ 02000000000 /* indicate create slave object
1246 * actually, this is for create, not
1247 * conflict with other open flags */
1248 #define MDS_OPEN_LOCK 04000000000 /* This open requires open lock */
1249 #define MDS_OPEN_HAS_EA 010000000000 /* specify object create pattern */
1250 #define MDS_OPEN_HAS_OBJS 020000000000 /* Just set the EA the obj exist */
1252 struct mds_rec_create {
1257 __u32 cr_flags; /* for use with open */
1259 struct ll_fid cr_fid;
1260 struct ll_fid cr_replayfid;
1264 __u32 cr_padding_1; /* also fix lustre_swab_mds_rec_create */
1265 __u32 cr_padding_2; /* also fix lustre_swab_mds_rec_create */
1266 __u32 cr_padding_3; /* also fix lustre_swab_mds_rec_create */
1267 __u32 cr_padding_4; /* also fix lustre_swab_mds_rec_create */
1268 __u32 cr_padding_5; /* also fix lustre_swab_mds_rec_create */
1271 extern void lustre_swab_mds_rec_create (struct mds_rec_create *cr);
1273 struct mdt_rec_create {
1281 __u32 cr_suppgid1_h;
1283 __u32 cr_suppgid2_h;
1284 struct lu_fid cr_fid1;
1285 struct lu_fid cr_fid2;
1286 struct lustre_handle cr_old_handle; /* handle in case of open replay */
1290 __u64 cr_padding_1; /* pad for 64 bits*/
1293 __u32 cr_flags; /* for use with open */
1294 __u32 cr_padding_2; /* pad for 64 bits*/
1295 __u32 cr_padding_3; /* pad for 64 bits*/
1296 __u32 cr_padding_4; /* pad for 64 bits*/
1300 struct lustre_handle handle;
1306 struct mds_rec_join {
1307 struct ll_fid jr_fid;
1311 extern void lustre_swab_mds_rec_join (struct mds_rec_join *jr);
1313 struct mdt_rec_join {
1314 struct lu_fid jr_fid;
1318 extern void lustre_swab_mdt_rec_join (struct mdt_rec_join *jr);
1320 struct mds_rec_link {
1327 struct ll_fid lk_fid1;
1328 struct ll_fid lk_fid2;
1330 __u32 lk_padding_1; /* also fix lustre_swab_mds_rec_link */
1331 __u32 lk_padding_2; /* also fix lustre_swab_mds_rec_link */
1332 __u32 lk_padding_3; /* also fix lustre_swab_mds_rec_link */
1333 __u32 lk_padding_4; /* also fix lustre_swab_mds_rec_link */
1336 extern void lustre_swab_mds_rec_link (struct mds_rec_link *lk);
1338 struct mdt_rec_link {
1346 __u32 lk_suppgid1_h;
1348 __u32 lk_suppgid2_h;
1349 struct lu_fid lk_fid1;
1350 struct lu_fid lk_fid2;
1364 struct mds_rec_unlink {
1371 struct ll_fid ul_fid1;
1372 struct ll_fid ul_fid2;
1374 __u32 ul_padding_1; /* also fix lustre_swab_mds_rec_unlink */
1375 __u32 ul_padding_2; /* also fix lustre_swab_mds_rec_unlink */
1376 __u32 ul_padding_3; /* also fix lustre_swab_mds_rec_unlink */
1377 __u32 ul_padding_4; /* also fix lustre_swab_mds_rec_unlink */
1380 extern void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul);
1382 struct mdt_rec_unlink {
1390 __u32 ul_suppgid1_h;
1392 __u32 ul_suppgid2_h;
1393 struct lu_fid ul_fid1;
1394 struct lu_fid ul_fid2;
1408 struct mds_rec_rename {
1415 struct ll_fid rn_fid1;
1416 struct ll_fid rn_fid2;
1418 __u32 rn_padding_1; /* also fix lustre_swab_mds_rec_rename */
1419 __u32 rn_padding_2; /* also fix lustre_swab_mds_rec_rename */
1420 __u32 rn_padding_3; /* also fix lustre_swab_mds_rec_rename */
1421 __u32 rn_padding_4; /* also fix lustre_swab_mds_rec_rename */
1424 extern void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn);
1426 struct mdt_rec_rename {
1434 __u32 rn_suppgid1_h;
1436 __u32 rn_suppgid2_h;
1437 struct lu_fid rn_fid1;
1438 struct lu_fid rn_fid2;
1444 __u32 rn_bias; /* some operation flags */
1445 __u32 rn_mode; /* cross-ref rename has mode */
1452 struct mdt_rec_setattr {
1462 __u32 sa_padding_1_h;
1463 struct lu_fid sa_fid;
1472 __u32 sa_attr_flags;
1480 struct mdt_rec_setxattr {
1488 __u32 sx_suppgid1_h;
1490 __u32 sx_suppgid2_h;
1491 struct lu_fid sx_fid;
1492 __u64 sx_padding_1; /* These three members are lu_fid size */
1504 __u32 sx_padding_10;
1505 __u32 sx_padding_11;
1511 SEQ_FIRST_OPC = SEQ_QUERY
1515 SEQ_ALLOC_SUPER = 0,
1521 * LOV data structures
1524 #define LOV_MIN_STRIPE_BITS 16 /* maximum PAGE_SIZE (ia64), power of 2 */
1525 #define LOV_MIN_STRIPE_SIZE (1<<LOV_MIN_STRIPE_BITS)
1526 #define LOV_MAX_STRIPE_COUNT 160 /* until bug 4424 is fixed */
1527 #define LOV_V1_INSANE_STRIPE_COUNT 65532 /* maximum stripe count bz13933 */
1529 #define LOV_MAX_UUID_BUFFER_SIZE 8192
1530 /* The size of the buffer the lov/mdc reserves for the
1531 * array of UUIDs returned by the MDS. With the current
1532 * protocol, this will limit the max number of OSTs per LOV */
1534 #define LOV_DESC_MAGIC 0xB0CCDE5C
1536 /* LOV settings descriptor (should only contain static info) */
1538 __u32 ld_tgt_count; /* how many OBD's */
1539 __u32 ld_active_tgt_count; /* how many active */
1540 __u32 ld_default_stripe_count; /* how many objects are used */
1541 __u32 ld_pattern; /* default PATTERN_RAID0 */
1542 __u64 ld_default_stripe_size; /* in bytes */
1543 __u64 ld_default_stripe_offset; /* in bytes */
1544 __u32 ld_padding_0; /* unused */
1545 __u32 ld_qos_maxage; /* in second */
1546 __u32 ld_padding_1; /* also fix lustre_swab_lov_desc */
1547 __u32 ld_padding_2; /* also fix lustre_swab_lov_desc */
1548 struct obd_uuid ld_uuid;
1551 #define ld_magic ld_active_tgt_count /* for swabbing from llogs */
1553 extern void lustre_swab_lov_desc (struct lov_desc *ld);
1558 /* opcodes -- MUST be distinct from OST/MDS opcodes */
1563 LDLM_BL_CALLBACK = 104,
1564 LDLM_CP_CALLBACK = 105,
1565 LDLM_GL_CALLBACK = 106,
1568 #define LDLM_FIRST_OPC LDLM_ENQUEUE
1570 #define RES_NAME_SIZE 4
1571 struct ldlm_res_id {
1572 __u64 name[RES_NAME_SIZE];
1575 extern void lustre_swab_ldlm_res_id (struct ldlm_res_id *id);
1590 #define LCK_MODE_NUM 7
1600 #define LDLM_MIN_TYPE LDLM_PLAIN
1602 struct ldlm_extent {
1608 static inline int ldlm_extent_overlap(struct ldlm_extent *ex1,
1609 struct ldlm_extent *ex2)
1611 return (ex1->start <= ex2->end) && (ex2->start <= ex1->end);
1614 struct ldlm_inodebits {
1621 __u64 blocking_export; /* not actually used over the wire */
1622 __u32 blocking_pid; /* not actually used over the wire */
1626 /* it's important that the fields of the ldlm_extent structure match
1627 * the first fields of the ldlm_flock structure because there is only
1628 * one ldlm_swab routine to process the ldlm_policy_data_t union. if
1629 * this ever changes we will need to swab the union differently based
1630 * on the resource type. */
1633 struct ldlm_extent l_extent;
1634 struct ldlm_flock l_flock;
1635 struct ldlm_inodebits l_inodebits;
1636 } ldlm_policy_data_t;
1638 extern void lustre_swab_ldlm_policy_data (ldlm_policy_data_t *d);
1640 struct ldlm_intent {
1644 extern void lustre_swab_ldlm_intent (struct ldlm_intent *i);
1646 struct ldlm_resource_desc {
1647 ldlm_type_t lr_type;
1648 __u32 lr_padding; /* also fix lustre_swab_ldlm_resource_desc */
1649 struct ldlm_res_id lr_name;
1652 extern void lustre_swab_ldlm_resource_desc (struct ldlm_resource_desc *r);
1654 struct ldlm_lock_desc {
1655 struct ldlm_resource_desc l_resource;
1656 ldlm_mode_t l_req_mode;
1657 ldlm_mode_t l_granted_mode;
1658 ldlm_policy_data_t l_policy_data;
1661 extern void lustre_swab_ldlm_lock_desc (struct ldlm_lock_desc *l);
1663 #define LDLM_LOCKREQ_HANDLES 2
1664 #define LDLM_ENQUEUE_CANCEL_OFF 1
1666 struct ldlm_request {
1669 struct ldlm_lock_desc lock_desc;
1670 struct lustre_handle lock_handle[LDLM_LOCKREQ_HANDLES];
1673 extern void lustre_swab_ldlm_request (struct ldlm_request *rq);
1675 /* If LDLM_ENQUEUE, 1 slot is already occupied, 1 is available.
1676 * Otherwise, 2 are available. */
1677 #define ldlm_request_bufsize(count,type) \
1679 int _avail = LDLM_LOCKREQ_HANDLES; \
1680 _avail -= (type == LDLM_ENQUEUE ? LDLM_ENQUEUE_CANCEL_OFF : 0); \
1681 sizeof(struct ldlm_request) + \
1682 (count - _avail > 0 ? count - _avail : 0) * \
1683 sizeof(struct lustre_handle); \
1688 __u32 lock_padding; /* also fix lustre_swab_ldlm_reply */
1689 struct ldlm_lock_desc lock_desc;
1690 struct lustre_handle lock_handle;
1691 __u64 lock_policy_res1;
1692 __u64 lock_policy_res2;
1695 extern void lustre_swab_ldlm_reply (struct ldlm_reply *r);
1698 * Opcodes for mountconf (mgs and mgc)
1703 MGS_EXCEPTION, /* node died, etc. */
1704 MGS_TARGET_REG, /* whenever target starts up */
1709 #define MGS_FIRST_OPC MGS_CONNECT
1711 #define MGS_PARAM_MAXLEN 1024
1712 #define KEY_SET_INFO "set_info"
1714 struct mgs_send_param {
1715 char mgs_param[MGS_PARAM_MAXLEN];
1718 /* We pass this info to the MGS so it can write config logs */
1719 #define MTI_NAME_MAXLEN 64
1720 #define MTI_PARAM_MAXLEN 4096
1721 #define MTI_NIDS_MAX 32
1722 struct mgs_target_info {
1723 __u32 mti_lustre_ver;
1724 __u32 mti_stripe_index;
1725 __u32 mti_config_ver;
1727 __u32 mti_nid_count;
1728 __u32 padding; /* 64 bit align */
1729 char mti_fsname[MTI_NAME_MAXLEN];
1730 char mti_svname[MTI_NAME_MAXLEN];
1731 char mti_uuid[sizeof(struct obd_uuid)];
1732 __u64 mti_nids[MTI_NIDS_MAX]; /* host nids (lnet_nid_t)*/
1733 char mti_params[MTI_PARAM_MAXLEN];
1736 extern void lustre_swab_mgs_target_info(struct mgs_target_info *oinfo);
1738 /* Config marker flags (in config log) */
1739 #define CM_START 0x01
1741 #define CM_SKIP 0x04
1742 #define CM_UPGRADE146 0x08
1743 #define CM_EXCLUDE 0x10
1744 #define CM_START_SKIP (CM_START | CM_SKIP)
1747 __u32 cm_step; /* aka config version */
1749 __u32 cm_vers; /* lustre release version number */
1750 __u32 padding; /* 64 bit align */
1751 __u64 cm_createtime; /*when this record was first created */
1752 __u64 cm_canceltime; /*when this record is no longer valid*/
1753 char cm_tgtname[MTI_NAME_MAXLEN];
1754 char cm_comment[MTI_NAME_MAXLEN];
1757 extern void lustre_swab_cfg_marker(struct cfg_marker *marker,
1758 int swab, int size);
1761 * Opcodes for multiple servers.
1770 #define OBD_FIRST_OPC OBD_PING
1772 /* catalog of log objects */
1774 /** Identifier for a single log object */
1779 } __attribute__((packed));
1781 /** Records written to the CATALOGS list */
1782 #define CATLIST "CATALOGS"
1784 struct llog_logid lci_logid;
1788 } __attribute__((packed));
1790 /** join file lov mds md*/
1791 struct lov_mds_md_join {
1792 struct lov_mds_md lmmj_md;
1793 /*join private info*/
1794 struct llog_logid lmmj_array_id; /*array object id*/
1795 __u32 lmmj_extent_count; /*array extent count*/
1798 /* Log data record types - there is no specific reason that these need to
1799 * be related to the RPC opcodes, but no reason not to (may be handy later?)
1801 #define LLOG_OP_MAGIC 0x10600000
1802 #define LLOG_OP_MASK 0xfff00000
1805 LLOG_PAD_MAGIC = LLOG_OP_MAGIC | 0x00000,
1806 OST_SZ_REC = LLOG_OP_MAGIC | 0x00f00,
1807 OST_RAID1_REC = LLOG_OP_MAGIC | 0x01000,
1808 MDS_UNLINK_REC = LLOG_OP_MAGIC | 0x10000 | (MDS_REINT << 8) | REINT_UNLINK,
1809 MDS_SETATTR_REC = LLOG_OP_MAGIC | 0x10000 | (MDS_REINT << 8) | REINT_SETATTR,
1810 MDS_SETATTR64_REC= LLOG_OP_MAGIC | 0x90000 | (MDS_REINT << 8) | REINT_SETATTR,
1811 OBD_CFG_REC = LLOG_OP_MAGIC | 0x20000,
1812 PTL_CFG_REC = LLOG_OP_MAGIC | 0x30000, /* obsolete */
1813 LLOG_GEN_REC = LLOG_OP_MAGIC | 0x40000,
1814 LLOG_JOIN_REC = LLOG_OP_MAGIC | 0x50000,
1815 /** changelog record type */
1816 CHANGELOG_REC = LLOG_OP_MAGIC | 0x60000,
1817 LLOG_HDR_MAGIC = LLOG_OP_MAGIC | 0x45539,
1818 LLOG_LOGID_MAGIC = LLOG_OP_MAGIC | 0x4553b,
1822 * for now, continue to support old pad records which have 0 for their
1823 * type but still need to be swabbed for their length
1825 #define LLOG_REC_HDR_NEEDS_SWABBING(r) \
1826 (((r)->lrh_type & __swab32(LLOG_OP_MASK)) == \
1827 __swab32(LLOG_OP_MAGIC) || \
1828 (((r)->lrh_type == 0) && ((r)->lrh_len > LLOG_CHUNK_SIZE)))
1830 /** Log record header - stored in little endian order.
1831 * Each record must start with this struct, end with a llog_rec_tail,
1832 * and be a multiple of 256 bits in size.
1834 struct llog_rec_hdr {
1841 struct llog_rec_tail {
1846 struct llog_logid_rec {
1847 struct llog_rec_hdr lid_hdr;
1848 struct llog_logid lid_id;
1854 struct llog_rec_tail lid_tail;
1855 } __attribute__((packed));
1857 /** MDS extent description
1858 * It is for joined file extent info, each extent info for joined file
1859 * just like (start, end, lmm).
1861 struct mds_extent_desc {
1862 __u64 med_start; /* extent start */
1863 __u64 med_len; /* extent length */
1864 struct lov_mds_md med_lmm; /* extent's lmm */
1867 /** Joined file array extent log record*/
1868 struct llog_array_rec {
1869 struct llog_rec_hdr lmr_hdr;
1870 struct mds_extent_desc lmr_med;
1871 struct llog_rec_tail lmr_tail;
1874 struct llog_create_rec {
1875 struct llog_rec_hdr lcr_hdr;
1876 struct ll_fid lcr_fid;
1880 struct llog_rec_tail lcr_tail;
1881 } __attribute__((packed));
1883 struct llog_orphan_rec {
1884 struct llog_rec_hdr lor_hdr;
1888 struct llog_rec_tail lor_tail;
1889 } __attribute__((packed));
1891 struct llog_unlink_rec {
1892 struct llog_rec_hdr lur_hdr;
1895 obd_count lur_count; /* to destroy the lost precreated */
1896 struct llog_rec_tail lur_tail;
1897 } __attribute__((packed));
1899 struct llog_setattr_rec {
1900 struct llog_rec_hdr lsr_hdr;
1906 struct llog_rec_tail lsr_tail;
1907 } __attribute__((packed));
1909 struct llog_setattr64_rec {
1910 struct llog_rec_hdr lsr_hdr;
1918 struct llog_rec_tail lsr_tail;
1919 } __attribute__((packed));
1921 struct llog_size_change_rec {
1922 struct llog_rec_hdr lsc_hdr;
1923 struct ll_fid lsc_fid;
1926 struct llog_rec_tail lsc_tail;
1927 } __attribute__((packed));
1932 } __attribute__((packed));
1934 struct llog_gen_rec {
1935 struct llog_rec_hdr lgr_hdr;
1936 struct llog_gen lgr_gen;
1937 struct llog_rec_tail lgr_tail;
1939 /* On-disk header structure of each log object, stored in little endian order */
1940 #define LLOG_CHUNK_SIZE 8192
1941 #define LLOG_HEADER_SIZE (96)
1942 #define LLOG_BITMAP_BYTES (LLOG_CHUNK_SIZE - LLOG_HEADER_SIZE)
1944 #define LLOG_MIN_REC_SIZE (24) /* round(llog_rec_hdr + llog_rec_tail) */
1946 /* flags for the logs */
1947 #define LLOG_F_ZAP_WHEN_EMPTY 0x1
1948 #define LLOG_F_IS_CAT 0x2
1949 #define LLOG_F_IS_PLAIN 0x4
1951 struct llog_log_hdr {
1952 struct llog_rec_hdr llh_hdr;
1953 __u64 llh_timestamp;
1955 __u32 llh_bitmap_offset;
1959 /* for a catalog the first plain slot is next to it */
1960 struct obd_uuid llh_tgtuuid;
1961 __u32 llh_reserved[LLOG_HEADER_SIZE/sizeof(__u32) - 23];
1962 __u32 llh_bitmap[LLOG_BITMAP_BYTES/sizeof(__u32)];
1963 struct llog_rec_tail llh_tail;
1964 } __attribute__((packed));
1966 #define LLOG_BITMAP_SIZE(llh) ((llh->llh_hdr.lrh_len - \
1967 llh->llh_bitmap_offset - \
1968 sizeof(llh->llh_tail)) * 8)
1970 /** log cookies are used to reference a specific log file and a record therein */
1971 struct llog_cookie {
1972 struct llog_logid lgc_lgl;
1976 } __attribute__((packed));
1978 /** llog protocol */
1979 typedef enum llogd_rpc_ops {
1980 LLOG_ORIGIN_HANDLE_CREATE = 501,
1981 LLOG_ORIGIN_HANDLE_NEXT_BLOCK = 502,
1982 LLOG_ORIGIN_HANDLE_READ_HEADER = 503,
1983 LLOG_ORIGIN_HANDLE_WRITE_REC = 504,
1984 LLOG_ORIGIN_HANDLE_CLOSE = 505,
1985 LLOG_ORIGIN_CONNECT = 506,
1986 LLOG_CATINFO = 507, /* for lfs catinfo */
1987 LLOG_ORIGIN_HANDLE_PREV_BLOCK = 508,
1988 LLOG_ORIGIN_HANDLE_DESTROY = 509, /* for destroy llog object*/
1991 #define LLOG_FIRST_OPC LLOG_ORIGIN_HANDLE_CREATE
1994 struct llog_logid lgd_logid;
1996 __u32 lgd_llh_flags;
1998 __u32 lgd_saved_index;
2000 __u64 lgd_cur_offset;
2001 } __attribute__((packed));
2003 struct llogd_conn_body {
2004 struct llog_gen lgdc_gen;
2005 struct llog_logid lgdc_logid;
2006 __u32 lgdc_ctxt_idx;
2007 } __attribute__((packed));
2009 struct lov_user_ost_data_join { /* per-stripe data structure */
2010 __u64 l_extent_start; /* extent start*/
2011 __u64 l_extent_end; /* extent end*/
2012 __u64 l_object_id; /* OST object ID */
2013 __u64 l_object_gr; /* OST object group (creating MDS number) */
2014 __u32 l_ost_gen; /* generation of this OST index */
2015 __u32 l_ost_idx; /* OST index in LOV */
2016 } __attribute__((packed));
2018 struct lov_user_md_join { /* LOV EA user data (host-endian) */
2019 __u32 lmm_magic; /* magic number = LOV_MAGIC_JOIN */
2020 __u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */
2021 __u64 lmm_object_id; /* LOV object ID */
2022 __u64 lmm_object_gr; /* LOV object group */
2023 __u32 lmm_stripe_size; /* size of stripe in bytes */
2024 __u32 lmm_stripe_count; /* num stripes in use for this object */
2025 __u32 lmm_extent_count; /* extent count of lmm*/
2026 __u64 lmm_tree_id; /* mds tree object id */
2027 __u64 lmm_tree_gen; /* mds tree object gen */
2028 struct llog_logid lmm_array_id; /* mds extent desc llog object id */
2029 struct lov_user_ost_data_join lmm_objects[0]; /* per-stripe data */
2030 } __attribute__((packed));
2032 /* Note: 64-bit types are 64-bit aligned in structure */
2034 obd_valid o_valid; /* hot fields in this obdo */
2038 obd_size o_size; /* o_size-o_blocks == ost_lvb */
2042 obd_blocks o_blocks; /* brw: cli sent cached bytes */
2045 /* 32-bit fields start here: keep an even number of them via padding */
2046 obd_blksize o_blksize; /* optimal IO blocksize */
2047 obd_mode o_mode; /* brw: cli sent cache remain */
2051 obd_count o_nlink; /* brw: checksum */
2052 obd_count o_generation;
2053 obd_count o_misc; /* brw: o_dropped */
2054 __u32 o_easize; /* epoch in ost writes */
2056 __u32 o_stripe_idx; /* holds stripe idx */
2058 struct lustre_handle o_handle; /* brw: lock handle to prolong locks */
2059 struct llog_cookie o_lcookie; /* destroy: unlink cookie from MDS */
2068 #define o_dirty o_blocks
2069 #define o_undirty o_mode
2070 #define o_dropped o_misc
2071 #define o_cksum o_nlink
2073 static inline void lustre_set_wire_obdo(struct obdo *wobdo, struct obdo *lobdo)
2075 memcpy(wobdo, lobdo, sizeof(*lobdo));
2076 wobdo->o_flags &= ~OBD_FL_LOCAL_MASK;
2079 static inline void lustre_get_wire_obdo(struct obdo *lobdo, struct obdo *wobdo)
2081 obd_flag local_flags = lobdo->o_flags & OBD_FL_LOCAL_MASK;
2083 LASSERT(!(wobdo->o_flags & OBD_FL_LOCAL_MASK));
2085 memcpy(lobdo, wobdo, sizeof(*lobdo));
2086 lobdo->o_flags &= ~OBD_FL_LOCAL_MASK;
2087 lobdo->o_flags |= local_flags;
2090 extern void lustre_swab_obdo (struct obdo *o);
2092 /* request structure for OST's */
2097 /* Key for FIEMAP to be used in get_info calls */
2098 struct ll_fiemap_info_key {
2101 struct ll_user_fiemap fiemap;
2104 extern void lustre_swab_ost_body (struct ost_body *b);
2105 extern void lustre_swab_ost_last_id(obd_id *id);
2106 extern void lustre_swab_fiemap(struct ll_user_fiemap *fiemap);
2108 extern int lustre_swab_lov_user_md(struct lov_user_md_v1 *lum);
2109 extern int lustre_swab_lov_user_md_objects(struct lov_user_md *lod);
2110 extern void lustre_swab_lov_user_md_join(struct lov_user_md_join *lumj);
2111 extern void lustre_swab_lov_mds_md(struct lov_mds_md *lmm);
2114 extern void lustre_swab_llogd_body (struct llogd_body *d);
2115 extern void lustre_swab_llog_hdr (struct llog_log_hdr *h);
2116 extern void lustre_swab_llogd_conn_body (struct llogd_conn_body *d);
2117 extern void lustre_swab_llog_rec(struct llog_rec_hdr *rec,
2118 struct llog_rec_tail *tail);
2121 extern void lustre_swab_lustre_cfg(struct lustre_cfg *lcfg);
2123 /* this will be used when OBD_CONNECT_CHANGE_QS is set */
2125 __u32 qd_id; /* ID appiles to (uid, gid) */
2126 __u32 qd_flags; /* LQUOTA_FLAGS_* affect the responding bits */
2127 __u64 qd_count; /* acquire/release count (bytes for block quota) */
2128 __u64 qd_qunit; /* when a master returns the reply to a slave, it will
2129 * contain the current corresponding qunit size */
2133 #define QDATA_IS_GRP(qdata) ((qdata)->qd_flags & LQUOTA_FLAGS_GRP)
2134 #define QDATA_IS_BLK(qdata) ((qdata)->qd_flags & LQUOTA_FLAGS_BLK)
2135 #define QDATA_IS_ADJBLK(qdata) ((qdata)->qd_flags & LQUOTA_FLAGS_ADJBLK)
2136 #define QDATA_IS_ADJINO(qdata) ((qdata)->qd_flags & LQUOTA_FLAGS_ADJINO)
2137 #define QDATA_IS_CHANGE_QS(qdata) ((qdata)->qd_flags & LQUOTA_FLAGS_CHG_QS)
2139 #define QDATA_SET_GRP(qdata) ((qdata)->qd_flags |= LQUOTA_FLAGS_GRP)
2140 #define QDATA_SET_BLK(qdata) ((qdata)->qd_flags |= LQUOTA_FLAGS_BLK)
2141 #define QDATA_SET_ADJBLK(qdata) ((qdata)->qd_flags |= LQUOTA_FLAGS_ADJBLK)
2142 #define QDATA_SET_ADJINO(qdata) ((qdata)->qd_flags |= LQUOTA_FLAGS_ADJINO)
2143 #define QDATA_SET_CHANGE_QS(qdata) ((qdata)->qd_flags |= LQUOTA_FLAGS_CHG_QS)
2145 #define QDATA_CLR_GRP(qdata) ((qdata)->qd_flags &= ~LQUOTA_FLAGS_GRP)
2146 #define QDATA_CLR_CHANGE_QS(qdata) ((qdata)->qd_flags &= ~LQUOTA_FLAGS_CHG_QS)
2148 /* this will be used when OBD_CONNECT_QUOTA64 is set */
2149 struct qunit_data_old2 {
2150 __u32 qd_id; /* ID appiles to (uid, gid) */
2151 __u32 qd_flags; /* Quota type (USRQUOTA, GRPQUOTA) occupy one bit;
2152 * Block quota or file quota occupy one bit */
2153 __u64 qd_count; /* acquire/release count (bytes for block quota) */
2156 extern void lustre_swab_qdata(struct qunit_data *d);
2157 extern void lustre_swab_qdata_old2(struct qunit_data_old2 *d);
2158 extern int quota_get_qdata(void*req, struct qunit_data *qdata,
2159 int is_req, int is_exp);
2160 extern int quota_copy_qdata(void *request, struct qunit_data *qdata,
2161 int is_req, int is_exp);
2168 #define QUOTA_FIRST_OPC QUOTA_DQACQ
2170 #define JOIN_FILE_ALIGN 4096
2172 #define QUOTA_REQUEST 1
2173 #define QUOTA_REPLY 0
2174 #define QUOTA_EXPORT 1
2175 #define QUOTA_IMPORT 0
2177 /* quota check function */
2178 #define QUOTA_RET_OK 0 /**< return successfully */
2179 #define QUOTA_RET_NOQUOTA 1 /**< not support quota */
2180 #define QUOTA_RET_NOLIMIT 2 /**< quota limit isn't set */
2181 #define QUOTA_RET_ACQUOTA 4 /**< need to acquire extra quota */
2183 extern int quota_get_qunit_data_size(__u64 flag);
2185 /* security opcodes */
2188 SEC_CTX_INIT_CONT = 802,
2191 SEC_FIRST_OPC = SEC_CTX_INIT
2195 * capa related definitions
2197 #define CAPA_HMAC_MAX_LEN 64
2198 #define CAPA_HMAC_KEY_MAX_LEN 56
2200 /* NB take care when changing the sequence of elements this struct,
2201 * because the offset info is used in find_capa() */
2202 struct lustre_capa {
2203 struct lu_fid lc_fid; /** fid */
2204 __u64 lc_opc; /** operations allowed */
2205 __u64 lc_uid; /** file owner */
2206 __u64 lc_gid; /** file group */
2207 __u32 lc_flags; /** HMAC algorithm & flags */
2208 __u32 lc_keyid; /** key# used for the capability */
2209 __u32 lc_timeout; /** capa timeout value (sec) */
2210 __u32 lc_expiry; /** expiry time (sec) */
2211 __u8 lc_hmac[CAPA_HMAC_MAX_LEN]; /** HMAC */
2212 } __attribute__((packed));