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
6 * Lustre wire protocol definitions.
8 * All structs passing over the wire should be declared here (lov_mds_md
9 * being the lone exception). Structs must be properly aligned to put
10 * 64-bit values on an 8-byte boundary. Any structs being added here
11 * must also be added to utils/wirecheck.c and "make newwiretest" run
12 * to regenerate the utils/wiretest.c sources. This allows us to verify
13 * that wire structs have the proper alignment/size on all architectures.
15 * We assume all nodes are either little-endian or big-endian, and we
16 * always send messages in the sender's native format. The receiver
17 * detects the message format by checking the 'magic' field of the message
18 * (see lustre_msg_swabbed() below).
20 * Each wire type has corresponding 'lustre_swab_xxxtypexxx()' routines,
21 * implemented either here, inline (trivial implementations) or in
22 * ptlrpc/pack_generic.c. These 'swabbers' convert the type from "other"
23 * endian, in-place in the message buffer.
25 * A swabber takes a single pointer argument. The caller must already have
26 * verified that the length of the message buffer >= sizeof (type).
28 * For variable length types, a second 'lustre_swab_v_xxxtypexxx()' routine
29 * may be defined that swabs just the variable part, after the caller has
30 * verified that the message buffer is large enough.
33 #ifndef _LUSTRE_IDL_H_
34 #define _LUSTRE_IDL_H_
36 #ifdef HAVE_ASM_TYPES_H
37 #include <asm/types.h>
39 #include <lustre/types.h>
43 # include <linux/types.h>
44 # include <linux/fs.h> /* to check for FMODE_EXEC, dev_t, lest we redefine */
47 # include <sys/types.h>
49 # include <inttypes.h>
55 /* Defn's shared with user-space. */
56 #include <lustre/lustre_user.h>
59 * this file contains all data structures used in Lustre interfaces:
60 * - obdo and obd_request records
61 * - mds_request records
69 /* FOO_REQUEST_PORTAL is for incoming requests on the FOO
70 * FOO_REPLY_PORTAL is for incoming replies on the FOO
71 * FOO_BULK_PORTAL is for incoming bulk on the FOO
74 #define CONNMGR_REQUEST_PORTAL 1
75 #define CONNMGR_REPLY_PORTAL 2
76 #define OSC_REPLY_PORTAL 4
77 #define OST_IO_PORTAL 6
78 #define OST_CREATE_PORTAL 7
79 #define OST_BULK_PORTAL 8
80 #define MDC_REPLY_PORTAL 10
81 #define MDS_REQUEST_PORTAL 12
82 #define MDS_BULK_PORTAL 14
83 #define LDLM_CB_REQUEST_PORTAL 15
84 #define LDLM_CB_REPLY_PORTAL 16
85 #define LDLM_CANCEL_REQUEST_PORTAL 17
86 #define LDLM_CANCEL_REPLY_PORTAL 18
87 #define MDS_SETATTR_PORTAL 22
88 #define MDS_READPAGE_PORTAL 23
89 #define MGC_REQUEST_PORTAL 24
90 #define MGC_REPLY_PORTAL 25
91 #define MGS_REQUEST_PORTAL 26
92 #define MGS_REPLY_PORTAL 27
93 #define OST_REQUEST_PORTAL 28
99 #define SVC_STOPPING 16
100 #define SVC_STOPPED 32
103 #define PTL_RPC_MSG_REQUEST 4711
104 #define PTL_RPC_MSG_ERR 4712
105 #define PTL_RPC_MSG_REPLY 4713
107 #define PTLRPC_MSG_MAGIC 0x0BD00BD0
110 #define PTLRPC_MSG_VERSION 0x00000003
111 #define LUSTRE_VERSION_MASK 0xffff0000
112 #define LUSTRE_OBD_VERSION 0x00010000
113 #define LUSTRE_MDS_VERSION 0x00020000
114 #define LUSTRE_OST_VERSION 0x00030000
115 #define LUSTRE_DLM_VERSION 0x00040000
116 #define LUSTRE_LOG_VERSION 0x00050000
117 #define LUSTRE_PBD_VERSION 0x00060000
119 struct lustre_handle {
122 #define DEAD_HANDLE_MAGIC 0xdeadbeefcafebabeULL
124 static inline int lustre_handle_is_used(struct lustre_handle *lh)
126 return lh->cookie != 0ull;
129 /* we depend on this structure to be 8-byte aligned */
130 /* this type is only endian-adjusted in lustre_unpack_msg() */
132 struct lustre_handle handle;
138 __u64 last_committed;
147 /* Flags that are operation-specific go in the top 16 bits. */
148 #define MSG_OP_FLAG_MASK 0xffff0000
149 #define MSG_OP_FLAG_SHIFT 16
151 /* Flags that apply to all requests are in the bottom 16 bits */
152 #define MSG_GEN_FLAG_MASK 0x0000ffff
153 #define MSG_LAST_REPLAY 1
157 static inline int lustre_msg_get_flags(struct lustre_msg *msg)
159 return (msg->flags & MSG_GEN_FLAG_MASK);
162 static inline void lustre_msg_add_flags(struct lustre_msg *msg, int flags)
164 msg->flags |= MSG_GEN_FLAG_MASK & flags;
167 static inline void lustre_msg_set_flags(struct lustre_msg *msg, int flags)
169 msg->flags &= ~MSG_GEN_FLAG_MASK;
170 lustre_msg_add_flags(msg, flags);
173 static inline void lustre_msg_clear_flags(struct lustre_msg *msg, int flags)
175 msg->flags &= ~(MSG_GEN_FLAG_MASK & flags);
178 static inline int lustre_msg_get_op_flags(struct lustre_msg *msg)
180 return (msg->flags >> MSG_OP_FLAG_SHIFT);
183 static inline void lustre_msg_add_op_flags(struct lustre_msg *msg, int flags)
185 msg->flags |= ((flags & MSG_GEN_FLAG_MASK) << MSG_OP_FLAG_SHIFT);
188 static inline void lustre_msg_set_op_flags(struct lustre_msg *msg, int flags)
190 msg->flags &= ~MSG_OP_FLAG_MASK;
191 lustre_msg_add_op_flags(msg, flags);
195 * Flags for all connect opcodes (MDS_CONNECT, OST_CONNECT)
198 #define MSG_CONNECT_RECOVERING 0x1
199 #define MSG_CONNECT_RECONNECT 0x2
200 #define MSG_CONNECT_REPLAYABLE 0x4
201 //#define MSG_CONNECT_PEER 0x8
202 #define MSG_CONNECT_LIBCLIENT 0x10
203 #define MSG_CONNECT_INITIAL 0x20
204 #define MSG_CONNECT_ASYNC 0x40
207 #define OBD_CONNECT_RDONLY 0x1ULL
208 #define OBD_CONNECT_INDEX 0x2ULL /* connect to specific LOV idx */
209 #define OBD_CONNECT_GRANT 0x8ULL /* OSC acquires grant at connect */
210 #define OBD_CONNECT_SRVLOCK 0x10ULL /* server takes locks for client */
211 #define OBD_CONNECT_VERSION 0x20ULL /* Server supports versions in ocd */
212 #define OBD_CONNECT_REQPORTAL 0x40ULL /* Separate portal for non-IO reqs */
213 #define OBD_CONNECT_ACL 0x80ULL /* client using access control lists */
214 #define OBD_CONNECT_XATTR 0x100ULL /* client using extended attributes*/
215 #define OBD_CONNECT_CROW 0x200ULL /* MDS is expecting create-on-write */
217 * set by servers supporting taking extent locks during obd_punch(). Currently
218 * is requested by liblustre clients only. See bug 9528.
220 #define OBD_CONNECT_TRUNCLOCK 0x400ULL
222 #define MDS_CONNECT_SUPPORTED (OBD_CONNECT_RDONLY|OBD_CONNECT_VERSION)
223 #define OST_CONNECT_SUPPORTED (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \
224 OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \
225 OBD_CONNECT_TRUNCLOCK)
226 #define ECHO_CONNECT_SUPPORTED (0)
227 #define MGMT_CONNECT_SUPPORTED (0)
229 #define OBD_OCD_VERSION(major,minor,patch,fix) (((major)<<24) + ((minor)<<16) +\
230 ((patch)<<8) + (fix))
231 #define OBD_OCD_VERSION_MAJOR(version) ((int)((version)>>24)&255)
232 #define OBD_OCD_VERSION_MINOR(version) ((int)((version)>>16)&255)
233 #define OBD_OCD_VERSION_PATCH(version) ((int)((version)>>8)&255)
234 #define OBD_OCD_VERSION_FIX(version) ((int)(version)&255)
236 /* This structure is used for both request and reply.
238 * If we eventually have separate connect data for different types, which we
239 * almost certainly will, then perhaps we stick a union in here. */
240 struct obd_connect_data {
241 __u64 ocd_connect_flags;
246 __u64 padding1; /* also fix lustre_swab_connect */
247 __u64 padding2; /* also fix lustre_swab_connect */
248 __u64 padding3; /* also fix lustre_swab_connect */
249 __u64 padding4; /* also fix lustre_swab_connect */
250 __u64 padding5; /* also fix lustre_swab_connect */
251 __u64 padding6; /* also fix lustre_swab_connect */
254 extern void lustre_swab_connect(struct obd_connect_data *ocd);
257 * OST requests: OBDO & OBD request records
262 OST_REPLY = 0, /* reply ? */
284 #define OST_FIRST_OPC OST_REPLY
286 typedef uint64_t obd_id;
287 typedef uint64_t obd_gr;
288 typedef uint64_t obd_time;
289 typedef uint64_t obd_size;
290 typedef uint64_t obd_off;
291 typedef uint64_t obd_blocks;
292 typedef uint32_t obd_blksize;
293 typedef uint32_t obd_mode;
294 typedef uint32_t obd_uid;
295 typedef uint32_t obd_gid;
296 typedef uint32_t obd_flag;
297 typedef uint64_t obd_valid;
298 typedef uint32_t obd_count;
300 #define OBD_FL_INLINEDATA (0x00000001)
301 #define OBD_FL_OBDMDEXISTS (0x00000002)
302 #define OBD_FL_DELORPHAN (0x00000004) /* if set in o_flags delete orphans */
303 #define OBD_FL_NORPC (0x00000008) /* set in o_flags do in OSC not OST */
304 #define OBD_FL_IDONLY (0x00000010) /* set in o_flags only adjust obj id*/
305 #define OBD_FL_RECREATE_OBJS (0x00000020) /* recreate missing obj */
306 #define OBD_FL_DEBUG_CHECK (0x00000040) /* echo client/server debug check */
307 #define OBD_FL_NO_USRQUOTA (0x00000100) /* the object's owner is over quota */
308 #define OBD_FL_NO_GRPQUOTA (0x00000200) /* the object's group is over quota */
310 * set this to delegate DLM locking during obd_punch() to the OSTs. Only OSTs
311 * that declared OBD_CONNECT_TRUNCLOCK in their connect flags support this
314 #define OBD_FL_TRUNCLOCK (0x00000800)
316 #define OBD_INLINESZ 80
318 /* Note: 64-bit types are 64-bit aligned in structure */
320 obd_valid o_valid; /* hot fields in this obdo */
324 obd_size o_size; /* o_size-o_blocks == ost_lvb */
328 obd_blocks o_blocks; /* brw: cli sent cached bytes */
330 /* 32-bit fields start here: keep an even number of them via padding */
331 obd_blksize o_blksize; /* optimal IO blocksize */
332 obd_mode o_mode; /* brw: cli sent cache remain */
336 obd_count o_nlink; /* brw: checksum */
337 obd_count o_generation;
338 obd_count o_misc; /* brw: o_dropped */
339 __u32 o_easize; /* epoch in ost writes */
341 __u32 o_padding_1; /* also fix lustre_swab_obdo */
342 __u32 o_padding_2; /* also fix lustre_swab_obdo */
343 char o_inline[OBD_INLINESZ]; /* fid in ost writes */
346 #define o_dirty o_blocks
347 #define o_undirty o_mode
348 #define o_dropped o_misc
349 #define o_cksum o_nlink
351 extern void lustre_swab_obdo (struct obdo *o);
353 #define LOV_MAGIC_V1 0x0BD10BD0
354 #define LOV_MAGIC LOV_MAGIC_V1
356 #define LOV_PATTERN_RAID0 0x001 /* stripes are used round-robin */
357 #define LOV_PATTERN_RAID1 0x002 /* stripes are mirrors of each other */
358 #define LOV_PATTERN_FIRST 0x100 /* first stripe is not in round-robin */
359 #define LOV_PATTERN_CMOBD 0x200
361 #define lov_ost_data lov_ost_data_v1
362 struct lov_ost_data_v1 { /* per-stripe data structure (little-endian)*/
363 __u64 l_object_id; /* OST object ID */
364 __u64 l_object_gr; /* OST object group (creating MDS number) */
365 __u32 l_ost_gen; /* generation of this l_ost_idx */
366 __u32 l_ost_idx; /* OST index in LOV (lov_tgt_desc->tgts) */
369 #define lov_mds_md lov_mds_md_v1
370 struct lov_mds_md_v1 { /* LOV EA mds/wire data (little-endian) */
371 __u32 lmm_magic; /* magic number = LOV_MAGIC_V1 */
372 __u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */
373 __u64 lmm_object_id; /* LOV object ID */
374 __u64 lmm_object_gr; /* LOV object group */
375 __u32 lmm_stripe_size; /* size of stripe in bytes */
376 __u32 lmm_stripe_count; /* num stripes in use for this object */
377 struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */
380 #define OBD_MD_FLID (0x00000001ULL) /* object ID */
381 #define OBD_MD_FLATIME (0x00000002ULL) /* access time */
382 #define OBD_MD_FLMTIME (0x00000004ULL) /* data modification time */
383 #define OBD_MD_FLCTIME (0x00000008ULL) /* change time */
384 #define OBD_MD_FLSIZE (0x00000010ULL) /* size */
385 #define OBD_MD_FLBLOCKS (0x00000020ULL) /* allocated blocks count */
386 #define OBD_MD_FLBLKSZ (0x00000040ULL) /* block size */
387 #define OBD_MD_FLMODE (0x00000080ULL) /* access bits (mode & ~S_IFMT) */
388 #define OBD_MD_FLTYPE (0x00000100ULL) /* object type (mode & S_IFMT) */
389 #define OBD_MD_FLUID (0x00000200ULL) /* user ID */
390 #define OBD_MD_FLGID (0x00000400ULL) /* group ID */
391 #define OBD_MD_FLFLAGS (0x00000800ULL) /* flags word */
392 #define OBD_MD_FLNLINK (0x00002000ULL) /* link count */
393 #define OBD_MD_FLGENER (0x00004000ULL) /* generation number */
394 #define OBD_MD_FLINLINE (0x00008000ULL) /* inline data */
395 #define OBD_MD_FLRDEV (0x00010000ULL) /* device number */
396 #define OBD_MD_FLEASIZE (0x00020000ULL) /* extended attribute data */
397 #define OBD_MD_LINKNAME (0x00040000ULL) /* symbolic link target */
398 #define OBD_MD_FLHANDLE (0x00080000ULL) /* file handle */
399 #define OBD_MD_FLCKSUM (0x00100000ULL) /* bulk data checksum */
400 #define OBD_MD_FLQOS (0x00200000ULL) /* quality of service stats */
401 #define OBD_MD_FLOSCOPQ (0x00400000ULL) /* osc opaque data */
402 #define OBD_MD_FLCOOKIE (0x00800000ULL) /* log cancellation cookie */
403 #define OBD_MD_FLGROUP (0x01000000ULL) /* group */
404 #define OBD_MD_FLIFID (0x02000000ULL) /* ->ost write inline fid */
405 #define OBD_MD_FLEPOCH (0x04000000ULL) /* ->ost write easize is epoch */
406 #define OBD_MD_FLGRANT (0x08000000ULL) /* ost preallocation space grant */
407 #define OBD_MD_FLDIREA (0x10000000ULL) /* dir's extended attribute data */
408 #define OBD_MD_FLUSRQUOTA (0x20000000ULL) /* over quota flags sent from ost */
409 #define OBD_MD_FLGRPQUOTA (0x40000000ULL) /* over quota flags sent from ost */
411 #define OBD_MD_MDS (0x0000000100000000ULL) /* where an inode lives on */
412 #define OBD_MD_REINT (0x0000000200000000ULL) /* reintegrate oa */
414 #define OBD_MD_FLXATTR (0x0000001000000000ULL) /* xattr */
415 #define OBD_MD_FLXATTRLS (0x0000002000000000ULL) /* xattr list */
416 #define OBD_MD_FLXATTRRM (0x0000004000000000ULL) /* xattr remove */
418 #define OBD_MD_FLGETATTR (OBD_MD_FLID | OBD_MD_FLATIME | OBD_MD_FLMTIME | \
419 OBD_MD_FLCTIME | OBD_MD_FLSIZE | OBD_MD_FLBLKSZ | \
420 OBD_MD_FLMODE | OBD_MD_FLTYPE | OBD_MD_FLUID | \
421 OBD_MD_FLGID | OBD_MD_FLFLAGS | OBD_MD_FLNLINK | \
422 OBD_MD_FLGENER | OBD_MD_FLRDEV | OBD_MD_FLGROUP)
424 static inline struct lustre_handle *obdo_handle(struct obdo *oa)
426 return (struct lustre_handle *)oa->o_inline;
429 static inline struct llog_cookie *obdo_logcookie(struct obdo *oa)
431 return (struct llog_cookie *)(oa->o_inline +
432 sizeof(struct lustre_handle));
434 /* don't forget obdo_fid which is way down at the bottom so it can
435 * come after the definition of llog_cookie */
451 extern void lustre_swab_obd_statfs (struct obd_statfs *os);
453 /* ost_body.data values for OST_BRW */
455 #define OBD_BRW_READ 0x01
456 #define OBD_BRW_WRITE 0x02
457 #define OBD_BRW_RWMASK (OBD_BRW_READ | OBD_BRW_WRITE)
458 #define OBD_BRW_SYNC 0x08
459 #define OBD_BRW_CHECK 0x10
460 #define OBD_BRW_FROM_GRANT 0x20 /* the osc manages this under llite */
461 #define OBD_BRW_GRANTED 0x40 /* the ost manages this */
462 #define OBD_BRW_DROP 0x80 /* drop the page after IO */
463 #define OBD_BRW_NOQUOTA 0x100
464 #define OBD_BRW_SRVLOCK 0x200 /* Client holds no lock over this page */
466 #define OBD_OBJECT_EOF 0xffffffffffffffffULL
468 #define OST_MIN_PRECREATE 32
469 #define OST_MAX_PRECREATE 20000
478 extern void lustre_swab_obd_ioobj (struct obd_ioobj *ioo);
480 /* multiple of 8 bytes => can array */
481 struct niobuf_remote {
487 extern void lustre_swab_niobuf_remote (struct niobuf_remote *nbr);
489 /* request structure for OST's */
495 extern void lustre_swab_ost_body (struct ost_body *b);
496 extern void lustre_swab_ost_last_id(obd_id *id);
498 /* lock value block communicated between the filter and llite */
508 extern void lustre_swab_ost_lvb(struct ost_lvb *);
517 MDS_GETATTR_NAME = 34,
528 MDS_DONE_WRITING = 45,
537 #define MDS_FIRST_OPC MDS_GETATTR
555 /* the disposition of the intent outlines what was executed */
556 #define DISP_IT_EXECD 0x01
557 #define DISP_LOOKUP_EXECD 0x02
558 #define DISP_LOOKUP_NEG 0x04
559 #define DISP_LOOKUP_POS 0x08
560 #define DISP_OPEN_CREATE 0x10
561 #define DISP_OPEN_OPEN 0x20
562 #define DISP_ENQ_COMPLETE 0x40
570 extern void lustre_swab_ll_fid (struct ll_fid *fid);
572 #define MDS_STATUS_CONN 1
573 #define MDS_STATUS_LOV 2
575 struct mds_status_req {
580 extern void lustre_swab_mds_status_req (struct mds_status_req *r);
582 #define MDS_BFLAG_UNCOMMITTED_WRITES 0x1
587 struct lustre_handle handle;
589 __u64 size; /* Offset, in the case of MDS_READPAGE */
593 __u64 blocks; /* XID, in the case of MDS_READPAGE */
602 __u32 flags; /* from vfs for pin/unpin, MDS_BFLAG for close */
604 __u32 nlink; /* #bytes to read in the case of MDS_READPAGE */
608 __u32 padding_1; /* also fix lustre_swab_mds_body */
609 __u32 padding_2; /* also fix lustre_swab_mds_body */
610 __u32 padding_3; /* also fix lustre_swab_mds_body */
611 __u32 padding_4; /* also fix lustre_swab_mds_body */
614 extern void lustre_swab_mds_body (struct mds_body *b);
616 /* XXX: same as if_dqinfo struct in kernel */
624 /* XXX: same as if_dqblk struct in kernel, plus one padding */
626 __u64 dqb_bhardlimit;
627 __u64 dqb_bsoftlimit;
629 __u64 dqb_ihardlimit;
630 __u64 dqb_isoftlimit;
635 __u32 padding; /* also fix lustre_swab_obd_quotactl */
638 #define Q_QUOTACHECK 0x800100
639 #define Q_INITQUOTA 0x800101 /* init slave limits */
640 #define Q_GETOINFO 0x800102 /* get obd quota info */
641 #define Q_GETOQUOTA 0x800103 /* get obd quotas */
643 #define Q_TYPESET(oqc, type) \
644 ((oqc)->qc_type == type || (oqc)->qc_type == UGQUOTA)
646 #define Q_GETOCMD(oqc) \
647 ((oqc)->qc_cmd == Q_GETOINFO || (oqc)->qc_cmd == Q_GETOQUOTA)
649 struct obd_quotactl {
654 struct obd_dqinfo qc_dqinfo;
655 struct obd_dqblk qc_dqblk;
658 extern void lustre_swab_obd_quotactl(struct obd_quotactl *q);
660 struct mds_rec_setattr {
667 struct ll_fid sa_fid;
676 __u32 sa_padding; /* also fix lustre_swab_mds_rec_setattr */
679 /* Remove this once we declare it in include/linux/fs.h (v21 kernel patch?) */
680 #ifndef ATTR_CTIME_SET
681 #define ATTR_CTIME_SET 0x2000
684 extern void lustre_swab_mds_rec_setattr (struct mds_rec_setattr *sa);
687 #define FMODE_READ 00000001
688 #define FMODE_WRITE 00000002
691 #define FMODE_EXEC 00000004
693 #define MDS_OPEN_CREAT 00000100
694 #define MDS_OPEN_EXCL 00000200
695 #define MDS_OPEN_TRUNC 00001000
696 #define MDS_OPEN_APPEND 00002000
697 #define MDS_OPEN_SYNC 00010000
698 #define MDS_OPEN_DIRECTORY 00200000
700 #define MDS_OPEN_DELAY_CREATE 0100000000 /* delay initial object create */
701 #define MDS_OPEN_OWNEROVERRIDE 0200000000 /* NFSD rw-reopen ro file for owner */
702 #define MDS_OPEN_HAS_EA 010000000000 /* specify object create pattern */
703 #define MDS_OPEN_HAS_OBJS 020000000000 /* Just set the EA the obj exist */
705 struct mds_rec_create {
710 __u32 cr_flags; /* for use with open */
712 struct ll_fid cr_fid;
713 struct ll_fid cr_replayfid;
717 __u32 cr_padding_1; /* also fix lustre_swab_mds_rec_create */
718 __u32 cr_padding_2; /* also fix lustre_swab_mds_rec_create */
719 __u32 cr_padding_3; /* also fix lustre_swab_mds_rec_create */
720 __u32 cr_padding_4; /* also fix lustre_swab_mds_rec_create */
721 __u32 cr_padding_5; /* also fix lustre_swab_mds_rec_create */
724 extern void lustre_swab_mds_rec_create (struct mds_rec_create *cr);
726 struct mds_rec_link {
733 struct ll_fid lk_fid1;
734 struct ll_fid lk_fid2;
736 __u32 lk_padding_1; /* also fix lustre_swab_mds_rec_link */
737 __u32 lk_padding_2; /* also fix lustre_swab_mds_rec_link */
738 __u32 lk_padding_3; /* also fix lustre_swab_mds_rec_link */
739 __u32 lk_padding_4; /* also fix lustre_swab_mds_rec_link */
742 extern void lustre_swab_mds_rec_link (struct mds_rec_link *lk);
744 struct mds_rec_unlink {
751 struct ll_fid ul_fid1;
752 struct ll_fid ul_fid2;
754 __u32 ul_padding_1; /* also fix lustre_swab_mds_rec_unlink */
755 __u32 ul_padding_2; /* also fix lustre_swab_mds_rec_unlink */
756 __u32 ul_padding_3; /* also fix lustre_swab_mds_rec_unlink */
757 __u32 ul_padding_4; /* also fix lustre_swab_mds_rec_unlink */
760 extern void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul);
762 struct mds_rec_rename {
769 struct ll_fid rn_fid1;
770 struct ll_fid rn_fid2;
772 __u32 rn_padding_1; /* also fix lustre_swab_mds_rec_rename */
773 __u32 rn_padding_2; /* also fix lustre_swab_mds_rec_rename */
774 __u32 rn_padding_3; /* also fix lustre_swab_mds_rec_rename */
775 __u32 rn_padding_4; /* also fix lustre_swab_mds_rec_rename */
778 extern void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn);
781 * LOV data structures
784 #define LOV_MIN_STRIPE_SIZE 65536 /* maximum PAGE_SIZE (ia64), power of 2 */
785 #define LOV_MAX_STRIPE_COUNT 160 /* until bug 4424 is fixed */
787 #define LOV_MAX_UUID_BUFFER_SIZE 8192
788 /* The size of the buffer the lov/mdc reserves for the
789 * array of UUIDs returned by the MDS. With the current
790 * protocol, this will limit the max number of OSTs per LOV */
792 #define LOV_DESC_MAGIC 0xB0CCDE5C
795 __u32 ld_tgt_count; /* how many OBD's */
796 __u32 ld_active_tgt_count; /* how many active */
797 __u32 ld_default_stripe_count; /* how many objects are used */
798 __u32 ld_pattern; /* PATTERN_RAID0, PATTERN_RAID1 */
799 __u64 ld_default_stripe_size; /* in bytes */
800 __u64 ld_default_stripe_offset; /* in bytes */
801 __u32 ld_padding_1; /* also fix lustre_swab_lov_desc */
802 __u32 ld_padding_2; /* also fix lustre_swab_lov_desc */
803 __u32 ld_padding_3; /* also fix lustre_swab_lov_desc */
804 __u32 ld_padding_4; /* also fix lustre_swab_lov_desc */
805 struct obd_uuid ld_uuid;
808 #define ld_magic ld_active_tgt_count /* for swabbing from llogs */
810 extern void lustre_swab_lov_desc (struct lov_desc *ld);
815 /* opcodes -- MUST be distinct from OST/MDS opcodes */
820 LDLM_BL_CALLBACK = 104,
821 LDLM_CP_CALLBACK = 105,
822 LDLM_GL_CALLBACK = 106,
825 #define LDLM_FIRST_OPC LDLM_ENQUEUE
827 #define RES_NAME_SIZE 4
829 __u64 name[RES_NAME_SIZE];
832 extern void lustre_swab_ldlm_res_id (struct ldlm_res_id *id);
856 #define LDLM_MIN_TYPE LDLM_PLAIN
867 __u64 blocking_export; /* not actually used over the wire */
868 __u32 blocking_pid; /* not actually used over the wire */
872 /* it's important that the fields of the ldlm_extent structure match
873 * the first fields of the ldlm_flock structure because there is only
874 * one ldlm_swab routine to process the ldlm_policy_data_t union. if
875 * this ever changes we will need to swab the union differently based
876 * on the resource type. */
879 struct ldlm_extent l_extent;
880 struct ldlm_flock l_flock;
881 } ldlm_policy_data_t;
883 extern void lustre_swab_ldlm_policy_data (ldlm_policy_data_t *d);
889 extern void lustre_swab_ldlm_intent (struct ldlm_intent *i);
891 struct ldlm_resource_desc {
893 __u32 lr_padding; /* also fix lustre_swab_ldlm_resource_desc */
894 struct ldlm_res_id lr_name;
897 extern void lustre_swab_ldlm_resource_desc (struct ldlm_resource_desc *r);
899 struct ldlm_lock_desc {
900 struct ldlm_resource_desc l_resource;
901 ldlm_mode_t l_req_mode;
902 ldlm_mode_t l_granted_mode;
903 ldlm_policy_data_t l_policy_data;
906 extern void lustre_swab_ldlm_lock_desc (struct ldlm_lock_desc *l);
908 struct ldlm_request {
910 __u32 lock_padding; /* also fix lustre_swab_ldlm_request */
911 struct ldlm_lock_desc lock_desc;
912 struct lustre_handle lock_handle1;
913 struct lustre_handle lock_handle2;
916 extern void lustre_swab_ldlm_request (struct ldlm_request *rq);
920 __u32 lock_padding; /* also fix lustre_swab_ldlm_reply */
921 struct ldlm_lock_desc lock_desc;
922 struct lustre_handle lock_handle;
923 __u64 lock_policy_res1;
924 __u64 lock_policy_res2;
927 extern void lustre_swab_ldlm_reply (struct ldlm_reply *r);
931 * Opcodes for mountconf (mgs and mgc)
936 MGMT_EXCEPTION, /* node died, etc. */
942 #define NAME_MAXLEN 64
943 #define UUID_MAXLEN NAME_MAXLEN + 5
945 struct mgmt_target_info {
946 char mti_fsname[NAME_MAXLEN];
947 char mti_targetname[NAME_MAXLEN];
948 char mti_nodename[NAME_MAXLEN];
949 char mti_uuid[UUID_MAXLEN];
950 __u64 mti_nid; /* lnet_nid_t */ //nid list?
951 __u32 mti_config_ver;
953 __u32 mti_stripe_index;
954 __u32 mti_stripe_pattern; /* PATTERN_RAID0, PATTERN_RAID1 */
955 __u64 mti_stripe_size; /* in bytes */
956 __u64 mti_stripe_offset; /* in bytes */
959 extern void lustre_swab_mgmt_target_info(struct mgmt_target_info *oinfo);
963 * Opcodes for multiple servers.
972 #define OBD_FIRST_OPC OBD_PING
974 /* catalog of log objects */
976 /* Identifier for a single log object */
981 } __attribute__((packed));
983 /* Records written to the CATALOGS list */
984 #define CATLIST "CATALOGS"
986 struct llog_logid lci_logid;
990 } __attribute__((packed));
992 /* Log data record types - there is no specific reason that these need to
993 * be related to the RPC opcodes, but no reason not to (may be handy later?)
995 #define LLOG_OP_MAGIC 0x10600000
996 #define LLOG_OP_MASK 0xfff00000
999 LLOG_PAD_MAGIC = LLOG_OP_MAGIC | 0,
1000 OST_SZ_REC = LLOG_OP_MAGIC | (OST_SAN_WRITE << 8),
1001 OST_RAID1_REC = LLOG_OP_MAGIC | ((OST_SAN_WRITE + 1) << 8),
1002 MDS_UNLINK_REC = LLOG_OP_MAGIC | 0x10000 | (MDS_REINT << 8) | REINT_UNLINK,
1003 MDS_SETATTR_REC = LLOG_OP_MAGIC | 0x10000 | (MDS_REINT << 8) | REINT_SETATTR,
1004 OBD_CFG_REC = LLOG_OP_MAGIC | 0x20000,
1005 PTL_CFG_REC = LLOG_OP_MAGIC | 0x30000, /* obsolete */
1006 LLOG_GEN_REC = LLOG_OP_MAGIC | 0x40000,
1007 LLOG_HDR_MAGIC = LLOG_OP_MAGIC | 0x45539,
1008 LLOG_LOGID_MAGIC = LLOG_OP_MAGIC | 0x4553b,
1012 * for now, continue to support old pad records which have 0 for their
1013 * type but still need to be swabbed for their length
1015 #define LLOG_REC_HDR_NEEDS_SWABBING(r) \
1016 (((r)->lrh_type & __swab32(LLOG_OP_MASK)) == \
1017 __swab32(LLOG_OP_MAGIC) || \
1018 (((r)->lrh_type == 0) && ((r)->lrh_len > LLOG_CHUNK_SIZE)))
1020 /* Log record header - stored in little endian order.
1021 * Each record must start with this struct, end with a llog_rec_tail,
1022 * and be a multiple of 256 bits in size.
1024 struct llog_rec_hdr {
1031 struct llog_rec_tail {
1036 struct llog_logid_rec {
1037 struct llog_rec_hdr lid_hdr;
1038 struct llog_logid lid_id;
1044 struct llog_rec_tail lid_tail;
1045 } __attribute__((packed));
1047 struct llog_create_rec {
1048 struct llog_rec_hdr lcr_hdr;
1049 struct ll_fid lcr_fid;
1053 struct llog_rec_tail lcr_tail;
1054 } __attribute__((packed));
1056 struct llog_orphan_rec {
1057 struct llog_rec_hdr lor_hdr;
1061 struct llog_rec_tail lor_tail;
1062 } __attribute__((packed));
1064 struct llog_unlink_rec {
1065 struct llog_rec_hdr lur_hdr;
1069 struct llog_rec_tail lur_tail;
1070 } __attribute__((packed));
1072 struct llog_setattr_rec {
1073 struct llog_rec_hdr lsr_hdr;
1079 struct llog_rec_tail lsr_tail;
1080 } __attribute__((packed));
1082 struct llog_size_change_rec {
1083 struct llog_rec_hdr lsc_hdr;
1084 struct ll_fid lsc_fid;
1087 struct llog_rec_tail lsc_tail;
1088 } __attribute__((packed));
1093 } __attribute__((packed));
1095 struct llog_gen_rec {
1096 struct llog_rec_hdr lgr_hdr;
1097 struct llog_gen lgr_gen;
1098 struct llog_rec_tail lgr_tail;
1100 /* On-disk header structure of each log object, stored in little endian order */
1101 #define LLOG_CHUNK_SIZE 8192
1102 #define LLOG_HEADER_SIZE (96)
1103 #define LLOG_BITMAP_BYTES (LLOG_CHUNK_SIZE - LLOG_HEADER_SIZE)
1105 #define LLOG_MIN_REC_SIZE (24) /* round(llog_rec_hdr + llog_rec_tail) */
1107 /* flags for the logs */
1108 #define LLOG_F_ZAP_WHEN_EMPTY 0x1
1109 #define LLOG_F_IS_CAT 0x2
1110 #define LLOG_F_IS_PLAIN 0x4
1112 struct llog_log_hdr {
1113 struct llog_rec_hdr llh_hdr;
1114 __u64 llh_timestamp;
1116 __u32 llh_bitmap_offset;
1120 /* for a catalog the first plain slot is next to it */
1121 struct obd_uuid llh_tgtuuid;
1122 __u32 llh_reserved[LLOG_HEADER_SIZE/sizeof(__u32) - 23];
1123 __u32 llh_bitmap[LLOG_BITMAP_BYTES/sizeof(__u32)];
1124 struct llog_rec_tail llh_tail;
1125 } __attribute__((packed));
1127 #define LLOG_BITMAP_SIZE(llh) ((llh->llh_hdr.lrh_len - \
1128 llh->llh_bitmap_offset - \
1129 sizeof(llh->llh_tail)) * 8)
1131 /* log cookies are used to reference a specific log file and a record therein */
1132 struct llog_cookie {
1133 struct llog_logid lgc_lgl;
1137 } __attribute__((packed));
1140 enum llogd_rpc_ops {
1141 LLOG_ORIGIN_HANDLE_CREATE = 501,
1142 LLOG_ORIGIN_HANDLE_NEXT_BLOCK = 502,
1143 LLOG_ORIGIN_HANDLE_READ_HEADER = 503,
1144 LLOG_ORIGIN_HANDLE_WRITE_REC = 504,
1145 LLOG_ORIGIN_HANDLE_CLOSE = 505,
1146 LLOG_ORIGIN_CONNECT = 506,
1147 LLOG_CATINFO = 507, /* for lfs catinfo */
1151 struct llog_logid lgd_logid;
1153 __u32 lgd_llh_flags;
1155 __u32 lgd_saved_index;
1157 __u64 lgd_cur_offset;
1158 } __attribute__((packed));
1160 struct llogd_conn_body {
1161 struct llog_gen lgdc_gen;
1162 struct llog_logid lgdc_logid;
1163 __u32 lgdc_ctxt_idx;
1164 } __attribute__((packed));
1166 extern void lustre_swab_lov_user_md(struct lov_user_md *lum);
1167 extern void lustre_swab_lov_user_md_objects(struct lov_user_md *lum);
1170 extern void lustre_swab_llogd_body (struct llogd_body *d);
1171 extern void lustre_swab_llog_hdr (struct llog_log_hdr *h);
1172 extern void lustre_swab_llogd_conn_body (struct llogd_conn_body *d);
1173 extern void lustre_swab_llog_rec(struct llog_rec_hdr *rec,
1174 struct llog_rec_tail *tail);
1177 extern void lustre_swab_lustre_cfg(struct lustre_cfg *lcfg);
1179 static inline struct ll_fid *obdo_fid(struct obdo *oa)
1181 return (struct ll_fid *)(oa->o_inline + sizeof(struct lustre_handle) +
1182 sizeof(struct llog_cookie));
1190 __u32 qd_isblk; /* indicating if it's block quota */
1192 extern void lustre_swab_qdata(struct qunit_data *d);