diff options
Diffstat (limited to 'fs/nfs/nfs4filelayout.h')
-rw-r--r-- | fs/nfs/nfs4filelayout.h | 63 |
1 files changed, 52 insertions, 11 deletions
diff --git a/fs/nfs/nfs4filelayout.h b/fs/nfs/nfs4filelayout.h index 21190bb1f5e3..43fe802dd678 100644 --- a/fs/nfs/nfs4filelayout.h +++ b/fs/nfs/nfs4filelayout.h | |||
@@ -33,6 +33,13 @@ | |||
33 | #include "pnfs.h" | 33 | #include "pnfs.h" |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * Default data server connection timeout and retrans vaules. | ||
37 | * Set by module paramters dataserver_timeo and dataserver_retrans. | ||
38 | */ | ||
39 | #define NFS4_DEF_DS_TIMEO 60 | ||
40 | #define NFS4_DEF_DS_RETRANS 5 | ||
41 | |||
42 | /* | ||
36 | * Field testing shows we need to support up to 4096 stripe indices. | 43 | * Field testing shows we need to support up to 4096 stripe indices. |
37 | * We store each index as a u8 (u32 on the wire) to keep the memory footprint | 44 | * We store each index as a u8 (u32 on the wire) to keep the memory footprint |
38 | * reasonable. This in turn means we support a maximum of 256 | 45 | * reasonable. This in turn means we support a maximum of 256 |
@@ -41,6 +48,9 @@ | |||
41 | #define NFS4_PNFS_MAX_STRIPE_CNT 4096 | 48 | #define NFS4_PNFS_MAX_STRIPE_CNT 4096 |
42 | #define NFS4_PNFS_MAX_MULTI_CNT 256 /* 256 fit into a u8 stripe_index */ | 49 | #define NFS4_PNFS_MAX_MULTI_CNT 256 /* 256 fit into a u8 stripe_index */ |
43 | 50 | ||
51 | /* error codes for internal use */ | ||
52 | #define NFS4ERR_RESET_TO_MDS 12001 | ||
53 | |||
44 | enum stripetype4 { | 54 | enum stripetype4 { |
45 | STRIPE_SPARSE = 1, | 55 | STRIPE_SPARSE = 1, |
46 | STRIPE_DENSE = 2 | 56 | STRIPE_DENSE = 2 |
@@ -62,23 +72,14 @@ struct nfs4_pnfs_ds { | |||
62 | atomic_t ds_count; | 72 | atomic_t ds_count; |
63 | }; | 73 | }; |
64 | 74 | ||
65 | /* nfs4_file_layout_dsaddr flags */ | ||
66 | #define NFS4_DEVICE_ID_NEG_ENTRY 0x00000001 | ||
67 | |||
68 | struct nfs4_file_layout_dsaddr { | 75 | struct nfs4_file_layout_dsaddr { |
69 | struct nfs4_deviceid_node id_node; | 76 | struct nfs4_deviceid_node id_node; |
70 | unsigned long flags; | ||
71 | u32 stripe_count; | 77 | u32 stripe_count; |
72 | u8 *stripe_indices; | 78 | u8 *stripe_indices; |
73 | u32 ds_num; | 79 | u32 ds_num; |
74 | struct nfs4_pnfs_ds *ds_list[1]; | 80 | struct nfs4_pnfs_ds *ds_list[1]; |
75 | }; | 81 | }; |
76 | 82 | ||
77 | struct nfs4_fl_commit_bucket { | ||
78 | struct list_head written; | ||
79 | struct list_head committing; | ||
80 | }; | ||
81 | |||
82 | struct nfs4_filelayout_segment { | 83 | struct nfs4_filelayout_segment { |
83 | struct pnfs_layout_segment generic_hdr; | 84 | struct pnfs_layout_segment generic_hdr; |
84 | u32 stripe_type; | 85 | u32 stripe_type; |
@@ -89,10 +90,19 @@ struct nfs4_filelayout_segment { | |||
89 | struct nfs4_file_layout_dsaddr *dsaddr; /* Point to GETDEVINFO data */ | 90 | struct nfs4_file_layout_dsaddr *dsaddr; /* Point to GETDEVINFO data */ |
90 | unsigned int num_fh; | 91 | unsigned int num_fh; |
91 | struct nfs_fh **fh_array; | 92 | struct nfs_fh **fh_array; |
92 | struct nfs4_fl_commit_bucket *commit_buckets; /* Sort commits to ds */ | ||
93 | int number_of_buckets; | ||
94 | }; | 93 | }; |
95 | 94 | ||
95 | struct nfs4_filelayout { | ||
96 | struct pnfs_layout_hdr generic_hdr; | ||
97 | struct pnfs_ds_commit_info commit_info; | ||
98 | }; | ||
99 | |||
100 | static inline struct nfs4_filelayout * | ||
101 | FILELAYOUT_FROM_HDR(struct pnfs_layout_hdr *lo) | ||
102 | { | ||
103 | return container_of(lo, struct nfs4_filelayout, generic_hdr); | ||
104 | } | ||
105 | |||
96 | static inline struct nfs4_filelayout_segment * | 106 | static inline struct nfs4_filelayout_segment * |
97 | FILELAYOUT_LSEG(struct pnfs_layout_segment *lseg) | 107 | FILELAYOUT_LSEG(struct pnfs_layout_segment *lseg) |
98 | { | 108 | { |
@@ -107,6 +117,36 @@ FILELAYOUT_DEVID_NODE(struct pnfs_layout_segment *lseg) | |||
107 | return &FILELAYOUT_LSEG(lseg)->dsaddr->id_node; | 117 | return &FILELAYOUT_LSEG(lseg)->dsaddr->id_node; |
108 | } | 118 | } |
109 | 119 | ||
120 | static inline void | ||
121 | filelayout_mark_devid_invalid(struct nfs4_deviceid_node *node) | ||
122 | { | ||
123 | u32 *p = (u32 *)&node->deviceid; | ||
124 | |||
125 | printk(KERN_WARNING "NFS: Deviceid [%x%x%x%x] marked out of use.\n", | ||
126 | p[0], p[1], p[2], p[3]); | ||
127 | |||
128 | set_bit(NFS_DEVICEID_INVALID, &node->flags); | ||
129 | } | ||
130 | |||
131 | static inline bool | ||
132 | filelayout_test_layout_invalid(struct pnfs_layout_hdr *lo) | ||
133 | { | ||
134 | return test_bit(NFS_LAYOUT_INVALID, &lo->plh_flags); | ||
135 | } | ||
136 | |||
137 | static inline bool | ||
138 | filelayout_test_devid_invalid(struct nfs4_deviceid_node *node) | ||
139 | { | ||
140 | return test_bit(NFS_DEVICEID_INVALID, &node->flags); | ||
141 | } | ||
142 | |||
143 | static inline bool | ||
144 | filelayout_reset_to_mds(struct pnfs_layout_segment *lseg) | ||
145 | { | ||
146 | return filelayout_test_devid_invalid(FILELAYOUT_DEVID_NODE(lseg)) || | ||
147 | filelayout_test_layout_invalid(lseg->pls_layout); | ||
148 | } | ||
149 | |||
110 | extern struct nfs_fh * | 150 | extern struct nfs_fh * |
111 | nfs4_fl_select_ds_fh(struct pnfs_layout_segment *lseg, u32 j); | 151 | nfs4_fl_select_ds_fh(struct pnfs_layout_segment *lseg, u32 j); |
112 | 152 | ||
@@ -119,5 +159,6 @@ extern void nfs4_fl_put_deviceid(struct nfs4_file_layout_dsaddr *dsaddr); | |||
119 | extern void nfs4_fl_free_deviceid(struct nfs4_file_layout_dsaddr *dsaddr); | 159 | extern void nfs4_fl_free_deviceid(struct nfs4_file_layout_dsaddr *dsaddr); |
120 | struct nfs4_file_layout_dsaddr * | 160 | struct nfs4_file_layout_dsaddr * |
121 | get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id, gfp_t gfp_flags); | 161 | get_device_info(struct inode *inode, struct nfs4_deviceid *dev_id, gfp_t gfp_flags); |
162 | void nfs4_ds_disconnect(struct nfs_client *clp); | ||
122 | 163 | ||
123 | #endif /* FS_NFS_NFS4FILELAYOUT_H */ | 164 | #endif /* FS_NFS_NFS4FILELAYOUT_H */ |