Whamcloud - gitweb
LU-7045 osd: enough credits for single indirect block write
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_scrub.h
index b07928e..ac966ab 100644 (file)
@@ -20,7 +20,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2012 Whamcloud, Inc.
+ * Copyright (c) 2012, 2014, Intel Corporation.
  */
 /*
  * lustre/osd-ldiskfs/osd_scrub.h
@@ -73,11 +73,17 @@ enum scrub_flags {
 
        /* OI scrub is triggered automatically. */
        SF_AUTO         = 0x0000000000000004ULL,
+
+       /* The device is upgraded from 1.8 format. */
+       SF_UPGRADE      = 0x0000000000000008ULL,
 };
 
 enum scrub_param {
        /* Exit when fail. */
        SP_FAILOUT      = 0x0001,
+
+       /* Check only without repairing. */
+       SP_DRYRUN       = 0x0002,
 };
 
 enum scrub_start {
@@ -90,8 +96,23 @@ enum scrub_start {
        /* Reset scrub start position. */
        SS_RESET                = 0x00000004,
 
-       /* Trigger scrub automatically. */
-       SS_AUTO                 = 0x00000008,
+       /* Trigger full scrub automatically. */
+       SS_AUTO_FULL            = 0x00000008,
+
+       /* Trigger partial scrub automatically. */
+       SS_AUTO_PARTIAL         = 0x00000010,
+
+       /* Set dryrun flag. */
+       SS_SET_DRYRUN           = 0x00000020,
+
+       /* Clear dryrun flag. */
+       SS_CLEAR_DRYRUN         = 0x00000040,
+};
+
+/* The flags here are only used inside OSD, NOT be visible by dump(). */
+enum scrub_internal_flags {
+       /* This is a new formatted device. */
+       SIF_NO_HANDLE_OLD_FID   = 0x0001,
 };
 
 struct scrub_file {
@@ -140,7 +161,7 @@ struct scrub_file {
        /* How many prior objects have been updated during scanning. */
        __u64   sf_items_updated_prior;
 
-       /* How many objects marked as I_LUSTRE_NOSCRUB. */
+       /* How many objects marked as LDISKFS_STATE_LUSTRE_NOSCRUB. */
        __u64   sf_items_noscrub;
 
        /* How many IGIF objects. */
@@ -155,8 +176,9 @@ struct scrub_file {
        /* How many OI files. */
        __u16   sf_oi_count;
 
-       /* Update the magic or flags if want to use the reserved fields. */
-       __u16   sf_reserved_0;
+       /* Keep the flags after scrub reset. See 'enum scrub_internal_flags' */
+       __u16   sf_internal_flags;
+
        __u32   sf_reserved_1;
        __u64   sf_reserved_2[16];
 
@@ -168,12 +190,12 @@ struct osd_scrub {
        struct lvfs_run_ctxt    os_ctxt;
        struct ptlrpc_thread    os_thread;
        struct osd_idmap_cache  os_oic;
-       cfs_list_t              os_inconsistent_items;
+       struct list_head        os_inconsistent_items;
 
        /* write lock for scrub prep/update/post/checkpoint,
         * read lock for scrub dump. */
-       cfs_rw_semaphore_t      os_rwsem;
-       cfs_spinlock_t          os_lock;
+       struct rw_semaphore     os_rwsem;
+       spinlock_t              os_lock;
 
        /* Scrub file in memory. */
        struct scrub_file       os_file;
@@ -190,6 +212,16 @@ struct osd_scrub {
        /* The time for next checkpoint, jiffies */
        cfs_time_t              os_time_next_checkpoint;
 
+       /* statistics for /lost+found are in ram only, it will be reset
+        * when each time the device remount. */
+
+       /* How many objects have been scanned during initial OI scrub. */
+       __u64                   os_lf_scanned;
+       /* How many objects have been repaired during initial OI scrub. */
+       __u64                   os_lf_repaired;
+       /* How many objects failed to be processed during initial OI scrub. */
+       __u64                   os_lf_failed;
+
        /* How many objects have been checked since last checkpoint. */
        __u32                   os_new_checked;
        __u32                   os_pos_current;
@@ -198,7 +230,13 @@ struct osd_scrub {
                                                * found by RPC prior */
                                os_waiting:1, /* Waiting for scan window. */
                                os_full_speed:1, /* run w/o speed limit */
-                               os_paused:1; /* The scrub is paused. */
+                               os_paused:1, /* The scrub is paused. */
+                               os_convert_igif:1,
+                               os_partial_scan:1,
+                               os_in_join:1,
+                               os_full_scrub:1;
+       __u64                   os_bad_oimap_count;
+       __u64                   os_bad_oimap_time;
 };
 
 #endif /* _OSD_SCRUB_H */