/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8: * * This file is part of Lustre, http://www.lustre.org * * Lustre wire protocol definitions. * * All structs passing over the wire should be declared here (lov_mds_md * being the lone exception). Structs must be properly aligned to put * 64-bit values on an 8-byte boundary. Any structs being added here * must also be added to utils/wirecheck.c and "make newwiretest" run * to regenerate the utils/wiretest.c sources. This allows us to verify * that wire structs have the proper alignment/size on all architectures. * * We assume all nodes are either little-endian or big-endian, and we * always send messages in the sender's native format. The receiver * detects the message format by checking the 'magic' field of the message * (see lustre_msg_swabbed() below). * * Each wire type has corresponding 'lustre_swab_xxxtypexxx()' routines, * implemented either here, inline (trivial implementations) or in * ptlrpc/pack_generic.c. These 'swabbers' convert the type from "other" * endian, in-place in the message buffer. * * A swabber takes a single pointer argument. The caller must already have * verified that the length of the message buffer >= sizeof (type). * * For variable length types, a second 'lustre_swab_v_xxxtypexxx()' routine * may be defined that swabs just the variable part, after the caller has * verified that the message buffer is large enough. */ #ifndef _LUSTRE_IDL_H_ #define _LUSTRE_IDL_H_ #ifdef HAVE_ASM_TYPES_H #include #else #include #endif #ifdef __KERNEL__ # include # include /* to check for FMODE_EXEC, dev_t, lest we redefine */ # ifdef CONFIG_FS_POSIX_ACL # include # endif #else #ifdef __CYGWIN__ # include #elif defined(_AIX) # include #else # include #endif #endif #include /* for lnet_nid_t */ /* Defn's shared with user-space. */ #include /* * CLASSERT() */ #include /* * this file contains all data structures used in Lustre interfaces: * - obdo and obd_request records * - mds_request records * - ldlm data * - ioctl's */ /* * GENERAL STUFF */ /* FOO_REQUEST_PORTAL is for incoming requests on the FOO * FOO_REPLY_PORTAL is for incoming replies on the FOO * FOO_BULK_PORTAL is for incoming bulk on the FOO */ #define CONNMGR_REQUEST_PORTAL 1 #define CONNMGR_REPLY_PORTAL 2 #define OSC_REPLY_PORTAL 4 #define OST_IO_PORTAL 6 #define OST_CREATE_PORTAL 7 #define OST_BULK_PORTAL 8 #define MDC_REPLY_PORTAL 10 #define MDS_REQUEST_PORTAL 12 #define MDS_BULK_PORTAL 14 #define LDLM_CB_REQUEST_PORTAL 15 #define LDLM_CB_REPLY_PORTAL 16 #define LDLM_CANCEL_REQUEST_PORTAL 17 #define LDLM_CANCEL_REPLY_PORTAL 18 #define MDS_SETATTR_PORTAL 22 #define MDS_READPAGE_PORTAL 23 #define MGC_REPLY_PORTAL 25 #define MGS_REQUEST_PORTAL 26 #define MGS_REPLY_PORTAL 27 #define OST_REQUEST_PORTAL 28 #define MDS_FLD_PORTAL 29 #define SVC_KILLED 1 #define SVC_EVENT 2 #define SVC_SIGNAL 4 #define SVC_RUNNING 8 #define SVC_STOPPING 16 #define SVC_STOPPED 32 /* packet types */ #define PTL_RPC_MSG_REQUEST 4711 #define PTL_RPC_MSG_ERR 4712 #define PTL_RPC_MSG_REPLY 4713 #define PTLRPC_MSG_MAGIC 0x0BD00BD0 #define PTLRPC_MSG_VERSION 0x00000003 #define LUSTRE_VERSION_MASK 0xffff0000 #define LUSTRE_OBD_VERSION 0x00010000 #define LUSTRE_MDS_VERSION 0x00020000 #define LUSTRE_OST_VERSION 0x00030000 #define LUSTRE_DLM_VERSION 0x00040000 #define LUSTRE_LOG_VERSION 0x00050000 #define LUSTRE_MGS_VERSION 0x00060000 struct lu_fid { __u64 f_seq; /* holds fid sequence. Lustre should support 2 ^ 64 * objects, thus even if one sequence has one object we * reach this value. */ __u32 f_oid; /* fid number within its sequence. */ __u32 f_ver; /* holds fid version. */ }; /* * fid constants */ enum { LUSTRE_ROOT_FID_SEQ = 1ULL, /* XXX: should go into mkfs. */ LUSTRE_ROOT_FID_OID = 2UL, /* XXX: should go into mkfs. */ /* maximal objects in sequence */ LUSTRE_FID_SEQ_WIDTH = 10000, /* initial fid id value */ LUSTRE_FID_INIT_OID = 1UL, /* shift of version component */ LUSTRE_FID_VER_SHIFT = (sizeof(((struct lu_fid *)0)->f_ver) * 8) }; /* get object sequence */ static inline __u64 fid_seq(const struct lu_fid *fid) { return fid->f_seq; } /* get object id */ static inline __u32 fid_oid(const struct lu_fid *fid) { return fid->f_oid; } /* get object version */ static inline __u32 fid_ver(const struct lu_fid *fid) { return fid->f_ver; } /* get complex object number (oid + version) */ static inline __u64 fid_num(const struct lu_fid *fid) { __u64 f_ver = fid_ver(fid); f_ver = f_ver << LUSTRE_FID_VER_SHIFT; return f_ver | fid_oid(fid); } static inline int fid_is_sane(const struct lu_fid *fid) { return fid != NULL && fid_seq(fid) != 0 && fid_oid(fid) != 0; } #define DFID3 "["LPU64"/%u:%u]" #define PFID3(fid) \ fid_seq(fid), \ fid_oid(fid), \ fid_ver(fid) extern void lustre_swab_lu_fid (struct lu_fid *fid); static inline int lu_fid_eq(const struct lu_fid *f0, const struct lu_fid *f1) { /* check that there is no alignment padding */ CLASSERT(sizeof *f0 == sizeof f0->f_seq + sizeof f0->f_oid + sizeof f0->f_ver); return memcmp(f0, f1, sizeof *f0) == 0; } static inline void fid_cpu_to_le(struct lu_fid *fid) { fid->f_seq = cpu_to_le64(fid_seq(fid)); fid->f_oid = cpu_to_le32(fid_oid(fid)); fid->f_ver = cpu_to_le32(fid_ver(fid)); } static inline void fid_le_to_cpu(struct lu_fid *fid) { fid->f_seq = le64_to_cpu(fid_seq(fid)); fid->f_oid = le32_to_cpu(fid_oid(fid)); fid->f_ver = le32_to_cpu(fid_ver(fid)); } #define MEA_MAGIC_LAST_CHAR 0xb2221ca1 #define MEA_MAGIC_ALL_CHARS 0xb222a11c struct lmv_stripe_md { __u32 mea_magic; __u32 mea_count; __u32 mea_master; struct lu_fid mea_ids[0]; }; struct lustre_handle { __u64 cookie; }; #define DEAD_HANDLE_MAGIC 0xdeadbeefcafebabeULL static inline int lustre_handle_is_used(struct lustre_handle *lh) { return lh->cookie != 0ull; } static inline int lustre_handle_equal(struct lustre_handle *lh1, struct lustre_handle *lh2) { return lh1->cookie == lh2->cookie; } static inline void lustre_handle_copy(struct lustre_handle *tgt, struct lustre_handle *src) { tgt->cookie = src->cookie; } /* we depend on this structure to be 8-byte aligned */ /* this type is only endian-adjusted in lustre_unpack_msg() */ struct lustre_msg { struct lustre_handle handle; __u32 magic; __u32 type; __u32 version; __u32 opc; __u64 last_xid; __u64 last_committed; __u64 transno; __u32 status; __u32 flags; __u32 conn_cnt; __u32 bufcount; __u32 buflens[0]; }; /* Flags that are operation-specific go in the top 16 bits. */ #define MSG_OP_FLAG_MASK 0xffff0000 #define MSG_OP_FLAG_SHIFT 16 /* Flags that apply to all requests are in the bottom 16 bits */ #define MSG_GEN_FLAG_MASK 0x0000ffff #define MSG_LAST_REPLAY 1 #define MSG_RESENT 2 #define MSG_REPLAY 4 static inline int lustre_msg_get_flags(struct lustre_msg *msg) { return (msg->flags & MSG_GEN_FLAG_MASK); } static inline void lustre_msg_add_flags(struct lustre_msg *msg, int flags) { msg->flags |= MSG_GEN_FLAG_MASK & flags; } static inline void lustre_msg_set_flags(struct lustre_msg *msg, int flags) { msg->flags &= ~MSG_GEN_FLAG_MASK; lustre_msg_add_flags(msg, flags); } static inline void lustre_msg_clear_flags(struct lustre_msg *msg, int flags) { msg->flags &= ~(MSG_GEN_FLAG_MASK & flags); } static inline int lustre_msg_get_op_flags(struct lustre_msg *msg) { return (msg->flags >> MSG_OP_FLAG_SHIFT); } static inline void lustre_msg_add_op_flags(struct lustre_msg *msg, int flags) { msg->flags |= ((flags & MSG_GEN_FLAG_MASK) << MSG_OP_FLAG_SHIFT); } static inline void lustre_msg_set_op_flags(struct lustre_msg *msg, int flags) { msg->flags &= ~MSG_OP_FLAG_MASK; lustre_msg_add_op_flags(msg, flags); } /* * Flags for all connect opcodes (MDS_CONNECT, OST_CONNECT) */ #define MSG_CONNECT_RECOVERING 0x1 #define MSG_CONNECT_RECONNECT 0x2 #define MSG_CONNECT_REPLAYABLE 0x4 //#define MSG_CONNECT_PEER 0x8 #define MSG_CONNECT_LIBCLIENT 0x10 #define MSG_CONNECT_INITIAL 0x20 #define MSG_CONNECT_ASYNC 0x40 /* Connect flags */ #define OBD_CONNECT_RDONLY 0x1ULL /* client allowed read-only access */ #define OBD_CONNECT_INDEX 0x2ULL /* connect to specific LOV idx */ #define OBD_CONNECT_GRANT 0x8ULL /* OSC acquires grant at connect */ #define OBD_CONNECT_SRVLOCK 0x10ULL /* server takes locks for client */ #define OBD_CONNECT_VERSION 0x20ULL /* Server supports versions in ocd */ #define OBD_CONNECT_REQPORTAL 0x40ULL /* Separate portal for non-IO reqs */ #define OBD_CONNECT_ACL 0x80ULL /* client using access control lists */ #define OBD_CONNECT_XATTR 0x100ULL /* client using extended attributes*/ #define OBD_CONNECT_CROW 0x200ULL /* MDS+OST do object create-on-write */ #define OBD_CONNECT_TRUNCLOCK 0x400ULL /* server gets locks for punch b=9528 */ #define OBD_CONNECT_TRANSNO 0x800ULL /* replay is sending initial transno */ #define OBD_CONNECT_IBITS 0x1000ULL /* support for inodebits locks */ #define OBD_CONNECT_JOIN 0x2000ULL /* files can be concatenated */ #define OBD_CONNECT_REAL 0x4000ULL /* show MD stack that real connect is * performed */ #define OBD_CONNECT_EMPTY 0x80000000ULL /* fake: these are empty connect flags*/ /* also update obd_connect_names[] for lprocfs_rd_connect_flags() */ #define MDS_CONNECT_SUPPORTED (OBD_CONNECT_RDONLY | OBD_CONNECT_VERSION | \ OBD_CONNECT_ACL | OBD_CONNECT_XATTR | \ OBD_CONNECT_IBITS | OBD_CONNECT_JOIN) #define OST_CONNECT_SUPPORTED (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \ OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \ OBD_CONNECT_TRUNCLOCK | OBD_CONNECT_INDEX) #define ECHO_CONNECT_SUPPORTED (0) #define MGS_CONNECT_SUPPORTED (OBD_CONNECT_VERSION) #define MDT_CONNECT_SUPPORTED (OBD_CONNECT_RDONLY | OBD_CONNECT_VERSION | \ OBD_CONNECT_ACL | OBD_CONNECT_XATTR | \ OBD_CONNECT_IBITS | OBD_CONNECT_JOIN) #define OBD_OCD_VERSION(major,minor,patch,fix) (((major)<<24) + ((minor)<<16) +\ ((patch)<<8) + (fix)) #define OBD_OCD_VERSION_MAJOR(version) ((int)((version)>>24)&255) #define OBD_OCD_VERSION_MINOR(version) ((int)((version)>>16)&255) #define OBD_OCD_VERSION_PATCH(version) ((int)((version)>>8)&255) #define OBD_OCD_VERSION_FIX(version) ((int)(version)&255) /* * OST requests: OBDO & OBD request records */ /* opcodes */ typedef enum { OST_REPLY = 0, /* reply ? */ OST_GETATTR = 1, OST_SETATTR = 2, OST_READ = 3, OST_WRITE = 4, OST_CREATE = 5, OST_DESTROY = 6, OST_GET_INFO = 7, OST_CONNECT = 8, OST_DISCONNECT = 9, OST_PUNCH = 10, OST_OPEN = 11, OST_CLOSE = 12, OST_STATFS = 13, OST_SAN_READ = 14, OST_SAN_WRITE = 15, OST_SYNC = 16, OST_SET_INFO = 17, OST_QUOTACHECK = 18, OST_QUOTACTL = 19, OST_LAST_OPC } ost_cmd_t; #define OST_FIRST_OPC OST_REPLY typedef uint64_t obd_id; typedef uint64_t obd_gr; typedef uint64_t obd_time; typedef uint64_t obd_size; typedef uint64_t obd_off; typedef uint64_t obd_blocks; typedef uint32_t obd_blksize; typedef uint32_t obd_mode; typedef uint32_t obd_uid; typedef uint32_t obd_gid; typedef uint32_t obd_flag; typedef uint64_t obd_valid; typedef uint32_t obd_count; #define OBD_FL_INLINEDATA (0x00000001) #define OBD_FL_OBDMDEXISTS (0x00000002) #define OBD_FL_DELORPHAN (0x00000004) /* if set in o_flags delete orphans */ #define OBD_FL_NORPC (0x00000008) /* set in o_flags do in OSC not OST */ #define OBD_FL_IDONLY (0x00000010) /* set in o_flags only adjust obj id*/ #define OBD_FL_RECREATE_OBJS (0x00000020) /* recreate missing obj */ #define OBD_FL_DEBUG_CHECK (0x00000040) /* echo client/server debug check */ #define OBD_FL_NO_USRQUOTA (0x00000100) /* the object's owner is over quota */ #define OBD_FL_NO_GRPQUOTA (0x00000200) /* the object's group is over quota */ #define OBD_FL_CREATE_CROW (0x00000400) /* object should be create on write */ /* * set this to delegate DLM locking during obd_punch() to the OSTs. Only OSTs * that declared OBD_CONNECT_TRUNCLOCK in their connect flags support this * functionality. */ #define OBD_FL_TRUNCLOCK (0x00000800) /* this should be not smaller than sizeof(struct lustre_handle) + sizeof(struct * llog_cookie) + sizeof(lu_fid). Nevertheless struct lu_fid is not longer * stored in o_inline, we keep this just for case. */ #define OBD_INLINESZ 80 /* Note: 64-bit types are 64-bit aligned in structure */ struct obdo { obd_valid o_valid; /* hot fields in this obdo */ obd_id o_id; obd_gr o_gr; obd_id o_fid; obd_size o_size; /* o_size-o_blocks == ost_lvb */ obd_time o_mtime; obd_time o_atime; obd_time o_ctime; obd_blocks o_blocks; /* brw: cli sent cached bytes */ obd_size o_grant; /* 32-bit fields start here: keep an even number of them via padding */ obd_blksize o_blksize; /* optimal IO blocksize */ obd_mode o_mode; /* brw: cli sent cache remain */ obd_uid o_uid; obd_gid o_gid; obd_flag o_flags; obd_count o_nlink; /* brw: checksum */ obd_count o_generation; obd_count o_misc; /* brw: o_dropped */ __u32 o_easize; /* epoch in ost writes */ __u32 o_mds; __u32 o_stripe_idx; /* holds stripe idx */ __u32 o_padding_1; char o_inline[OBD_INLINESZ]; /* fid in ost writes */ }; #define o_dirty o_blocks #define o_undirty o_mode #define o_dropped o_misc #define o_cksum o_nlink extern void lustre_swab_obdo (struct obdo *o); struct md_op_data { struct lu_fid fid1; struct lu_fid fid2; __u64 mod_time; const char *name; int namelen; __u32 create_mode; struct lmv_stripe_md *mea1; struct lmv_stripe_md *mea2; __u32 suppgids[2]; /* part of obdo fields for md stack */ obd_valid valid; obd_size size; obd_blocks blocks; obd_flag flags; obd_time mtime; obd_time atime; obd_time ctime; }; #define MDS_MODE_DONT_LOCK (1 << 30) #define MDS_MODE_REPLAY (1 << 31) #define LOV_MAGIC_V1 0x0BD10BD0 #define LOV_MAGIC LOV_MAGIC_V1 #define LOV_MAGIC_JOIN 0x0BD20BD0 #define LOV_PATTERN_RAID0 0x001 /* stripes are used round-robin */ #define LOV_PATTERN_RAID1 0x002 /* stripes are mirrors of each other */ #define LOV_PATTERN_FIRST 0x100 /* first stripe is not in round-robin */ #define LOV_PATTERN_CMOBD 0x200 #define lov_ost_data lov_ost_data_v1 struct lov_ost_data_v1 { /* per-stripe data structure (little-endian)*/ __u64 l_object_id; /* OST object ID */ __u64 l_object_gr; /* OST object group (creating MDS number) */ __u32 l_ost_gen; /* generation of this l_ost_idx */ __u32 l_ost_idx; /* OST index in LOV (lov_tgt_desc->tgts) */ }; #define lov_mds_md lov_mds_md_v1 struct lov_mds_md_v1 { /* LOV EA mds/wire data (little-endian) */ __u32 lmm_magic; /* magic number = LOV_MAGIC_V1 */ __u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */ __u64 lmm_object_id; /* LOV object ID */ __u64 lmm_object_gr; /* LOV object group */ __u32 lmm_stripe_size; /* size of stripe in bytes */ __u32 lmm_stripe_count; /* num stripes in use for this object */ struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */ }; #define OBD_MD_FLID (0x0000000000000001ULL) /* object ID */ #define OBD_MD_FLATIME (0x0000000000000002ULL) /* access time */ #define OBD_MD_FLMTIME (0x0000000000000004ULL) /* data modification time */ #define OBD_MD_FLCTIME (0x0000000000000008ULL) /* change time */ #define OBD_MD_FLSIZE (0x0000000000000010ULL) /* size */ #define OBD_MD_FLBLOCKS (0x0000000000000020ULL) /* allocated blocks count */ #define OBD_MD_FLBLKSZ (0x0000000000000040ULL) /* block size */ #define OBD_MD_FLMODE (0x0000000000000080ULL) /* access bits (mode & ~S_IFMT) */ #define OBD_MD_FLTYPE (0x0000000000000100ULL) /* object type (mode & S_IFMT) */ #define OBD_MD_FLUID (0x0000000000000200ULL) /* user ID */ #define OBD_MD_FLGID (0x0000000000000400ULL) /* group ID */ #define OBD_MD_FLFLAGS (0x0000000000000800ULL) /* flags word */ #define OBD_MD_FLNLINK (0x0000000000002000ULL) /* link count */ #define OBD_MD_FLGENER (0x0000000000004000ULL) /* generation number */ #define OBD_MD_FLINLINE (0x0000000000008000ULL) /* inline data */ #define OBD_MD_FLRDEV (0x0000000000010000ULL) /* device number */ #define OBD_MD_FLEASIZE (0x0000000000020000ULL) /* extended attribute data */ #define OBD_MD_LINKNAME (0x0000000000040000ULL) /* symbolic link target */ #define OBD_MD_FLHANDLE (0x0000000000080000ULL) /* file handle */ #define OBD_MD_FLCKSUM (0x0000000000100000ULL) /* bulk data checksum */ #define OBD_MD_FLQOS (0x0000000000200000ULL) /* quality of service stats */ #define OBD_MD_FLOSCOPQ (0x0000000000400000ULL) /* osc opaque data */ #define OBD_MD_FLCOOKIE (0x0000000000800000ULL) /* log cancellation cookie */ #define OBD_MD_FLGROUP (0x0000000001000000ULL) /* group */ #define OBD_MD_FLFID (0x0000000002000000ULL) /* ->ost write inline fid */ #define OBD_MD_FLEPOCH (0x0000000004000000ULL) /* ->ost write easize is epoch */ #define OBD_MD_FLGRANT (0x0000000008000000ULL) /* ost preallocation space grant */ #define OBD_MD_FLDIREA (0x0000000010000000ULL) /* dir's extended attribute data */ #define OBD_MD_FLUSRQUOTA (0x0000000020000000ULL) /* over quota flags sent from ost */ #define OBD_MD_FLGRPQUOTA (0x0000000040000000ULL) /* over quota flags sent from ost */ #define OBD_MD_FLMODEASIZE (0x0000000080000000ULL) /* EA size will be changed */ #define OBD_MD_MDS (0x0000000100000000ULL) /* where an inode lives on */ #define OBD_MD_REINT (0x0000000200000000ULL) /* reintegrate oa */ #define OBD_MD_MEA (0x0000000400000000ULL) /* CMD EA */ #define OBD_MD_FLXATTR (0x0000001000000000ULL) /* xattr */ #define OBD_MD_FLXATTRLS (0x0000002000000000ULL) /* xattr list */ #define OBD_MD_FLXATTRRM (0x0000004000000000ULL) /* xattr remove */ #define OBD_MD_FLACL (0x0000008000000000ULL) /* ACL */ #define OBD_MD_FLGETATTR (OBD_MD_FLID | OBD_MD_FLATIME | OBD_MD_FLMTIME | \ OBD_MD_FLCTIME | OBD_MD_FLSIZE | OBD_MD_FLBLKSZ | \ OBD_MD_FLMODE | OBD_MD_FLTYPE | OBD_MD_FLUID | \ OBD_MD_FLGID | OBD_MD_FLFLAGS | OBD_MD_FLNLINK | \ OBD_MD_FLGENER | OBD_MD_FLRDEV | OBD_MD_FLGROUP) static inline struct lustre_handle *obdo_handle(struct obdo *oa) { return (struct lustre_handle *)oa->o_inline; } static inline struct llog_cookie *obdo_logcookie(struct obdo *oa) { return (struct llog_cookie *)(oa->o_inline + sizeof(struct lustre_handle)); } /* don't forget obdo_fid which is way down at the bottom so it can * come after the definition of llog_cookie */ struct obd_statfs { __u64 os_type; __u64 os_blocks; __u64 os_bfree; __u64 os_bavail; __u64 os_files; __u64 os_ffree; __u8 os_fsid[40]; __u32 os_bsize; __u32 os_namelen; __u64 os_maxbytes; __u32 os_state; /* positive error code on server */ __u32 os_spare1; __u32 os_spare2; __u32 os_spare3; __u32 os_spare4; __u32 os_spare5; __u32 os_spare6; __u32 os_spare7; __u32 os_spare8; __u32 os_spare9; }; extern void lustre_swab_obd_statfs (struct obd_statfs *os); /* ost_body.data values for OST_BRW */ #define OBD_BRW_READ 0x01 #define OBD_BRW_WRITE 0x02 #define OBD_BRW_RWMASK (OBD_BRW_READ | OBD_BRW_WRITE) #define OBD_BRW_SYNC 0x08 #define OBD_BRW_CHECK 0x10 #define OBD_BRW_FROM_GRANT 0x20 /* the osc manages this under llite */ #define OBD_BRW_GRANTED 0x40 /* the ost manages this */ #define OBD_BRW_DROP 0x80 /* drop the page after IO */ #define OBD_BRW_NOQUOTA 0x100 #define OBD_BRW_SRVLOCK 0x200 /* Client holds no lock over this page */ #define OBD_OBJECT_EOF 0xffffffffffffffffULL #define OST_MIN_PRECREATE 32 #define OST_MAX_PRECREATE 20000 struct obd_ioobj { obd_id ioo_id; obd_gr ioo_gr; __u32 ioo_type; __u32 ioo_bufcnt; }; extern void lustre_swab_obd_ioobj (struct obd_ioobj *ioo); /* multiple of 8 bytes => can array */ struct niobuf_remote { __u64 offset; __u32 len; __u32 flags; }; extern void lustre_swab_niobuf_remote (struct niobuf_remote *nbr); /* request structure for OST's */ struct ost_body { struct obdo oa; }; extern void lustre_swab_ost_body (struct ost_body *b); extern void lustre_swab_ost_last_id(obd_id *id); extern void lustre_swab_generic_32s(__u32 *val); /* lock value block communicated between the filter and llite */ struct ost_lvb { __u64 lvb_size; __u64 lvb_mtime; __u64 lvb_atime; __u64 lvb_ctime; __u64 lvb_blocks; }; extern void lustre_swab_ost_lvb(struct ost_lvb *); /* * MDS REQ RECORDS */ /* FIXME: this is different from HEAD, adjust it * while merge GSS */ #define MDS_REQ_REC_OFF 0 #define MDS_REQ_INTENT_LOCKREQ_OFF 0 #define MDS_REQ_INTENT_IT_OFF 1 #define MDS_REQ_INTENT_REC_OFF 2 /* opcodes */ typedef enum { MDS_GETATTR = 33, MDS_GETATTR_NAME = 34, MDS_CLOSE = 35, MDS_REINT = 36, MDS_READPAGE = 37, MDS_CONNECT = 38, MDS_DISCONNECT = 39, MDS_GETSTATUS = 40, MDS_STATFS = 41, MDS_PIN = 42, MDS_UNPIN = 43, MDS_SYNC = 44, MDS_DONE_WRITING = 45, MDS_SET_INFO = 46, MDS_QUOTACHECK = 47, MDS_QUOTACTL = 48, MDS_GETXATTR = 49, MDS_SETXATTR = 50, MDS_LAST_OPC } mds_cmd_t; #define MDS_FIRST_OPC MDS_GETATTR /* * Do not exceed 63 */ typedef enum { REINT_SETATTR = 1, REINT_CREATE = 2, REINT_LINK = 3, REINT_UNLINK = 4, REINT_RENAME = 5, REINT_OPEN = 6, // REINT_CLOSE = 7, // REINT_WRITE = 8, REINT_MAX } mds_reint_t,mdt_reint_t; /* the disposition of the intent outlines what was executed */ #define DISP_IT_EXECD 0x01 #define DISP_LOOKUP_EXECD 0x02 #define DISP_LOOKUP_NEG 0x04 #define DISP_LOOKUP_POS 0x08 #define DISP_OPEN_CREATE 0x10 #define DISP_OPEN_OPEN 0x20 #define DISP_ENQ_COMPLETE 0x40 /* INODE LOCK PARTS */ #define MDS_INODELOCK_LOOKUP 0x000001 /* dentry, mode, owner, group */ #define MDS_INODELOCK_UPDATE 0x000002 /* size, links, timestamps */ #define MDS_INODELOCK_OPEN 0x000004 /* For opened files */ /* Do not forget to increase MDS_INODELOCK_MAXSHIFT when adding new bits */ #define MDS_INODELOCK_MAXSHIFT 2 /* This FULL lock is useful to take on unlink sort of operations */ #define MDS_INODELOCK_FULL ((1<<(MDS_INODELOCK_MAXSHIFT+1))-1) #define LUSTRE_CONFIG_SET 0 #define LUSTRE_CONFIG_GET 1 #define LUSTRE_CONFIG_METASEQ "metaseq" #define LUSTRE_CONFIG_TRANSNO "transno" /* temporary stuff for compatibility */ struct ll_fid { __u64 id; /* holds object id */ __u32 generation; /* holds object generation */ __u32 f_type; /* holds object type or stripe idx when passing it to * OST for saving into EA. */ }; extern void lustre_swab_ll_fid (struct ll_fid *fid); /* This structure is used for both request and reply. * * If we eventually have separate connect data for different types, which we * almost certainly will, then perhaps we stick a union in here. */ struct obd_connect_data { __u64 ocd_connect_flags; /* OBD_CONNECT_* per above */ __u32 ocd_version; /* lustre release version number */ __u32 ocd_grant; /* initial cache grant amount (bytes) */ __u32 ocd_index; /* LOV index to connect to */ __u32 ocd_unused; __u64 ocd_ibits_known; /* inode bits this client understands */ __u64 ocd_seq; /* sequence info for client */ __u64 padding2; /* also fix lustre_swab_connect */ __u64 padding3; /* also fix lustre_swab_connect */ __u64 padding4; /* also fix lustre_swab_connect */ __u64 padding5; /* also fix lustre_swab_connect */ }; extern void lustre_swab_connect(struct obd_connect_data *ocd); #define MDS_STATUS_CONN 1 #define MDS_STATUS_LOV 2 struct mds_status_req { __u32 flags; __u32 repbuf; }; extern void lustre_swab_mds_status_req (struct mds_status_req *r); #define MDS_BFLAG_UNCOMMITTED_WRITES 0x1 struct mdt_body { struct lu_fid fid1; struct lu_fid fid2; struct lustre_handle handle; __u64 valid; __u64 size; /* Offset, in the case of MDS_READPAGE */ __u64 mtime; __u64 atime; __u64 ctime; __u64 blocks; /* XID, in the case of MDS_READPAGE */ __u64 io_epoch; __u32 fsuid; __u32 fsgid; __u32 capability; __u32 mode; __u32 uid; __u32 gid; __u32 flags; /* from vfs for pin/unpin, MDS_BFLAG for close */ __u32 rdev; __u32 nlink; /* #bytes to read in the case of MDS_READPAGE */ __u32 suppgid; __u32 eadatasize; __u32 aclsize; __u32 max_mdsize; __u32 max_cookiesize; /* also fix lustre_swab_mdt_body */ }; struct mds_body { struct ll_fid fid1; struct ll_fid fid2; struct lustre_handle handle; __u64 valid; __u64 size; /* Offset, in the case of MDS_READPAGE */ __u64 mtime; __u64 atime; __u64 ctime; __u64 blocks; /* XID, in the case of MDS_READPAGE */ __u64 io_epoch; __u64 ino; __u32 fsuid; __u32 fsgid; __u32 capability; __u32 mode; __u32 uid; __u32 gid; __u32 flags; /* from vfs for pin/unpin, MDS_BFLAG for close */ __u32 rdev; __u32 nlink; /* #bytes to read in the case of MDS_READPAGE */ __u32 generation; __u32 suppgid; __u32 eadatasize; __u32 aclsize; __u32 max_mdsize; __u32 max_cookiesize; /* also fix lustre_swab_mds_body */ __u32 padding_4; /* also fix lustre_swab_mds_body */ }; extern void lustre_swab_mds_body (struct mds_body *b); extern void lustre_swab_mdt_body (struct mdt_body *b); struct lustre_md { struct mdt_body *body; struct lov_stripe_md *lsm; struct lmv_stripe_md *mea; #ifdef CONFIG_FS_POSIX_ACL struct posix_acl *posix_acl; #endif }; #define Q_QUOTACHECK 0x800100 #define Q_INITQUOTA 0x800101 /* init slave limits */ #define Q_GETOINFO 0x800102 /* get obd quota info */ #define Q_GETOQUOTA 0x800103 /* get obd quotas */ #define Q_TYPESET(oqc, type) \ ((oqc)->qc_type == type || (oqc)->qc_type == UGQUOTA) #define Q_GETOCMD(oqc) \ ((oqc)->qc_cmd == Q_GETOINFO || (oqc)->qc_cmd == Q_GETOQUOTA) struct obd_quotactl { __u32 qc_cmd; __u32 qc_type; __u32 qc_id; __u32 qc_stat; struct obd_dqinfo qc_dqinfo; struct obd_dqblk qc_dqblk; }; extern void lustre_swab_obd_quotactl(struct obd_quotactl *q); struct mds_rec_setattr { __u32 sa_opcode; __u32 sa_fsuid; __u32 sa_fsgid; __u32 sa_cap; __u32 sa_suppgid; __u32 sa_mode; struct ll_fid sa_fid; __u64 sa_valid; __u64 sa_size; __u64 sa_mtime; __u64 sa_atime; __u64 sa_ctime; __u32 sa_uid; __u32 sa_gid; __u32 sa_attr_flags; __u32 sa_padding; /* also fix lustre_swab_mds_rec_setattr */ }; extern void lustre_swab_mds_rec_setattr (struct mds_rec_setattr *sa); struct mdt_rec_setattr { __u32 sa_opcode; __u32 sa_fsuid; __u32 sa_fsgid; __u32 sa_cap; __u32 sa_suppgid; __u32 sa_mode; struct lu_fid sa_fid; __u64 sa_valid; __u64 sa_size; __u64 sa_mtime; __u64 sa_atime; __u64 sa_ctime; __u32 sa_uid; __u32 sa_gid; __u32 sa_attr_flags; __u32 sa_padding; /* also fix lustre_swab_mds_rec_setattr */ }; extern void lustre_swab_mdt_rec_setattr (struct mdt_rec_setattr *sa); /* Remove this once we declare it in include/linux/fs.h (v21 kernel patch?) */ #ifndef ATTR_CTIME_SET #define ATTR_CTIME_SET 0x2000 #endif #ifndef FMODE_READ #define FMODE_READ 00000001 #define FMODE_WRITE 00000002 #endif #define MDS_FMODE_EXEC 00000004 #define MDS_OPEN_CREAT 00000100 #define MDS_OPEN_EXCL 00000200 #define MDS_OPEN_TRUNC 00001000 #define MDS_OPEN_APPEND 00002000 #define MDS_OPEN_SYNC 00010000 #define MDS_OPEN_DIRECTORY 00200000 #define MDS_OPEN_DELAY_CREATE 0100000000 /* delay initial object create */ #define MDS_OPEN_OWNEROVERRIDE 0200000000 /* NFSD rw-reopen ro file for owner */ #define MDS_OPEN_JOIN_FILE 0400000000 /* open for join file*/ #define MDS_OPEN_HAS_EA 010000000000 /* specify object create pattern */ #define MDS_OPEN_HAS_OBJS 020000000000 /* Just set the EA the obj exist */ struct mds_rec_join { struct ll_fid jr_fid; __u64 jr_headsize; }; extern void lustre_swab_mds_rec_join (struct mds_rec_join *jr); struct mdt_rec_join { struct lu_fid jr_fid; __u64 jr_headsize; }; extern void lustre_swab_mdt_rec_join (struct mdt_rec_join *jr); struct mds_rec_create { __u32 cr_opcode; __u32 cr_fsuid; __u32 cr_fsgid; __u32 cr_cap; __u32 cr_flags; /* for use with open */ __u32 cr_mode; struct ll_fid cr_fid; struct ll_fid cr_replayfid; __u64 cr_time; __u64 cr_rdev; __u32 cr_suppgid; __u32 cr_padding_1; /* also fix lustre_swab_mds_rec_create */ __u32 cr_padding_2; /* also fix lustre_swab_mds_rec_create */ __u32 cr_padding_3; /* also fix lustre_swab_mds_rec_create */ __u32 cr_padding_4; /* also fix lustre_swab_mds_rec_create */ __u32 cr_padding_5; /* also fix lustre_swab_mds_rec_create */ }; extern void lustre_swab_mds_rec_create (struct mds_rec_create *cr); struct mdt_rec_create { __u32 cr_opcode; __u32 cr_fsuid; __u32 cr_fsgid; __u32 cr_cap; __u32 cr_flags; /* for use with open */ __u32 cr_mode; struct lu_fid cr_fid; struct lu_fid cr_replayfid; __u64 cr_time; __u64 cr_rdev; __u32 cr_suppgid; __u32 cr_padding_1; /* also fix lustre_swab_mds_rec_create */ __u32 cr_padding_2; /* also fix lustre_swab_mds_rec_create */ __u32 cr_padding_3; /* also fix lustre_swab_mds_rec_create */ __u32 cr_padding_4; /* also fix lustre_swab_mds_rec_create */ __u32 cr_padding_5; /* also fix lustre_swab_mds_rec_create */ }; extern void lustre_swab_mdt_rec_create (struct mdt_rec_create *cr); struct mds_rec_link { __u32 lk_opcode; __u32 lk_fsuid; __u32 lk_fsgid; __u32 lk_cap; __u32 lk_suppgid1; __u32 lk_suppgid2; struct ll_fid lk_fid1; struct ll_fid lk_fid2; __u64 lk_time; __u32 lk_padding_1; /* also fix lustre_swab_mds_rec_link */ __u32 lk_padding_2; /* also fix lustre_swab_mds_rec_link */ __u32 lk_padding_3; /* also fix lustre_swab_mds_rec_link */ __u32 lk_padding_4; /* also fix lustre_swab_mds_rec_link */ }; extern void lustre_swab_mds_rec_link (struct mds_rec_link *lk); struct mdt_rec_link { __u32 lk_opcode; __u32 lk_fsuid; __u32 lk_fsgid; __u32 lk_cap; __u32 lk_suppgid1; __u32 lk_suppgid2; struct lu_fid lk_fid1; struct lu_fid lk_fid2; __u64 lk_time; __u32 lk_padding_1; /* also fix lustre_swab_mds_rec_link */ __u32 lk_padding_2; /* also fix lustre_swab_mds_rec_link */ __u32 lk_padding_3; /* also fix lustre_swab_mds_rec_link */ __u32 lk_padding_4; /* also fix lustre_swab_mds_rec_link */ }; extern void lustre_swab_mdt_rec_link (struct mdt_rec_link *lk); struct mds_rec_unlink { __u32 ul_opcode; __u32 ul_fsuid; __u32 ul_fsgid; __u32 ul_cap; __u32 ul_suppgid; __u32 ul_mode; struct ll_fid ul_fid1; struct ll_fid ul_fid2; __u64 ul_time; __u32 ul_padding_1; /* also fix lustre_swab_mds_rec_unlink */ __u32 ul_padding_2; /* also fix lustre_swab_mds_rec_unlink */ __u32 ul_padding_3; /* also fix lustre_swab_mds_rec_unlink */ __u32 ul_padding_4; /* also fix lustre_swab_mds_rec_unlink */ }; extern void lustre_swab_mds_rec_unlink (struct mds_rec_unlink *ul); struct mdt_rec_unlink { __u32 ul_opcode; __u32 ul_fsuid; __u32 ul_fsgid; __u32 ul_cap; __u32 ul_suppgid; __u32 ul_mode; struct lu_fid ul_fid1; struct lu_fid ul_fid2; __u64 ul_time; __u32 ul_padding_1; /* also fix lustre_swab_mds_rec_unlink */ __u32 ul_padding_2; /* also fix lustre_swab_mds_rec_unlink */ __u32 ul_padding_3; /* also fix lustre_swab_mds_rec_unlink */ __u32 ul_padding_4; /* also fix lustre_swab_mds_rec_unlink */ }; extern void lustre_swab_mdt_rec_unlink (struct mdt_rec_unlink *ul); struct mds_rec_rename { __u32 rn_opcode; __u32 rn_fsuid; __u32 rn_fsgid; __u32 rn_cap; __u32 rn_suppgid1; __u32 rn_suppgid2; struct ll_fid rn_fid1; struct ll_fid rn_fid2; __u64 rn_time; __u32 rn_padding_1; /* also fix lustre_swab_mds_rec_rename */ __u32 rn_padding_2; /* also fix lustre_swab_mds_rec_rename */ __u32 rn_padding_3; /* also fix lustre_swab_mds_rec_rename */ __u32 rn_padding_4; /* also fix lustre_swab_mds_rec_rename */ }; extern void lustre_swab_mds_rec_rename (struct mds_rec_rename *rn); struct mdt_rec_rename { __u32 rn_opcode; __u32 rn_fsuid; __u32 rn_fsgid; __u32 rn_cap; __u32 rn_suppgid1; __u32 rn_suppgid2; struct lu_fid rn_fid1; struct lu_fid rn_fid2; __u64 rn_time; __u32 rn_padding_1; /* also fix lustre_swab_mds_rec_rename */ __u32 rn_padding_2; /* also fix lustre_swab_mds_rec_rename */ __u32 rn_padding_3; /* also fix lustre_swab_mds_rec_rename */ __u32 rn_padding_4; /* also fix lustre_swab_mds_rec_rename */ }; extern void lustre_swab_mdt_rec_rename (struct mdt_rec_rename *rn); /* * LOV data structures */ #define LOV_MIN_STRIPE_SIZE 65536 /* maximum PAGE_SIZE (ia64), power of 2 */ #define LOV_MAX_STRIPE_COUNT 160 /* until bug 4424 is fixed */ #define LOV_MAX_UUID_BUFFER_SIZE 8192 /* The size of the buffer the lov/mdc reserves for the * array of UUIDs returned by the MDS. With the current * protocol, this will limit the max number of OSTs per LOV */ #define LOV_DESC_MAGIC 0xB0CCDE5C struct lov_desc { __u32 ld_tgt_count; /* how many OBD's */ __u32 ld_active_tgt_count; /* how many active */ __u32 ld_default_stripe_count; /* how many objects are used */ __u32 ld_pattern; /* PATTERN_RAID0, PATTERN_RAID1 */ __u64 ld_default_stripe_size; /* in bytes */ __u64 ld_default_stripe_offset; /* in bytes */ __u32 ld_padding_1; /* also fix lustre_swab_lov_desc */ __u32 ld_padding_2; /* also fix lustre_swab_lov_desc */ __u32 ld_padding_3; /* also fix lustre_swab_lov_desc */ __u32 ld_padding_4; /* also fix lustre_swab_lov_desc */ struct obd_uuid ld_uuid; }; #define ld_magic ld_active_tgt_count /* for swabbing from llogs */ /*begin adding MDT by huanghua@clusterfs.com*/ struct lmv_desc { __u32 ld_tgt_count; /* how many MDS's */ __u32 ld_active_tgt_count; /* how many active */ struct obd_uuid ld_uuid; }; extern void lustre_swab_lmv_desc (struct lmv_desc *ld); /*end adding MDT by huanghua@clusterfs.com*/ struct md_fld { __u64 mf_seq; __u64 mf_mds; }; extern void lustre_swab_md_fld (struct md_fld *mf); extern void lustre_swab_lov_desc (struct lov_desc *ld); /* * LDLM requests: */ /* opcodes -- MUST be distinct from OST/MDS opcodes */ typedef enum { LDLM_ENQUEUE = 101, LDLM_CONVERT = 102, LDLM_CANCEL = 103, LDLM_BL_CALLBACK = 104, LDLM_CP_CALLBACK = 105, LDLM_GL_CALLBACK = 106, LDLM_LAST_OPC } ldlm_cmd_t; #define LDLM_FIRST_OPC LDLM_ENQUEUE #define RES_NAME_SIZE 4 struct ldlm_res_id { __u64 name[RES_NAME_SIZE]; }; extern void lustre_swab_ldlm_res_id (struct ldlm_res_id *id); /* lock types */ typedef enum { LCK_MINMODE = 0, LCK_EX = 1, LCK_PW = 2, LCK_PR = 4, LCK_CW = 8, LCK_CR = 16, LCK_NL = 32, LCK_GROUP = 64, LCK_MAXMODE } ldlm_mode_t; typedef enum { LDLM_PLAIN = 10, LDLM_EXTENT = 11, LDLM_FLOCK = 12, LDLM_IBITS = 13, LDLM_MAX_TYPE } ldlm_type_t; #define LDLM_MIN_TYPE LDLM_PLAIN struct ldlm_extent { __u64 start; __u64 end; __u64 gid; }; struct ldlm_inodebits { __u64 bits; }; struct ldlm_flock { __u64 start; __u64 end; __u64 blocking_export; /* not actually used over the wire */ __u32 blocking_pid; /* not actually used over the wire */ __u32 pid; }; /* it's important that the fields of the ldlm_extent structure match * the first fields of the ldlm_flock structure because there is only * one ldlm_swab routine to process the ldlm_policy_data_t union. if * this ever changes we will need to swab the union differently based * on the resource type. */ typedef union { struct ldlm_extent l_extent; struct ldlm_flock l_flock; struct ldlm_inodebits l_inodebits; } ldlm_policy_data_t; extern void lustre_swab_ldlm_policy_data (ldlm_policy_data_t *d); struct ldlm_intent { __u64 opc; }; extern void lustre_swab_ldlm_intent (struct ldlm_intent *i); struct ldlm_resource_desc { ldlm_type_t lr_type; __u32 lr_padding; /* also fix lustre_swab_ldlm_resource_desc */ struct ldlm_res_id lr_name; }; extern void lustre_swab_ldlm_resource_desc (struct ldlm_resource_desc *r); struct ldlm_lock_desc { struct ldlm_resource_desc l_resource; ldlm_mode_t l_req_mode; ldlm_mode_t l_granted_mode; ldlm_policy_data_t l_policy_data; }; extern void lustre_swab_ldlm_lock_desc (struct ldlm_lock_desc *l); struct ldlm_request { __u32 lock_flags; __u32 lock_padding; /* also fix lustre_swab_ldlm_request */ struct ldlm_lock_desc lock_desc; struct lustre_handle lock_handle1; struct lustre_handle lock_handle2; }; extern void lustre_swab_ldlm_request (struct ldlm_request *rq); struct ldlm_reply { __u32 lock_flags; __u32 lock_padding; /* also fix lustre_swab_ldlm_reply */ struct ldlm_lock_desc lock_desc; struct lustre_handle lock_handle; __u64 lock_policy_res1; __u64 lock_policy_res2; }; extern void lustre_swab_ldlm_reply (struct ldlm_reply *r); /* * Opcodes for mountconf (mgs and mgc) */ typedef enum { MGS_CONNECT = 250, MGS_DISCONNECT, MGS_EXCEPTION, /* node died, etc. */ MGS_TARGET_REG, /* whenever target starts up */ MGS_TARGET_DEL, MGS_LAST_OPC } mgs_cmd_t; #define MTI_NAME_MAXLEN 64 #define MTI_UUID_MAXLEN MTI_NAME_MAXLEN + 5 /* each host can have multiple nids, and multiple failover hosts, and I don't want to run out of room... */ #define MTI_NIDS_MAX 64 /* match lustre_disk.h */ struct mgs_target_info { char mti_fsname[MTI_NAME_MAXLEN]; char mti_svname[MTI_NAME_MAXLEN]; char mti_uuid[sizeof(struct obd_uuid)]; lnet_nid_t mti_nids[MTI_NIDS_MAX]; /* host nids */ lnet_nid_t mti_failnids[MTI_NIDS_MAX]; /* partner nids */ __u16 mti_failnodes[8]; /* last nid index of each partner */ __u32 mti_stripe_index; __u32 mti_nid_count; __u32 mti_failnid_count; __u32 mti_config_ver; __u32 mti_flags; char mti_params[2048]; }; extern void lustre_swab_mgs_target_info(struct mgs_target_info *oinfo); #define CM_START 0x01 #define CM_END 0x02 #define CM_SKIP 0x04 #define CM_UPGRADE146 0x08 #define CM_START_SKIP (CM_START | CM_SKIP) struct cfg_marker { __u32 cm_step; /* aka config version */ __u32 cm_flags; time_t cm_createtime; /*when this record was first created */ time_t cm_canceltime; /*when this record is no longer valid*/ char cm_svname[16]; char cm_comment[40]; }; /* * Opcodes for multiple servers. */ typedef enum { OBD_PING = 400, OBD_LOG_CANCEL, OBD_QC_CALLBACK, OBD_LAST_OPC } obd_cmd_t; #define OBD_FIRST_OPC OBD_PING /* catalog of log objects */ /* Records written to the CATALOGS list */ #define CATLIST "CATALOGS" struct llog_catid { struct llog_logid lci_logid; __u32 lci_padding1; __u32 lci_padding2; __u32 lci_padding3; } __attribute__((packed)); /*join file lov mds md*/ struct lov_mds_md_join { struct lov_mds_md lmmj_md; /*join private info*/ struct llog_logid lmmj_array_id; /*array object id*/ __u32 lmmj_extent_count; /*array extent count*/ }; /* Log data record types - there is no specific reason that these need to * be related to the RPC opcodes, but no reason not to (may be handy later?) */ #define LLOG_OP_MAGIC 0x10600000 #define LLOG_OP_MASK 0xfff00000 typedef enum { LLOG_PAD_MAGIC = LLOG_OP_MAGIC | 0, OST_SZ_REC = LLOG_OP_MAGIC | (OST_SAN_WRITE << 8), OST_RAID1_REC = LLOG_OP_MAGIC | ((OST_SAN_WRITE + 1) << 8), MDS_UNLINK_REC = LLOG_OP_MAGIC | 0x10000 | (MDS_REINT << 8) | REINT_UNLINK, MDS_SETATTR_REC = LLOG_OP_MAGIC | 0x10000 | (MDS_REINT << 8) | REINT_SETATTR, OBD_CFG_REC = LLOG_OP_MAGIC | 0x20000, PTL_CFG_REC = LLOG_OP_MAGIC | 0x30000, /* obsolete */ LLOG_GEN_REC = LLOG_OP_MAGIC | 0x40000, LLOG_JOIN_REC = LLOG_OP_MAGIC | 0x50000, LLOG_HDR_MAGIC = LLOG_OP_MAGIC | 0x45539, LLOG_LOGID_MAGIC = LLOG_OP_MAGIC | 0x4553b, } llog_op_type; /* * for now, continue to support old pad records which have 0 for their * type but still need to be swabbed for their length */ #define LLOG_REC_HDR_NEEDS_SWABBING(r) \ (((r)->lrh_type & __swab32(LLOG_OP_MASK)) == \ __swab32(LLOG_OP_MAGIC) || \ (((r)->lrh_type == 0) && ((r)->lrh_len > LLOG_CHUNK_SIZE))) /* Log record header - stored in little endian order. * Each record must start with this struct, end with a llog_rec_tail, * and be a multiple of 256 bits in size. */ struct llog_rec_hdr { __u32 lrh_len; __u32 lrh_index; __u32 lrh_type; __u32 padding; }; struct llog_rec_tail { __u32 lrt_len; __u32 lrt_index; }; struct llog_logid_rec { struct llog_rec_hdr lid_hdr; struct llog_logid lid_id; __u32 padding1; __u32 padding2; __u32 padding3; __u32 padding4; __u32 padding5; struct llog_rec_tail lid_tail; } __attribute__((packed)); /* MDS extent description * It is for joined file extent info, each extent info for joined file * just like (start, end, lmm). */ struct mds_extent_desc { __u64 med_start; /* extent start */ __u64 med_len; /* extent length */ struct lov_mds_md med_lmm; /* extent's lmm */ }; /*Joined file array extent log record*/ struct llog_array_rec { struct llog_rec_hdr lmr_hdr; struct mds_extent_desc lmr_med; struct llog_rec_tail lmr_tail; }; struct llog_create_rec { struct llog_rec_hdr lcr_hdr; struct ll_fid lcr_fid; obd_id lcr_oid; obd_count lcr_ogen; __u32 padding; struct llog_rec_tail lcr_tail; } __attribute__((packed)); struct llog_orphan_rec { struct llog_rec_hdr lor_hdr; obd_id lor_oid; obd_count lor_ogen; __u32 padding; struct llog_rec_tail lor_tail; } __attribute__((packed)); struct llog_unlink_rec { struct llog_rec_hdr lur_hdr; obd_id lur_oid; obd_count lur_ogen; __u32 padding; struct llog_rec_tail lur_tail; } __attribute__((packed)); struct llog_setattr_rec { struct llog_rec_hdr lsr_hdr; obd_id lsr_oid; obd_count lsr_ogen; __u32 lsr_uid; __u32 lsr_gid; __u32 padding; struct llog_rec_tail lsr_tail; } __attribute__((packed)); struct llog_size_change_rec { struct llog_rec_hdr lsc_hdr; struct ll_fid lsc_fid; __u32 lsc_io_epoch; __u32 padding; struct llog_rec_tail lsc_tail; } __attribute__((packed)); struct llog_gen { __u64 mnt_cnt; __u64 conn_cnt; } __attribute__((packed)); struct llog_gen_rec { struct llog_rec_hdr lgr_hdr; struct llog_gen lgr_gen; struct llog_rec_tail lgr_tail; }; /* On-disk header structure of each log object, stored in little endian order */ #define LLOG_CHUNK_SIZE 8192 #define LLOG_HEADER_SIZE (96) #define LLOG_BITMAP_BYTES (LLOG_CHUNK_SIZE - LLOG_HEADER_SIZE) #define LLOG_MIN_REC_SIZE (24) /* round(llog_rec_hdr + llog_rec_tail) */ /* flags for the logs */ #define LLOG_F_ZAP_WHEN_EMPTY 0x1 #define LLOG_F_IS_CAT 0x2 #define LLOG_F_IS_PLAIN 0x4 struct llog_log_hdr { struct llog_rec_hdr llh_hdr; __u64 llh_timestamp; __u32 llh_count; __u32 llh_bitmap_offset; __u32 llh_size; __u32 llh_flags; __u32 llh_cat_idx; /* for a catalog the first plain slot is next to it */ struct obd_uuid llh_tgtuuid; __u32 llh_reserved[LLOG_HEADER_SIZE/sizeof(__u32) - 23]; __u32 llh_bitmap[LLOG_BITMAP_BYTES/sizeof(__u32)]; struct llog_rec_tail llh_tail; } __attribute__((packed)); #define LLOG_BITMAP_SIZE(llh) ((llh->llh_hdr.lrh_len - \ llh->llh_bitmap_offset - \ sizeof(llh->llh_tail)) * 8) /* log cookies are used to reference a specific log file and a record therein */ struct llog_cookie { struct llog_logid lgc_lgl; __u32 lgc_subsys; __u32 lgc_index; __u32 lgc_padding; } __attribute__((packed)); /* llog protocol */ enum llogd_rpc_ops { LLOG_ORIGIN_HANDLE_CREATE = 501, LLOG_ORIGIN_HANDLE_NEXT_BLOCK = 502, LLOG_ORIGIN_HANDLE_READ_HEADER = 503, LLOG_ORIGIN_HANDLE_WRITE_REC = 504, LLOG_ORIGIN_HANDLE_CLOSE = 505, LLOG_ORIGIN_CONNECT = 506, LLOG_CATINFO = 507, /* for lfs catinfo */ LLOG_ORIGIN_HANDLE_PREV_BLOCK = 508, LLOG_ORIGIN_HANDLE_DESTROY = 509, /* for destroy llog object*/ LLOG_LAST_OPC }; enum fld_rpc_opc { FLD_QUERY = 600, FLD_LAST_OPC, FLD_FIRST_OPC = FLD_QUERY }; struct llogd_body { struct llog_logid lgd_logid; __u32 lgd_ctxt_idx; __u32 lgd_llh_flags; __u32 lgd_index; __u32 lgd_saved_index; __u32 lgd_len; __u64 lgd_cur_offset; } __attribute__((packed)); struct llogd_conn_body { struct llog_gen lgdc_gen; struct llog_logid lgdc_logid; __u32 lgdc_ctxt_idx; } __attribute__((packed)); extern void lustre_swab_lov_user_md(struct lov_user_md *lum); extern void lustre_swab_lov_user_md_objects(struct lov_user_md *lum); extern void lustre_swab_lov_user_md_join(struct lov_user_md_join *lumj); /* llog_swab.c */ extern void lustre_swab_llogd_body (struct llogd_body *d); extern void lustre_swab_llog_hdr (struct llog_log_hdr *h); extern void lustre_swab_llogd_conn_body (struct llogd_conn_body *d); extern void lustre_swab_llog_rec(struct llog_rec_hdr *rec, struct llog_rec_tail *tail); struct lustre_cfg; extern void lustre_swab_lustre_cfg(struct lustre_cfg *lcfg); /* qutoa */ struct qunit_data { __u32 qd_id; /* ID appiles to (uid, gid) */ __u32 qd_type; /* Quota type (USRQUOTA, GRPQUOTA) */ __u32 qd_count; /* acquire/release count (bytes for block quota) */ __u32 qd_isblk; /* Block quota or file quota */ }; extern void lustre_swab_qdata(struct qunit_data *d); typedef enum { QUOTA_DQACQ = 601, QUOTA_DQREL = 602, } quota_cmd_t; #define JOIN_FILE_ALIGN 4096 #endif