Whamcloud - gitweb
LU-16356 hsm: add running ref to the coordinator
[fs/lustre-release.git] / lustre / include / uapi / linux / lustre / lustre_disk.h
index 6a6f2e9..a097bcf 100644 (file)
@@ -41,6 +41,8 @@
  * @{
  */
 #include <linux/types.h>
+#include <linux/uuid.h>
+#include <linux/lnet/lnet-types.h> /* for lnet_nid_t */
 
 /****************** on-disk files ********************/
 
@@ -135,11 +137,10 @@ struct lustre_disk_data {
 
 enum ldd_mount_type {
        LDD_MT_EXT3 = 0,
-       LDD_MT_LDISKFS,
-       LDD_MT_SMFS,
-       LDD_MT_REISERFS,
-       LDD_MT_LDISKFS2,
-       LDD_MT_ZFS,
+       LDD_MT_LDISKFS = 1,
+       LDD_MT_REISERFS = 3,
+       LDD_MT_LDISKFS2 = 4,
+       LDD_MT_ZFS = 5,
        LDD_MT_LAST
 };
 
@@ -254,6 +255,22 @@ enum nodemap_idx_type {
        NODEMAP_GLOBAL_IDX = 15,        /* stores nodemap activation status */
 };
 
+/* lu_nodemap flags */
+enum nm_flag_bits {
+       NM_FL_ALLOW_ROOT_ACCESS = 0x1,
+       NM_FL_TRUST_CLIENT_IDS = 0x2,
+       NM_FL_DENY_UNKNOWN = 0x4,
+       NM_FL_MAP_UID = 0x8,
+       NM_FL_MAP_GID = 0x10,
+       NM_FL_ENABLE_AUDIT = 0x20,
+       NM_FL_FORBID_ENCRYPT = 0x40,
+       NM_FL_MAP_PROJID = 0x80,
+};
+
+enum nm_flag2_bits {
+       NM_FL2_READONLY_MOUNT = 0x1,
+};
+
 /* Nodemap records, uses 32 byte record length.
  * New nodemap config records can be added into NODEMAP_CLUSTER_IDX
  * with a new nk_cluster_subid value, as long as the records are
@@ -333,6 +350,94 @@ struct nodemap_key {
 #define NM_TYPE_MASK 0x0FFFFFFF
 #define NM_TYPE_SHIFT 28
 
+/* file structure used for saving OI scrub bookmark state for restart */
+#define OSD_OI_FID_OID_BITS_MAX        10
+#define OSD_OI_FID_NR_MAX      (1UL << OSD_OI_FID_OID_BITS_MAX)
+#define SCRUB_OI_BITMAP_SIZE   (OSD_OI_FID_NR_MAX >> 3)
+
+#define SCRUB_MAGIC_V1                 0x4C5FD252
+#define SCRUB_MAGIC_V2                 0x4C5FE253
+
+enum scrub_flags {
+       /* OI files have been recreated, OI mappings should be re-inserted. */
+       SF_RECREATED    = 0x0000000000000001ULL,
+
+       /* OI files are invalid, should be rebuild ASAP */
+       SF_INCONSISTENT = 0x0000000000000002ULL,
+
+       /* OI scrub is triggered automatically. */
+       SF_AUTO         = 0x0000000000000004ULL,
+
+       /* The device is upgraded from 1.8 format. */
+       SF_UPGRADE      = 0x0000000000000008ULL,
+};
+
+enum scrub_status {
+       /* The scrub file is new created, for new MDT, upgrading from old disk,
+        * or re-creating the scrub file manually. */
+       SS_INIT         = 0,
+
+       /* The scrub is checking/repairing the OI files. */
+       SS_SCANNING     = 1,
+
+       /* The scrub checked/repaired the OI files successfully. */
+       SS_COMPLETED    = 2,
+
+       /* The scrub failed to check/repair the OI files. */
+       SS_FAILED       = 3,
+
+       /* The scrub is stopped manually, the OI files may be inconsistent. */
+       SS_STOPPED      = 4,
+
+       /* The scrub is paused automatically when umount. */
+       SS_PAUSED       = 5,
+
+       /* The scrub crashed during the scanning, should be restarted. */
+       SS_CRASHED      = 6,
+};
+
+enum scrub_param {
+       /* Exit when fail. */
+       SP_FAILOUT      = 0x0001,
+
+       /* Check only without repairing. */
+       SP_DRYRUN       = 0x0002,
+};
+
+#ifdef __KERNEL__
+/* v6.2-rc5-72-g5e6a51787fef kernel APIs need type to be guid_t */
+#define uuid_le        guid_t
+#endif
+
+struct scrub_file {
+       uuid_le sf_uuid;                    /* 128-bit uuid for volume */
+       __u64   sf_flags;                   /* see 'enum scrub_flags' */
+       __u32   sf_magic;                   /* SCRUB_MAGIC_V1/V2 */
+       __u16   sf_status;                  /* see 'enum scrub_status' */
+       __u16   sf_param;                   /* see 'enum scrub_param' */
+       __s64   sf_time_last_complete;      /* wallclock of last scrub finish */
+       __s64   sf_time_latest_start;       /* wallclock of last scrub run */
+       __s64   sf_time_last_checkpoint;    /* wallclock of last checkpoint */
+       __u64   sf_pos_latest_start;        /* OID of last scrub start */
+       __u64   sf_pos_last_checkpoint;     /* OID of last scrub checkpoint */
+       __u64   sf_pos_first_inconsistent;  /* OID first object to update */
+       __u64   sf_items_checked;           /* number objects checked */
+       __u64   sf_items_updated;           /* number objects updated */
+       __u64   sf_items_failed;            /* number objects unrepairable */
+       __u64   sf_items_updated_prior;     /* num objects fixed before scan */
+       __u64   sf_items_noscrub;           /* number of objects skipped due to
+                                            * LDISKFS_STATE_LUSTRE_NOSCRUB */
+       __u64   sf_items_igif;              /* number of IGIF(no FID) objects */
+       __u32   sf_run_time;                /* scrub runtime in seconds */
+       __u32   sf_success_count;           /* number of completed runs */
+       __u16   sf_oi_count;                /* number of OI files */
+       __u16   sf_internal_flags;          /* flags to keep after reset, see
+                                            * 'enum scrub_internal_flags' */
+       __u32   sf_reserved_1;
+       __u64   sf_reserved_2[16];
+       __u8    sf_oi_bitmap[SCRUB_OI_BITMAP_SIZE]; /* OI files recreated */
+};
+
 /** @} disk */
 
 #endif /* _UAPI_LUSTRE_DISK_H */