X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Fuapi%2Flinux%2Flustre%2Flustre_user.h;h=5bd1693dec1891365e876a3a40091bfb6818e848;hb=bb60caa1c6e7c14c201916dc0423442d10c86a27;hp=0875e8d81d3e677835fc80595953a1d5adcd75d6;hpb=703afd15fc939ad4f425364ddc033080630c0127;p=fs%2Flustre-release.git diff --git a/lustre/include/uapi/linux/lustre/lustre_user.h b/lustre/include/uapi/linux/lustre/lustre_user.h index 0875e8d..5bd1693 100644 --- a/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/lustre/include/uapi/linux/lustre/lustre_user.h @@ -27,7 +27,6 @@ */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. * * lustre/include/lustre/lustre_user.h * @@ -50,8 +49,10 @@ #include #include #include +#include #ifndef __KERNEL__ +# define __USE_ISOC99 1 # include # include /* snprintf() */ # include @@ -234,11 +235,14 @@ struct statx { #define STATX_ATTR_AUTOMOUNT 0x00001000 /* Dir: Automount trigger */ -#endif +#define AT_STATX_SYNC_TYPE 0x6000 /* Type of synchronisation required from statx() */ +#define AT_STATX_SYNC_AS_STAT 0x0000 /* - Do whatever stat() does */ +#define AT_STATX_FORCE_SYNC 0x2000 /* - Force the attributes to be sync'd with the server */ +#define AT_STATX_DONT_SYNC 0x4000 /* - Don't sync attributes with the server */ -typedef struct statx lstatx_t; +#endif /* STATX_BASIC_STATS */ -#define HAVE_LOV_USER_MDS_DATA +typedef struct statx lstatx_t; #define LUSTRE_EOF 0xffffffffffffffffULL @@ -251,15 +255,15 @@ typedef struct statx lstatx_t; #define LUSTRE_FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_DEVICE_ORDER) enum obd_statfs_state { - OS_STATE_DEGRADED = 0x00000001, /**< RAID degraded/rebuilding */ - OS_STATE_READONLY = 0x00000002, /**< filesystem is read-only */ - OS_STATE_NOPRECREATE = 0x00000004, /**< no object precreation */ - OS_STATE_UNUSED1 = 0x00000008, /**< obsolete 1.6, was EROFS=30 */ - OS_STATE_UNUSED2 = 0x00000010, /**< obsolete 1.6, was EROFS=30 */ - OS_STATE_ENOSPC = 0x00000020, /**< not enough free space */ - OS_STATE_ENOINO = 0x00000040, /**< not enough inodes */ - OS_STATE_SUM = 0x00000100, /**< aggregated for all tagrets */ - OS_STATE_NONROT = 0x00000200, /**< non-rotational device */ + OS_STATFS_DEGRADED = 0x00000001, /**< RAID degraded/rebuilding */ + OS_STATFS_READONLY = 0x00000002, /**< filesystem is read-only */ + OS_STATFS_NOPRECREATE = 0x00000004, /**< no object precreation */ + OS_STATFS_UNUSED1 = 0x00000008, /**< obsolete 1.6, was EROFS=30 */ + OS_STATFS_UNUSED2 = 0x00000010, /**< obsolete 1.6, was EROFS=30 */ + OS_STATFS_ENOSPC = 0x00000020, /**< not enough free space */ + OS_STATFS_ENOINO = 0x00000040, /**< not enough inodes */ + OS_STATFS_SUM = 0x00000100, /**< aggregated for all tagrets */ + OS_STATFS_NONROT = 0x00000200, /**< non-rotational device */ }; /** filesystem statistics/attributes for target device */ @@ -274,7 +278,7 @@ struct obd_statfs { __u32 os_bsize; /* block size in bytes for os_blocks */ __u32 os_namelen; /* maximum length of filename in bytes*/ __u64 os_maxbytes; /* maximum object size in bytes */ - __u32 os_state; /**< obd_statfs_state OS_STATE_* flag */ + __u32 os_state; /**< obd_statfs_state OS_STATFS_* */ __u32 os_fprecreated; /* objs available now to the caller */ /* used in QoS code to find preferred * OSTs */ @@ -418,8 +422,9 @@ enum lma_incompat { is on the remote MDT */ LMAI_STRIPED = 0x00000008, /* striped directory inode */ LMAI_ORPHAN = 0x00000010, /* inode is orphan */ + LMAI_ENCRYPT = 0x00000020, /* inode is encrypted */ LMA_INCOMPAT_SUPP = (LMAI_AGENT | LMAI_REMOTE_PARENT | \ - LMAI_STRIPED | LMAI_ORPHAN) + LMAI_STRIPED | LMAI_ORPHAN | LMAI_ENCRYPT) }; @@ -565,6 +570,7 @@ struct ll_ioc_lease_id { * *INFO - set/get lov_user_mds_data */ /* lustre_ioctl.h 101-150 */ +/* ioctl codes 128-143 are reserved for fsverity */ #define LL_IOC_GETFLAGS _IOR ('f', 151, long) #define LL_IOC_SETFLAGS _IOW ('f', 152, long) #define LL_IOC_CLRFLAGS _IOW ('f', 153, long) @@ -612,6 +618,7 @@ struct ll_ioc_lease_id { #define LL_IOC_LMV_GETSTRIPE _IOWR('f', 241, struct lmv_user_md) #define LL_IOC_REMOVE_ENTRY _IOWR('f', 242, __u64) #define LL_IOC_RMFID _IOR('f', 242, struct fid_array) +#define LL_IOC_UNLOCK_FOREIGN _IO('f', 242) #define LL_IOC_SET_LEASE _IOWR('f', 243, struct ll_ioc_lease) #define LL_IOC_SET_LEASE_OLD _IOWR('f', 243, long) #define LL_IOC_GET_LEASE _IO('f', 244) @@ -641,8 +648,6 @@ struct fsxattr { #define FS_IOC_FSGETXATTR _IOR('X', 31, struct fsxattr) #define FS_IOC_FSSETXATTR _IOW('X', 32, struct fsxattr) #endif -#define LL_IOC_FSGETXATTR FS_IOC_FSGETXATTR -#define LL_IOC_FSSETXATTR FS_IOC_FSSETXATTR #ifndef FS_XFLAG_PROJINHERIT #define FS_XFLAG_PROJINHERIT 0x00000200 #endif @@ -655,12 +660,12 @@ struct fsxattr { #define IOC_MDC_TYPE 'i' #define IOC_MDC_LOOKUP _IOWR(IOC_MDC_TYPE, 20, struct obd_device *) #define IOC_MDC_GETFILESTRIPE _IOWR(IOC_MDC_TYPE, 21, struct lov_user_md *) -#ifdef HAVE_LOV_USER_MDS_DATA -#define IOC_MDC_GETFILEINFO_OLD _IOWR(IOC_MDC_TYPE, 22, struct lov_user_mds_data_v1 *) -#define IOC_MDC_GETFILEINFO _IOWR(IOC_MDC_TYPE, 22, struct lov_user_mds_data) -#define LL_IOC_MDC_GETINFO_OLD _IOWR(IOC_MDC_TYPE, 23, struct lov_user_mds_data_v1 *) -#define LL_IOC_MDC_GETINFO _IOWR(IOC_MDC_TYPE, 23, struct lov_user_mds_data) -#endif +#define IOC_MDC_GETFILEINFO_V1 _IOWR(IOC_MDC_TYPE, 22, struct lov_user_mds_data_v1 *) +#define IOC_MDC_GETFILEINFO_V2 _IOWR(IOC_MDC_TYPE, 22, struct lov_user_mds_data) +#define LL_IOC_MDC_GETINFO_V1 _IOWR(IOC_MDC_TYPE, 23, struct lov_user_mds_data_v1 *) +#define LL_IOC_MDC_GETINFO_V2 _IOWR(IOC_MDC_TYPE, 23, struct lov_user_mds_data) +#define IOC_MDC_GETFILEINFO IOC_MDC_GETFILEINFO_V1 +#define LL_IOC_MDC_GETINFO LL_IOC_MDC_GETINFO_V1 #define MAX_OBD_NAME 128 /* If this changes, a NEW ioctl must be added */ @@ -682,7 +687,6 @@ struct fsxattr { #define LL_FILE_GROUP_LOCKED 0x00000002 #define LL_FILE_READAHEA 0x00000004 #define LL_FILE_LOCKED_DIRECTIO 0x00000008 /* client-side locks with dio */ -#define LL_FILE_LOCKLESS_IO 0x00000010 /* server-side locks with cio */ #define LL_FILE_FLOCK_WARNING 0x00000020 /* warned about disabled flock */ #define LOV_USER_MAGIC_V1 0x0BD10BD0 @@ -704,6 +708,7 @@ struct fsxattr { #define LOV_PATTERN_RAID1 0x002 #define LOV_PATTERN_MDT 0x100 #define LOV_PATTERN_OVERSTRIPING 0x200 +#define LOV_PATTERN_FOREIGN 0x400 #define LOV_PATTERN_F_MASK 0xffff0000 #define LOV_PATTERN_F_HOLE 0x40000000 /* there is hole in LOV EA */ @@ -963,7 +968,6 @@ static inline __u32 lov_user_md_size(__u16 stripes, __u32 lmm_magic) /* Compile with -D_LARGEFILE64_SOURCE or -D_GNU_SOURCE (or #define) to * use this. It is unsafe to #define those values in this header as it * is possible the application has already #included . */ -#ifdef HAVE_LOV_USER_MDS_DATA #define lov_user_mds_data lov_user_mds_data_v2 struct lov_user_mds_data_v1 { lstat_t lmd_st; /* MDS stat struct */ @@ -978,7 +982,6 @@ struct lov_user_mds_data_v2 { __u32 lmd_padding; /* unused */ struct lov_user_md_v1 lmd_lmm; /* LOV EA user data */ } __attribute__((packed)); -#endif struct lmv_user_mds_data { struct lu_fid lum_fid; @@ -994,11 +997,14 @@ enum lmv_hash_type { LMV_HASH_TYPE_MAX, }; -#define LMV_HASH_TYPE_DEFAULT LMV_HASH_TYPE_FNV_1A_64 +static __attribute__((unused)) const char *mdt_hash_name[] = { + "none", + "all_char", + "fnv_1a_64", + "crush", +}; -#define LMV_HASH_NAME_ALL_CHARS "all_char" -#define LMV_HASH_NAME_FNV_1A_64 "fnv_1a_64" -#define LMV_HASH_NAME_CRUSH "crush" +#define LMV_HASH_TYPE_DEFAULT LMV_HASH_TYPE_CRUSH /* Right now only the lower part(0-16bits) of lmv_hash_type is being used, * and the higher part will be the flag to indicate the status of object, @@ -1013,6 +1019,9 @@ static inline bool lmv_is_known_hash_type(__u32 type) (type & LMV_HASH_TYPE_MASK) == LMV_HASH_TYPE_CRUSH; } +#define LMV_HASH_FLAG_MERGE 0x04000000 +#define LMV_HASH_FLAG_SPLIT 0x08000000 + /* The striped directory has ever lost its master LMV EA, then LFSCK * re-generated it. This flag is used to indicate such case. It is an * on-disk flag. */ @@ -1021,9 +1030,39 @@ static inline bool lmv_is_known_hash_type(__u32 type) #define LMV_HASH_FLAG_BAD_TYPE 0x20000000 #define LMV_HASH_FLAG_MIGRATION 0x80000000 -#define LMV_HASH_FLAG_LAYOUT_CHANGE LMV_HASH_FLAG_MIGRATION +#define LMV_HASH_FLAG_LAYOUT_CHANGE \ + (LMV_HASH_FLAG_MIGRATION | LMV_HASH_FLAG_SPLIT | LMV_HASH_FLAG_MERGE) -extern char *mdt_hash_name[LMV_HASH_TYPE_MAX]; +/* both SPLIT and MIGRATION are set for directory split */ +static inline bool lmv_hash_is_splitting(__u32 hash) +{ + return (hash & LMV_HASH_FLAG_LAYOUT_CHANGE) == + (LMV_HASH_FLAG_SPLIT | LMV_HASH_FLAG_MIGRATION); +} + +/* both MERGE and MIGRATION are set for directory merge */ +static inline bool lmv_hash_is_merging(__u32 hash) +{ + return (hash & LMV_HASH_FLAG_LAYOUT_CHANGE) == + (LMV_HASH_FLAG_MERGE | LMV_HASH_FLAG_MIGRATION); +} + +/* only MIGRATION is set for directory migration */ +static inline bool lmv_hash_is_migrating(__u32 hash) +{ + return (hash & LMV_HASH_FLAG_LAYOUT_CHANGE) == LMV_HASH_FLAG_MIGRATION; +} + +static inline bool lmv_hash_is_restriping(__u32 hash) +{ + return lmv_hash_is_splitting(hash) || lmv_hash_is_merging(hash); +} + +static inline bool lmv_hash_is_layout_changing(__u32 hash) +{ + return lmv_hash_is_splitting(hash) || lmv_hash_is_merging(hash) || + lmv_hash_is_migrating(hash); +} struct lustre_foreign_type { __u32 lft_type; @@ -1035,7 +1074,7 @@ struct lustre_foreign_type { **/ enum lustre_foreign_types { LU_FOREIGN_TYPE_NONE = 0, - LU_FOREIGN_TYPE_DAOS = 0xda05, + LU_FOREIGN_TYPE_SYMLINK = 0xda05, /* must be the max/last one */ LU_FOREIGN_TYPE_UNKNOWN = 0xffffffff, }; @@ -1047,12 +1086,14 @@ extern struct lustre_foreign_type lu_foreign_types[]; #define LMV_MAX_STRIPE_COUNT 2000 /* ((12 * 4096 - 256) / 24) */ #define lmv_user_md lmv_user_md_v1 struct lmv_user_md_v1 { - __u32 lum_magic; /* must be the first field */ + __u32 lum_magic; /* must be the first field */ __u32 lum_stripe_count; /* dirstripe count */ __u32 lum_stripe_offset; /* MDT idx for default dirstripe */ __u32 lum_hash_type; /* Dir stripe policy */ - __u32 lum_type; /* LMV type: default */ - __u32 lum_padding1; + __u32 lum_type; /* LMV type: default */ + __u8 lum_max_inherit; /* inherit depth of default LMV */ + __u8 lum_max_inherit_rr; /* inherit depth of default LMV to round-robin mkdir */ + __u16 lum_padding1; __u32 lum_padding2; __u32 lum_padding3; char lum_pool_name[LOV_MAXPOOLNAME + 1]; @@ -1078,6 +1119,37 @@ enum lmv_type { LMV_TYPE_DEFAULT = 0x0000, }; +/* lum_max_inherit will be decreased by 1 after each inheritance if it's not + * LMV_INHERIT_UNLIMITED or > LMV_INHERIT_MAX. + */ +enum { + /* for historical reason, 0 means unlimited inheritance */ + LMV_INHERIT_UNLIMITED = 0, + /* unlimited lum_max_inherit by default */ + LMV_INHERIT_DEFAULT = 0, + /* not inherit any more */ + LMV_INHERIT_END = 1, + /* max inherit depth */ + LMV_INHERIT_MAX = 250, + /* [251, 254] are reserved */ + /* not set, or when inherit depth goes beyond end, */ + LMV_INHERIT_NONE = 255, +}; + +enum { + /* not set, or when inherit_rr depth goes beyond end, */ + LMV_INHERIT_RR_NONE = 0, + /* disable lum_max_inherit_rr by default */ + LMV_INHERIT_RR_DEFAULT = 0, + /* not inherit any more */ + LMV_INHERIT_RR_END = 1, + /* max inherit depth */ + LMV_INHERIT_RR_MAX = 250, + /* [251, 254] are reserved */ + /* unlimited inheritance */ + LMV_INHERIT_RR_UNLIMITED = 255, +}; + static inline int lmv_user_md_size(int stripes, int lmm_magic) { int size = sizeof(struct lmv_user_md); @@ -1198,7 +1270,12 @@ static inline __u64 lustre_stoqb(__kernel_size_t space) #define LUSTRE_Q_FINVALIDATE 0x80000c /* deprecated as of 2.4 */ #define LUSTRE_Q_GETDEFAULT 0x80000d /* get default quota */ #define LUSTRE_Q_SETDEFAULT 0x80000e /* set default quota */ - +#define LUSTRE_Q_GETQUOTAPOOL 0x80000f /* get user pool quota */ +#define LUSTRE_Q_SETQUOTAPOOL 0x800010 /* set user pool quota */ +#define LUSTRE_Q_GETINFOPOOL 0x800011 /* get pool quota info */ +#define LUSTRE_Q_SETINFOPOOL 0x800012 /* set pool quota info */ +#define LUSTRE_Q_GETDEFAULT_POOL 0x800013 /* get default pool quota*/ +#define LUSTRE_Q_SETDEFAULT_POOL 0x800014 /* set default pool quota */ /* In the current Lustre implementation, the grace time is either the time * or the timestamp to be used after some quota ID exceeds the soft limt, * 48 bits should be enough, its high 16 bits can be used as quota flags. @@ -1224,6 +1301,14 @@ static inline __u64 lustre_stoqb(__kernel_size_t space) * */ #define LQUOTA_FLAG_DEFAULT 0x0001 +#define LUSTRE_Q_CMD_IS_POOL(cmd) \ + (cmd == LUSTRE_Q_GETQUOTAPOOL || \ + cmd == LUSTRE_Q_SETQUOTAPOOL || \ + cmd == LUSTRE_Q_SETINFOPOOL || \ + cmd == LUSTRE_Q_GETINFOPOOL || \ + cmd == LUSTRE_Q_SETDEFAULT_POOL || \ + cmd == LUSTRE_Q_GETDEFAULT_POOL) + #define ALLQUOTA 255 /* set all quota */ static inline const char *qtype_name(int qtype) { @@ -1239,7 +1324,6 @@ static inline const char *qtype_name(int qtype) } #define IDENTITY_DOWNCALL_MAGIC 0x6d6dd629 -#define SEPOL_DOWNCALL_MAGIC 0x8b8bb842 /* permission */ #define N_PERMS_MAX 64 @@ -1261,10 +1345,23 @@ struct identity_downcall_data { __u32 idd_groups[0]; }; +#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 16, 53, 0) +/* old interface struct is deprecated in 2.14 */ +#define SEPOL_DOWNCALL_MAGIC_OLD 0x8b8bb842 +struct sepol_downcall_data_old { + __u32 sdd_magic; + __s64 sdd_sepol_mtime; + __u16 sdd_sepol_len; + char sdd_sepol[0]; +}; +#endif + +#define SEPOL_DOWNCALL_MAGIC 0x8b8bb843 struct sepol_downcall_data { __u32 sdd_magic; - __kernel_time_t sdd_sepol_mtime; __u16 sdd_sepol_len; + __u16 sdd_padding1; + __s64 sdd_sepol_mtime; char sdd_sepol[0]; }; @@ -1304,9 +1401,9 @@ struct obd_dqinfo { /* XXX: same as if_dqblk struct in kernel, plus one padding */ struct obd_dqblk { - __u64 dqb_bhardlimit; - __u64 dqb_bsoftlimit; - __u64 dqb_curspace; + __u64 dqb_bhardlimit; /* kbytes unit */ + __u64 dqb_bsoftlimit; /* kbytes unit */ + __u64 dqb_curspace; /* bytes unit */ __u64 dqb_ihardlimit; __u64 dqb_isoftlimit; __u64 dqb_curinodes; @@ -1334,6 +1431,7 @@ struct if_quotactl { struct obd_dqblk qc_dqblk; char obd_type[16]; struct obd_uuid obd_uuid; + char qc_poolname[0]; }; /* swap layout flags */ @@ -1378,6 +1476,7 @@ enum la_valid { LA_LAYOUT_VERSION = 1 << 16, /* 0x10000 */ LA_LSIZE = 1 << 17, /* 0x20000 */ LA_LBLOCKS = 1 << 18, /* 0x40000 */ + LA_BTIME = 1 << 19, /* 0x80000 */ /** * Attributes must be transmitted to OST objects */ @@ -1472,7 +1571,7 @@ enum changelog_rec_type { }; static inline const char *changelog_type2str(int type) { - static const char *changelog_str[] = { + static const char *const changelog_str[] = { "MARK", "CREAT", "MKDIR", "HLINK", "SLINK", "MKNOD", "UNLNK", "RMDIR", "RENME", "RNMTO", "OPEN", "CLOSE", "LYOUT", "TRUNC", "SATTR", "XATTR", "HSM", "MTIME", "CTIME", "ATIME", "MIGRT", @@ -2382,31 +2481,6 @@ struct hsm_copy { struct hsm_action_item hc_hai; }; -/* JSON objects */ -enum llapi_json_types { - LLAPI_JSON_INTEGER = 1, - LLAPI_JSON_BIGNUM, - LLAPI_JSON_REAL, - LLAPI_JSON_STRING -}; - -struct llapi_json_item { - char *lji_key; - __u32 lji_type; - union { - int lji_integer; - __u64 lji_u64; - double lji_real; - char *lji_string; - }; - struct llapi_json_item *lji_next; -}; - -struct llapi_json_item_list { - int ljil_item_count; - struct llapi_json_item *ljil_items; -}; - enum lu_ladvise_type { LU_LADVISE_INVALID = 0, LU_LADVISE_WILLREAD = 1, @@ -2604,6 +2678,52 @@ struct fid_array { }; #define OBD_MAX_FIDS_IN_ARRAY 4096 +/* more types could be defined upon need for more complex + * format to be used in foreign symlink LOV/LMV EAs, like + * one to describe a delimiter string and occurence number + * of delimited sub-string, ... + */ +enum ll_foreign_symlink_upcall_item_type { + EOB_TYPE = 1, + STRING_TYPE = 2, + POSLEN_TYPE = 3, +}; + +/* may need to be modified to allow for more format items to be defined, and + * like for ll_foreign_symlink_upcall_item_type enum + */ +struct ll_foreign_symlink_upcall_item { + __u32 type; + union { + struct { + __u32 pos; + __u32 len; + }; + struct { + size_t size; + union { + /* internal storage of constant string */ + char *string; + /* upcall stores constant string in a raw */ + char bytestring[0]; + }; + }; + }; +}; + +#define POSLEN_ITEM_SZ (offsetof(struct ll_foreign_symlink_upcall_item, len) + \ + sizeof(((struct ll_foreign_symlink_upcall_item *)0)->len)) +#define STRING_ITEM_SZ(sz) ( \ + offsetof(struct ll_foreign_symlink_upcall_item, bytestring) + \ + (sz + sizeof(__u32) - 1) / sizeof(__u32) * sizeof(__u32)) + +/* presently limited to not cause max stack frame size to be reached + * because of temporary automatic array of + * "struct ll_foreign_symlink_upcall_item" presently used in + * foreign_symlink_upcall_info_store() + */ +#define MAX_NB_UPCALL_ITEMS 32 + #if defined(__cplusplus) } #endif