X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Finclude%2Fuapi%2Flinux%2Flustre%2Flustre_user.h;h=0bf54801a1c8cc9a432eef558710b21f2822bb7c;hp=a1ec1b231c3f00ac6ee2c71c6eb7a16a0863b8c1;hb=e5c8f6670fbeea9ec8c6092dfa4369508da54485;hpb=58811dd55434332d20142f49ac73165b3bffb9a6 diff --git a/lustre/include/uapi/linux/lustre/lustre_user.h b/lustre/include/uapi/linux/lustre/lustre_user.h index a1ec1b2..0bf5480 100644 --- a/lustre/include/uapi/linux/lustre/lustre_user.h +++ b/lustre/include/uapi/linux/lustre/lustre_user.h @@ -42,38 +42,32 @@ * @{ */ +#include +#include #include +#include +#include #include +#include +#include +#include -#ifdef __KERNEL__ -# include -# include -# include /* snprintf() */ -# include -# include -#else /* !__KERNEL__ */ -# include +#ifndef __KERNEL__ +# define __USE_ISOC99 1 # include # include /* snprintf() */ -# include -# include -# define NEED_QUOTA_DEFS -/* # include - this causes complaints about caddr_t */ # include -# include # define FILEID_LUSTRE 0x97 /* for name_to_handle_at() (and llapi_fd2fid()) */ -#endif /* __KERNEL__ */ - -/* Handle older distros */ -#ifndef __ALIGN_KERNEL -# define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) -# define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) -#endif +#endif /* !__KERNEL__ */ #if defined(__cplusplus) extern "C" { #endif +#ifdef __STRICT_ANSI__ +#define typeof __typeof__ +#endif + /* * This is a temporary solution of adding quota type. * Should be removed as soon as system header is updated. @@ -242,7 +236,12 @@ 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 */ + +#endif /* STATX_BASIC_STATS */ typedef struct statx lstatx_t; @@ -259,15 +258,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 */ @@ -282,7 +281,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 */ @@ -426,8 +425,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) }; @@ -649,8 +649,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 @@ -690,7 +688,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 @@ -998,6 +995,7 @@ enum lmv_hash_type { LMV_HASH_TYPE_UNKNOWN = 0, /* 0 is reserved for testing purpose */ LMV_HASH_TYPE_ALL_CHARS = 1, LMV_HASH_TYPE_FNV_1A_64 = 2, + LMV_HASH_TYPE_CRUSH = 3, LMV_HASH_TYPE_MAX, }; @@ -1005,9 +1003,7 @@ enum lmv_hash_type { #define LMV_HASH_NAME_ALL_CHARS "all_char" #define LMV_HASH_NAME_FNV_1A_64 "fnv_1a_64" - -/* not real hash type, but exposed to user as "space" hash type */ -#define LMV_HASH_NAME_SPACE "space" +#define LMV_HASH_NAME_CRUSH "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, @@ -1018,22 +1014,60 @@ enum lmv_hash_type { static inline bool lmv_is_known_hash_type(__u32 type) { return (type & LMV_HASH_TYPE_MASK) == LMV_HASH_TYPE_FNV_1A_64 || - (type & LMV_HASH_TYPE_MASK) == LMV_HASH_TYPE_ALL_CHARS; + (type & LMV_HASH_TYPE_MASK) == LMV_HASH_TYPE_ALL_CHARS || + (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. */ -#define LMV_HASH_FLAG_LOST_LMV 0x10000000 +#define LMV_HASH_FLAG_LOST_LMV 0x10000000 + +#define LMV_HASH_FLAG_BAD_TYPE 0x20000000 +#define LMV_HASH_FLAG_MIGRATION 0x80000000 + +#define LMV_HASH_FLAG_LAYOUT_CHANGE \ + (LMV_HASH_FLAG_MIGRATION | LMV_HASH_FLAG_SPLIT | LMV_HASH_FLAG_MERGE) + +/* 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; +} -#define LMV_HASH_FLAG_BAD_TYPE 0x20000000 -#define LMV_HASH_FLAG_MIGRATION 0x80000000 +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); +} extern char *mdt_hash_name[LMV_HASH_TYPE_MAX]; struct lustre_foreign_type { - uint32_t lft_type; - const char *lft_name; + __u32 lft_type; + const char *lft_name; }; /** @@ -1181,7 +1215,7 @@ static inline void obd_uuid2fsname(char *buf, char *uuid, int buflen) #define LUSTRE_QUOTABLOCK_BITS 10 #define LUSTRE_QUOTABLOCK_SIZE (1 << LUSTRE_QUOTABLOCK_BITS) -static inline __u64 lustre_stoqb(size_t space) +static inline __u64 lustre_stoqb(__kernel_size_t space) { return (space + LUSTRE_QUOTABLOCK_SIZE - 1) >> LUSTRE_QUOTABLOCK_BITS; } @@ -1204,7 +1238,10 @@ static inline __u64 lustre_stoqb(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 */ /* 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. @@ -1230,6 +1267,12 @@ static inline __u64 lustre_stoqb(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) + #define ALLQUOTA 255 /* set all quota */ static inline const char *qtype_name(int qtype) { @@ -1245,7 +1288,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 @@ -1267,11 +1309,24 @@ 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; - time_t sdd_sepol_mtime; - __u16 sdd_sepol_len; - char sdd_sepol[0]; + __u32 sdd_magic; + __u16 sdd_sepol_len; + __u16 sdd_padding1; + __s64 sdd_sepol_mtime; + char sdd_sepol[0]; }; #ifdef NEED_QUOTA_DEFS @@ -1310,9 +1365,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; @@ -1340,6 +1395,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 */ @@ -1384,6 +1440,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 */ @@ -1696,10 +1753,10 @@ struct changelog_ext_xattr { static inline struct changelog_ext_extra_flags *changelog_rec_extra_flags( const struct changelog_rec *rec); -static inline size_t changelog_rec_offset(enum changelog_rec_flags crf, +static inline __kernel_size_t changelog_rec_offset(enum changelog_rec_flags crf, enum changelog_rec_extra_flags cref) { - size_t size = sizeof(struct changelog_rec); + __kernel_size_t size = sizeof(struct changelog_rec); if (crf & CLF_RENAME) size += sizeof(struct changelog_ext_rename); @@ -1722,7 +1779,7 @@ static inline size_t changelog_rec_offset(enum changelog_rec_flags crf, return size; } -static inline size_t changelog_rec_size(const struct changelog_rec *rec) +static inline __kernel_size_t changelog_rec_size(const struct changelog_rec *rec) { enum changelog_rec_extra_flags cref = CLFE_INVALID; @@ -1734,7 +1791,7 @@ static inline size_t changelog_rec_size(const struct changelog_rec *rec) (enum changelog_rec_flags)rec->cr_flags, cref); } -static inline size_t changelog_rec_varsize(const struct changelog_rec *rec) +static inline __kernel_size_t changelog_rec_varsize(const struct changelog_rec *rec) { return changelog_rec_size(rec) - sizeof(*rec) + rec->cr_namelen; } @@ -1860,7 +1917,7 @@ static inline char *changelog_rec_name(const struct changelog_rec *rec) (enum changelog_rec_extra_flags)(cref & CLFE_SUPPORTED)); } -static inline size_t changelog_rec_snamelen(const struct changelog_rec *rec) +static inline __kernel_size_t changelog_rec_snamelen(const struct changelog_rec *rec) { return rec->cr_namelen - strlen(changelog_rec_name(rec)) - 1; } @@ -2217,11 +2274,12 @@ static inline void *hur_data(struct hsm_user_request *hur) /** * Compute the current length of the provided hsm_user_request. This returns -1 - * instead of an errno because ssize_t is defined to be only [ -1, SSIZE_MAX ] + * instead of an errno because __kernel_ssize_t is defined to be only + * [ -1, SSIZE_MAX ] * * return -1 on bounds check error. */ -static inline ssize_t hur_len(struct hsm_user_request *hur) +static inline __kernel_size_t hur_len(struct hsm_user_request *hur) { __u64 size; @@ -2230,7 +2288,7 @@ static inline ssize_t hur_len(struct hsm_user_request *hur) (__u64)hur->hur_request.hr_itemcount * sizeof(hur->hur_user_item[0]) + hur->hur_request.hr_data_len; - if ((ssize_t)size < 0) + if ((__kernel_ssize_t)size < 0) return -1; return size; @@ -2286,7 +2344,7 @@ struct hsm_action_item { * \retval buffer */ static inline char *hai_dump_data_field(const struct hsm_action_item *hai, - char *buffer, size_t len) + char *buffer, __kernel_size_t len) { int i; int data_len; @@ -2323,7 +2381,7 @@ struct hsm_action_list { /* Return pointer to first hai in action list */ static inline struct hsm_action_item *hai_first(struct hsm_action_list *hal) { - size_t offset = __ALIGN_KERNEL(strlen(hal->hal_fsname) + 1, 8); + __kernel_size_t offset = __ALIGN_KERNEL(strlen(hal->hal_fsname) + 1, 8); return (struct hsm_action_item *)(hal->hal_fsname + offset); } @@ -2331,16 +2389,16 @@ static inline struct hsm_action_item *hai_first(struct hsm_action_list *hal) /* Return pointer to next hai */ static inline struct hsm_action_item * hai_next(struct hsm_action_item *hai) { - size_t offset = __ALIGN_KERNEL(hai->hai_len, 8); + __kernel_size_t offset = __ALIGN_KERNEL(hai->hai_len, 8); return (struct hsm_action_item *)((char *)hai + offset); } /* Return size of an hsm_action_list */ -static inline size_t hal_size(struct hsm_action_list *hal) +static inline __kernel_size_t hal_size(struct hsm_action_list *hal) { __u32 i; - size_t sz; + __kernel_size_t sz; struct hsm_action_item *hai; sz = sizeof(*hal) + __ALIGN_KERNEL(strlen(hal->hal_fsname) + 1, 8); @@ -2387,31 +2445,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,