📄 lustre_idl.h
字号:
typedef __u64 obd_id;typedef __u64 obd_gr;typedef __u64 obd_time;typedef __u64 obd_size;typedef __u64 obd_off;typedef __u64 obd_blocks;typedef __u64 obd_valid;typedef __u32 obd_blksize;typedef __u32 obd_mode;typedef __u32 obd_uid;typedef __u32 obd_gid;typedef __u32 obd_flag;typedef __u32 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(ll_fid). Nevertheless struct ll_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]; /* lustre_handle + llog_cookie */};#define o_dirty o_blocks#define o_undirty o_mode#define o_dropped o_misc#define o_cksum o_nlinkextern void lustre_swab_obdo (struct obdo *o);#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_v1struct 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_v1struct 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 (0x00000001ULL) /* object ID */#define OBD_MD_FLATIME (0x00000002ULL) /* access time */#define OBD_MD_FLMTIME (0x00000004ULL) /* data modification time */#define OBD_MD_FLCTIME (0x00000008ULL) /* change time */#define OBD_MD_FLSIZE (0x00000010ULL) /* size */#define OBD_MD_FLBLOCKS (0x00000020ULL) /* allocated blocks count */#define OBD_MD_FLBLKSZ (0x00000040ULL) /* block size */#define OBD_MD_FLMODE (0x00000080ULL) /* access bits (mode & ~S_IFMT) */#define OBD_MD_FLTYPE (0x00000100ULL) /* object type (mode & S_IFMT) */#define OBD_MD_FLUID (0x00000200ULL) /* user ID */#define OBD_MD_FLGID (0x00000400ULL) /* group ID */#define OBD_MD_FLFLAGS (0x00000800ULL) /* flags word */#define OBD_MD_FLNLINK (0x00002000ULL) /* link count */#define OBD_MD_FLGENER (0x00004000ULL) /* generation number */#define OBD_MD_FLINLINE (0x00008000ULL) /* inline data */#define OBD_MD_FLRDEV (0x00010000ULL) /* device number */#define OBD_MD_FLEASIZE (0x00020000ULL) /* extended attribute data */#define OBD_MD_LINKNAME (0x00040000ULL) /* symbolic link target */#define OBD_MD_FLHANDLE (0x00080000ULL) /* file handle */#define OBD_MD_FLCKSUM (0x00100000ULL) /* bulk data checksum */#define OBD_MD_FLQOS (0x00200000ULL) /* quality of service stats */#define OBD_MD_FLOSCOPQ (0x00400000ULL) /* osc opaque data */#define OBD_MD_FLCOOKIE (0x00800000ULL) /* log cancellation cookie */#define OBD_MD_FLGROUP (0x01000000ULL) /* group */#define OBD_MD_FLFID (0x02000000ULL) /* ->ost write inline fid */#define OBD_MD_FLEPOCH (0x04000000ULL) /* ->ost write easize is epoch */#define OBD_MD_FLGRANT (0x08000000ULL) /* ost preallocation space grant */#define OBD_MD_FLDIREA (0x10000000ULL) /* dir's extended attribute data */#define OBD_MD_FLUSRQUOTA (0x20000000ULL) /* over quota flags sent from ost */#define OBD_MD_FLGRPQUOTA (0x40000000ULL) /* over quota flags sent from ost */#define OBD_MD_FLMODEASIZE (0x80000000ULL) /* 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_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 20000struct 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);/* lock value block communicated between the filter and llite *//* OST_LVB_ERR_INIT is needed because the return code in rc is * negative, i.e. because ((MASK + rc) & MASK) != MASK. */#define OST_LVB_ERR_INIT 0xffbadbad80000000ULL#define OST_LVB_ERR_MASK 0xffbadbad00000000ULL#define OST_LVB_IS_ERR(blocks) \ ((blocks & OST_LVB_ERR_MASK) == OST_LVB_ERR_MASK)#define OST_LVB_SET_ERR(blocks, rc) \ do { blocks = OST_LVB_ERR_INIT + rc; } while (0)#define OST_LVB_GET_ERR(blocks) (int)(blocks - OST_LVB_ERR_INIT)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 *//* 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;/* the disposition of the intent outlines what was executed */#define DISP_IT_EXECD 0x00000001#define DISP_LOOKUP_EXECD 0x00000002#define DISP_LOOKUP_NEG 0x00000004#define DISP_LOOKUP_POS 0x00000008#define DISP_OPEN_CREATE 0x00000010#define DISP_OPEN_OPEN 0x00000020#define DISP_ENQ_COMPLETE 0x00400000#define DISP_ENQ_OPEN_REF 0x00800000#define DISP_ENQ_CREATE_REF 0x01000000#define DISP_OPEN_LOCK 0x02000000/* 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)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);#define MDS_STATUS_CONN 1#define MDS_STATUS_LOV 2struct 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#define MDS_BFLAG_EXT_FLAGS 0x80000000 /* == EXT3_RESERVED_FL *//* these should be identical to their EXT3_*_FL counterparts, and are * redefined here only to avoid dragging in ext3_fs.h */#define MDS_SYNC_FL 0x00000008 /* Synchronous updates */#define MDS_IMMUTABLE_FL 0x00000010 /* Immutable file */#define MDS_APPEND_FL 0x00000020 /* writes to file may only append */#define MDS_NOATIME_FL 0x00000080 /* do not update atime */#define MDS_DIRSYNC_FL 0x00010000 /* dirsync behaviour (dir only) */#ifdef __KERNEL__/* If MDS_BFLAG_IOC_FLAGS is set it means we requested EXT3_*_FL inode flags * and we need to decode these into local S_* flags in the inode. Otherwise * we pass flags straight through (see bug 9486). */static inline int ll_ext_to_inode_flags(int flags){ return (flags & MDS_BFLAG_EXT_FLAGS) ? (((flags & MDS_SYNC_FL) ? S_SYNC : 0) | ((flags & MDS_NOATIME_FL) ? S_NOATIME : 0) | ((flags & MDS_APPEND_FL) ? S_APPEND : 0) |#if defined(S_DIRSYNC) ((flags & MDS_DIRSYNC_FL) ? S_DIRSYNC : 0) |#endif ((flags & MDS_IMMUTABLE_FL) ? S_IMMUTABLE : 0)) : (flags & ~MDS_BFLAG_EXT_FLAGS);}/* If keep is set, we do not do anything with iflags, if it is not set, we * assume that iflags are inode flags and we need to conver those to * EXT3_*_FL flags (see bug 9486 and 12848) */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -