Whamcloud - gitweb
LU-6401 uapi: migrate remaining uapi headers to uapi directory
[fs/lustre-release.git] / lustre / include / lustre_import.h
index f4a7b90..108cec3 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,7 +23,7 @@
  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2013, Intel Corporation.
+ * Copyright (c) 2011, 2016, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -48,8 +44,7 @@
  */
 
 #include <lustre_handles.h>
-#include <lustre/lustre_idl.h>
-
+#include <uapi/linux/lustre/lustre_idl.h>
 
 /**
  * Adaptive Timeout stuff
 #define AT_FLG_NOHIST 0x1          /* use last reported value only */
 
 struct adaptive_timeout {
-       time_t          at_binstart;         /* bin start time */
+       time64_t        at_binstart;         /* bin start time */
        unsigned int    at_hist[AT_BINS];    /* timeout history bins */
        unsigned int    at_flags;
        unsigned int    at_current;          /* current timeout value */
        unsigned int    at_worst_ever;       /* worst-ever timeout value */
-       time_t          at_worst_time;       /* worst-ever timeout timestamp */
+       time64_t        at_worst_time;       /* worst-ever timeout timestamp */
        spinlock_t      at_lock;
 };
 
+enum lustre_at_flags {
+       LATF_SKIP       = 0x0,
+       LATF_STATS      = 0x1,
+};
+
 struct ptlrpc_at_array {
        struct list_head *paa_reqs_array; /** array to hold requests */
         __u32             paa_size;       /** the size of array */
         __u32             paa_count;      /** the total count of reqs */
-        time_t            paa_deadline;   /** the earliest deadline of reqs */
+       time64_t          paa_deadline;   /** the earliest deadline of reqs */
         __u32            *paa_reqs_count; /** the count of reqs in each entry */
 };
 
@@ -147,8 +147,8 @@ struct obd_import_conn {
 /* state history */
 #define IMP_STATE_HIST_LEN 16
 struct import_state_hist {
-        enum lustre_imp_state ish_state;
-        time_t                ish_time;
+       enum lustre_imp_state   ish_state;
+       time64_t                ish_time;
 };
 
 /**
@@ -191,6 +191,11 @@ struct obd_import {
        struct list_head        *imp_replay_cursor;
        /** @} */
 
+       /** List of not replied requests */
+       struct list_head        imp_unreplied_list;
+       /** Known maximal replied XID */
+       __u64                   imp_known_replied_xid;
+
        /** obd device for this import */
        struct obd_device       *imp_obd;
 
@@ -198,9 +203,10 @@ struct obd_import {
          * some seciruty-related fields
          * @{
          */
-        struct ptlrpc_sec        *imp_sec;
+       struct ptlrpc_sec        *imp_sec;
        struct mutex              imp_sec_mutex;
-        cfs_time_t                imp_sec_expire;
+       time64_t                imp_sec_expire;
+       pid_t                     imp_sec_refpid;
         /** @} */
 
        /** Wait queue for those who need to wait for recovery completion */
@@ -218,6 +224,8 @@ struct obd_import {
        atomic_t                  imp_timeouts;
        /** Current import state */
         enum lustre_imp_state     imp_state;
+       /** Last replay state */
+       enum lustre_imp_state     imp_replay_state;
         /** History of import states */
         struct import_state_hist  imp_state_hist[IMP_STATE_HIST_LEN];
         int                       imp_state_hist_idx;
@@ -248,7 +256,7 @@ struct obd_import {
         struct lustre_handle      imp_remote_handle;
         /** When to perform next ping. time in jiffies. */
         cfs_time_t                imp_next_ping;
-        /** When we last succesfully connected. time in 64bit jiffies */
+       /** When we last successfully connected. time in 64bit jiffies */
         __u64                     imp_last_success_conn;
 
         /** List of all possible connection for import. */
@@ -297,19 +305,22 @@ struct obd_import {
                                   * chouse new connection */
                                  imp_force_reconnect:1,
                                  /* import has tried to connect with server */
-                                 imp_connect_tried:1;
-        __u32                     imp_connect_op;
-        struct obd_connect_data   imp_connect_data;
-        __u64                     imp_connect_flags_orig;
-        int                       imp_connect_error;
-
-        __u32                     imp_msg_magic;
-        __u32                     imp_msghdr_flags;       /* adjusted based on server capability */
-
-        struct ptlrpc_request_pool *imp_rq_pool;          /* emergency request pool */
-
-        struct imp_at             imp_at;                 /* adaptive timeout data */
-        time_t                    imp_last_reply_time;    /* for health check */
+                                 imp_connect_tried:1,
+                                 /* connected but not FULL yet */
+                                 imp_connected:1;
+       __u32                     imp_connect_op;
+       struct obd_connect_data   imp_connect_data;
+       __u64                     imp_connect_flags_orig;
+       __u64                     imp_connect_flags2_orig;
+       int                       imp_connect_error;
+
+       __u32                     imp_msg_magic;
+                                 /* adjusted based on server capability */
+       __u32                     imp_msghdr_flags;
+
+                                 /* adaptive timeout data */
+       struct imp_at             imp_at;
+       time64_t                  imp_last_reply_time;  /* for health check */
 };
 
 /* import.c */
@@ -326,19 +337,37 @@ static inline unsigned int at_timeout2est(unsigned int val)
         return (max((val << 2) / 5, 5U) - 4);
 }
 
-static inline void at_reset(struct adaptive_timeout *at, int val) {
-       spin_lock(&at->at_lock);
+static inline void at_reset_nolock(struct adaptive_timeout *at, int val)
+{
         at->at_current = val;
         at->at_worst_ever = val;
-        at->at_worst_time = cfs_time_current_sec();
+       at->at_worst_time = ktime_get_real_seconds();
+}
+
+static inline void at_reset(struct adaptive_timeout *at, int val)
+{
+       spin_lock(&at->at_lock);
+       at_reset_nolock(at, val);
        spin_unlock(&at->at_lock);
 }
+
 static inline void at_init(struct adaptive_timeout *at, int val, int flags) {
        memset(at, 0, sizeof(*at));
        spin_lock_init(&at->at_lock);
        at->at_flags = flags;
        at_reset(at, val);
 }
+
+static inline void at_reinit(struct adaptive_timeout *at, int val, int flags)
+{
+       spin_lock(&at->at_lock);
+       at->at_binstart = 0;
+       memset(at->at_hist, 0, sizeof(at->at_hist));
+       at->at_flags = flags;
+       at_reset_nolock(at, val);
+       spin_unlock(&at->at_lock);
+}
+
 extern unsigned int at_min;
 static inline int at_get(struct adaptive_timeout *at) {
         return (at->at_current > at_min) ? at->at_current : at_min;