X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Finclude%2Flustre_scrub.h;h=b5d06c39645d0c9a42779b41ea72dfcdf86f2477;hp=4002ba63c0fc208f7f74fe176d22f20b6746a389;hb=da1d93513fdff0a70257b13aa5649e478d4f70b6;hpb=a48853cf3dc51b24cc276fcf5f2e3e25a32c0d25 diff --git a/lustre/include/lustre_scrub.h b/lustre/include/lustre_scrub.h index 4002ba6..b5d06c3 100644 --- a/lustre/include/lustre_scrub.h +++ b/lustre/include/lustre_scrub.h @@ -33,6 +33,7 @@ #ifndef _LUSTRE_SCRUB_H # define _LUSTRE_SCRUB_H +#include #include #include @@ -46,8 +47,6 @@ #define SCRUB_CHECKPOINT_INTERVAL 60 #define SCRUB_WINDOW_SIZE 1024 -#define HALF_SEC msecs_to_jiffies(MSEC_PER_SEC >> 1) - enum scrub_next_status { /* exit current loop and process next group */ SCRUB_NEXT_BREAK = 1, @@ -187,7 +186,7 @@ enum auto_scrub { struct scrub_file { /* 128-bit uuid for volume. */ - __u8 sf_uuid[16]; + uuid_t sf_uuid; /* See 'enum scrub_flags'. */ __u64 sf_flags; @@ -202,13 +201,13 @@ struct scrub_file { __u16 sf_param; /* The time for the last OI scrub completed. */ - __u64 sf_time_last_complete; + time64_t sf_time_last_complete; - /* The time for the latest OI scrub ran. */ - __u64 sf_time_latest_start; + /* The ttime for the latest OI scrub ran. */ + time64_t sf_time_latest_start; /* The time for the last OI scrub checkpoint. */ - __u64 sf_time_last_checkpoint; + time64_t sf_time_last_checkpoint; /* The position for the latest OI scrub started from. */ __u64 sf_pos_latest_start; @@ -237,8 +236,11 @@ struct scrub_file { /* How many IGIF objects. */ __u64 sf_items_igif; - /* How long the OI scrub has run. */ - __u32 sf_run_time; + /* How long the OI scrub has run in seconds. Do NOT change + * to time64_t since this breaks backwards compatibility. + * It shouldn't take more than 136 years to complete :-) + */ + s32 sf_run_time; /* How many completed OI scrub ran on the device. */ __u32 sf_success_count; @@ -260,7 +262,7 @@ struct lustre_scrub { /* Object for the scrub file. */ struct dt_object *os_obj; - struct ptlrpc_thread os_thread; + struct task_struct *os_task; struct list_head os_inconsistent_items; /* write lock for scrub prep/update/post/checkpoint, @@ -276,16 +278,20 @@ struct lustre_scrub { const char *os_name; - /* The time for last checkpoint, jiffies */ - cfs_time_t os_time_last_checkpoint; + /* The time for last checkpoint, seconds */ + time64_t os_time_last_checkpoint; - /* The time for next checkpoint, jiffies */ - cfs_time_t os_time_next_checkpoint; + /* The time for next checkpoint, seconds */ + time64_t os_time_next_checkpoint; /* How many objects have been checked since last checkpoint. */ __u64 os_new_checked; __u64 os_pos_current; __u32 os_start_flags; + /* Some of these bits can be set by different threads so + * all updates must be protected by ->os_lock to avoid + * racing read-modify-write cycles causing corruption. + */ unsigned int os_in_prior:1, /* process inconsistent item * found by RPC prior */ os_waiting:1, /* Waiting for scan window. */ @@ -294,7 +300,9 @@ struct lustre_scrub { os_convert_igif:1, os_partial_scan:1, os_in_join:1, - os_full_scrub:1; + os_running:1, /* scrub thread is running */ + os_full_scrub:1, + os_has_ml_file:1; }; #define INDEX_BACKUP_MAGIC_V1 0x1E41F208 @@ -333,11 +341,15 @@ struct lustre_index_restore_unit { char liru_name[0]; }; -void scrub_file_init(struct lustre_scrub *scrub, __u8 *uuid); -void scrub_file_reset(struct lustre_scrub *scrub, __u8 *uuid, __u64 flags); +void scrub_file_init(struct lustre_scrub *scrub, uuid_t uuid); +void scrub_file_reset(struct lustre_scrub *scrub, uuid_t uuid, u64 flags); int scrub_file_load(const struct lu_env *env, struct lustre_scrub *scrub); int scrub_file_store(const struct lu_env *env, struct lustre_scrub *scrub); int scrub_checkpoint(const struct lu_env *env, struct lustre_scrub *scrub); +int scrub_thread_prep(const struct lu_env *env, struct lustre_scrub *scrub, + uuid_t uuid, u64 start); +int scrub_thread_post(const struct lu_env *env, struct lustre_scrub *scrub, + int result); int scrub_start(int (*threadfn)(void *data), struct lustre_scrub *scrub, void *data, __u32 flags); void scrub_stop(struct lustre_scrub *scrub);