~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/nfs/flexfilelayout/flexfilelayout.h

Version: ~ [ linux-5.8-rc4 ] ~ [ linux-5.7.7 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.50 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.131 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.187 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.229 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.229 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * NFSv4 flexfile layout driver data structures.
  3  *
  4  * Copyright (c) 2014, Primary Data, Inc. All rights reserved.
  5  *
  6  * Tao Peng <bergwolf@primarydata.com>
  7  */
  8 
  9 #ifndef FS_NFS_NFS4FLEXFILELAYOUT_H
 10 #define FS_NFS_NFS4FLEXFILELAYOUT_H
 11 
 12 #define FF_FLAGS_NO_LAYOUTCOMMIT 1
 13 #define FF_FLAGS_NO_IO_THRU_MDS 2
 14 
 15 #include "../pnfs.h"
 16 
 17 /* XXX: Let's filter out insanely large mirror count for now to avoid oom
 18  * due to network error etc. */
 19 #define NFS4_FLEXFILE_LAYOUT_MAX_MIRROR_CNT 4096
 20 
 21 /* LAYOUTSTATS report interval in ms */
 22 #define FF_LAYOUTSTATS_REPORT_INTERVAL (60000L)
 23 
 24 struct nfs4_ff_ds_version {
 25         u32                             version;
 26         u32                             minor_version;
 27         u32                             rsize;
 28         u32                             wsize;
 29         bool                            tightly_coupled;
 30 };
 31 
 32 /* chained in global deviceid hlist */
 33 struct nfs4_ff_layout_ds {
 34         struct nfs4_deviceid_node       id_node;
 35         u32                             ds_versions_cnt;
 36         struct nfs4_ff_ds_version       *ds_versions;
 37         struct nfs4_pnfs_ds             *ds;
 38 };
 39 
 40 struct nfs4_ff_layout_ds_err {
 41         struct list_head                list; /* linked in mirror error_list */
 42         u64                             offset;
 43         u64                             length;
 44         int                             status;
 45         enum nfs_opnum4                 opnum;
 46         nfs4_stateid                    stateid;
 47         struct nfs4_deviceid            deviceid;
 48 };
 49 
 50 struct nfs4_ff_io_stat {
 51         __u64                           ops_requested;
 52         __u64                           bytes_requested;
 53         __u64                           ops_completed;
 54         __u64                           bytes_completed;
 55         __u64                           bytes_not_delivered;
 56         ktime_t                         total_busy_time;
 57         ktime_t                         aggregate_completion_time;
 58 };
 59 
 60 struct nfs4_ff_busy_timer {
 61         ktime_t start_time;
 62         atomic_t n_ops;
 63 };
 64 
 65 struct nfs4_ff_layoutstat {
 66         struct nfs4_ff_io_stat io_stat;
 67         struct nfs4_ff_busy_timer busy_timer;
 68 };
 69 
 70 struct nfs4_ff_layout_mirror {
 71         struct pnfs_layout_hdr          *layout;
 72         struct list_head                mirrors;
 73         u32                             ds_count;
 74         u32                             efficiency;
 75         struct nfs4_ff_layout_ds        *mirror_ds;
 76         u32                             fh_versions_cnt;
 77         struct nfs_fh                   *fh_versions;
 78         nfs4_stateid                    stateid;
 79         u32                             uid;
 80         u32                             gid;
 81         struct rpc_cred                 *cred;
 82         atomic_t                        ref;
 83         spinlock_t                      lock;
 84         struct nfs4_ff_layoutstat       read_stat;
 85         struct nfs4_ff_layoutstat       write_stat;
 86         ktime_t                         start_time;
 87         ktime_t                         last_report_time;
 88         u32                             report_interval;
 89 };
 90 
 91 struct nfs4_ff_layout_segment {
 92         struct pnfs_layout_segment      generic_hdr;
 93         u64                             stripe_unit;
 94         u32                             flags;
 95         u32                             mirror_array_cnt;
 96         struct nfs4_ff_layout_mirror    **mirror_array;
 97 };
 98 
 99 struct nfs4_flexfile_layout {
100         struct pnfs_layout_hdr generic_hdr;
101         struct pnfs_ds_commit_info commit_info;
102         struct list_head        mirrors;
103         struct list_head        error_list; /* nfs4_ff_layout_ds_err */
104 };
105 
106 static inline struct nfs4_flexfile_layout *
107 FF_LAYOUT_FROM_HDR(struct pnfs_layout_hdr *lo)
108 {
109         return container_of(lo, struct nfs4_flexfile_layout, generic_hdr);
110 }
111 
112 static inline struct nfs4_ff_layout_segment *
113 FF_LAYOUT_LSEG(struct pnfs_layout_segment *lseg)
114 {
115         return container_of(lseg,
116                             struct nfs4_ff_layout_segment,
117                             generic_hdr);
118 }
119 
120 static inline struct nfs4_deviceid_node *
121 FF_LAYOUT_DEVID_NODE(struct pnfs_layout_segment *lseg, u32 idx)
122 {
123         if (idx >= FF_LAYOUT_LSEG(lseg)->mirror_array_cnt ||
124             FF_LAYOUT_LSEG(lseg)->mirror_array[idx] == NULL ||
125             FF_LAYOUT_LSEG(lseg)->mirror_array[idx]->mirror_ds == NULL)
126                 return NULL;
127         return &FF_LAYOUT_LSEG(lseg)->mirror_array[idx]->mirror_ds->id_node;
128 }
129 
130 static inline struct nfs4_ff_layout_ds *
131 FF_LAYOUT_MIRROR_DS(struct nfs4_deviceid_node *node)
132 {
133         return container_of(node, struct nfs4_ff_layout_ds, id_node);
134 }
135 
136 static inline struct nfs4_ff_layout_mirror *
137 FF_LAYOUT_COMP(struct pnfs_layout_segment *lseg, u32 idx)
138 {
139         if (idx >= FF_LAYOUT_LSEG(lseg)->mirror_array_cnt)
140                 return NULL;
141         return FF_LAYOUT_LSEG(lseg)->mirror_array[idx];
142 }
143 
144 static inline u32
145 FF_LAYOUT_MIRROR_COUNT(struct pnfs_layout_segment *lseg)
146 {
147         return FF_LAYOUT_LSEG(lseg)->mirror_array_cnt;
148 }
149 
150 static inline bool
151 ff_layout_no_fallback_to_mds(struct pnfs_layout_segment *lseg)
152 {
153         return FF_LAYOUT_LSEG(lseg)->flags & FF_FLAGS_NO_IO_THRU_MDS;
154 }
155 
156 static inline bool
157 ff_layout_test_devid_unavailable(struct nfs4_deviceid_node *node)
158 {
159         return nfs4_test_deviceid_unavailable(node);
160 }
161 
162 static inline int
163 nfs4_ff_layout_ds_version(struct pnfs_layout_segment *lseg, u32 ds_idx)
164 {
165         return FF_LAYOUT_COMP(lseg, ds_idx)->mirror_ds->ds_versions[0].version;
166 }
167 
168 struct nfs4_ff_layout_ds *
169 nfs4_ff_alloc_deviceid_node(struct nfs_server *server, struct pnfs_device *pdev,
170                             gfp_t gfp_flags);
171 void nfs4_ff_layout_put_deviceid(struct nfs4_ff_layout_ds *mirror_ds);
172 void nfs4_ff_layout_free_deviceid(struct nfs4_ff_layout_ds *mirror_ds);
173 int ff_layout_track_ds_error(struct nfs4_flexfile_layout *flo,
174                              struct nfs4_ff_layout_mirror *mirror, u64 offset,
175                              u64 length, int status, enum nfs_opnum4 opnum,
176                              gfp_t gfp_flags);
177 int ff_layout_encode_ds_ioerr(struct nfs4_flexfile_layout *flo,
178                               struct xdr_stream *xdr, int *count,
179                               const struct pnfs_layout_range *range);
180 struct nfs_fh *
181 nfs4_ff_layout_select_ds_fh(struct pnfs_layout_segment *lseg, u32 mirror_idx);
182 
183 struct nfs4_pnfs_ds *
184 nfs4_ff_layout_prepare_ds(struct pnfs_layout_segment *lseg, u32 ds_idx,
185                           bool fail_return);
186 
187 struct rpc_clnt *
188 nfs4_ff_find_or_create_ds_client(struct pnfs_layout_segment *lseg,
189                                  u32 ds_idx,
190                                  struct nfs_client *ds_clp,
191                                  struct inode *inode);
192 struct rpc_cred *ff_layout_get_ds_cred(struct pnfs_layout_segment *lseg,
193                                        u32 ds_idx, struct rpc_cred *mdscred);
194 bool ff_layout_has_available_ds(struct pnfs_layout_segment *lseg);
195 #endif /* FS_NFS_NFS4FLEXFILELAYOUT_H */
196 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp