These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / fs / nfs / flexfilelayout / flexfilelayout.h
index 070f204..2bb08bc 100644 (file)
@@ -9,12 +9,18 @@
 #ifndef FS_NFS_NFS4FLEXFILELAYOUT_H
 #define FS_NFS_NFS4FLEXFILELAYOUT_H
 
+#define FF_FLAGS_NO_LAYOUTCOMMIT 1
+#define FF_FLAGS_NO_IO_THRU_MDS 2
+
 #include "../pnfs.h"
 
 /* XXX: Let's filter out insanely large mirror count for now to avoid oom
  * due to network error etc. */
 #define NFS4_FLEXFILE_LAYOUT_MAX_MIRROR_CNT 4096
 
+/* LAYOUTSTATS report interval in ms */
+#define FF_LAYOUTSTATS_REPORT_INTERVAL (60000L)
+
 struct nfs4_ff_ds_version {
        u32                             version;
        u32                             minor_version;
@@ -41,24 +47,50 @@ struct nfs4_ff_layout_ds_err {
        struct nfs4_deviceid            deviceid;
 };
 
+struct nfs4_ff_io_stat {
+       __u64                           ops_requested;
+       __u64                           bytes_requested;
+       __u64                           ops_completed;
+       __u64                           bytes_completed;
+       __u64                           bytes_not_delivered;
+       ktime_t                         total_busy_time;
+       ktime_t                         aggregate_completion_time;
+};
+
+struct nfs4_ff_busy_timer {
+       ktime_t start_time;
+       atomic_t n_ops;
+};
+
+struct nfs4_ff_layoutstat {
+       struct nfs4_ff_io_stat io_stat;
+       struct nfs4_ff_busy_timer busy_timer;
+};
+
 struct nfs4_ff_layout_mirror {
+       struct pnfs_layout_hdr          *layout;
+       struct list_head                mirrors;
        u32                             ds_count;
        u32                             efficiency;
        struct nfs4_ff_layout_ds        *mirror_ds;
        u32                             fh_versions_cnt;
        struct nfs_fh                   *fh_versions;
        nfs4_stateid                    stateid;
-       struct nfs4_string              user_name;
-       struct nfs4_string              group_name;
        u32                             uid;
        u32                             gid;
        struct rpc_cred                 *cred;
+       atomic_t                        ref;
        spinlock_t                      lock;
+       struct nfs4_ff_layoutstat       read_stat;
+       struct nfs4_ff_layoutstat       write_stat;
+       ktime_t                         start_time;
+       ktime_t                         last_report_time;
 };
 
 struct nfs4_ff_layout_segment {
        struct pnfs_layout_segment      generic_hdr;
        u64                             stripe_unit;
+       u32                             flags;
        u32                             mirror_array_cnt;
        struct nfs4_ff_layout_mirror    **mirror_array;
 };
@@ -66,6 +98,7 @@ struct nfs4_ff_layout_segment {
 struct nfs4_flexfile_layout {
        struct pnfs_layout_hdr generic_hdr;
        struct pnfs_ds_commit_info commit_info;
+       struct list_head        mirrors;
        struct list_head        error_list; /* nfs4_ff_layout_ds_err */
 };
 
@@ -113,6 +146,12 @@ FF_LAYOUT_MIRROR_COUNT(struct pnfs_layout_segment *lseg)
        return FF_LAYOUT_LSEG(lseg)->mirror_array_cnt;
 }
 
+static inline bool
+ff_layout_no_fallback_to_mds(struct pnfs_layout_segment *lseg)
+{
+       return FF_LAYOUT_LSEG(lseg)->flags & FF_FLAGS_NO_IO_THRU_MDS;
+}
+
 static inline bool
 ff_layout_test_devid_unavailable(struct nfs4_deviceid_node *node)
 {