diff options
Diffstat (limited to 'fs/nfs/flexfilelayout/flexfilelayout.h')
-rw-r--r-- | fs/nfs/flexfilelayout/flexfilelayout.h | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.h b/fs/nfs/flexfilelayout/flexfilelayout.h index de50a342d5a5..2ac99124474c 100644 --- a/fs/nfs/flexfilelayout/flexfilelayout.h +++ b/fs/nfs/flexfilelayout/flexfilelayout.h | |||
@@ -132,16 +132,6 @@ FF_LAYOUT_LSEG(struct pnfs_layout_segment *lseg) | |||
132 | generic_hdr); | 132 | generic_hdr); |
133 | } | 133 | } |
134 | 134 | ||
135 | static inline struct nfs4_deviceid_node * | ||
136 | FF_LAYOUT_DEVID_NODE(struct pnfs_layout_segment *lseg, u32 idx) | ||
137 | { | ||
138 | if (idx >= FF_LAYOUT_LSEG(lseg)->mirror_array_cnt || | ||
139 | FF_LAYOUT_LSEG(lseg)->mirror_array[idx] == NULL || | ||
140 | FF_LAYOUT_LSEG(lseg)->mirror_array[idx]->mirror_ds == NULL) | ||
141 | return NULL; | ||
142 | return &FF_LAYOUT_LSEG(lseg)->mirror_array[idx]->mirror_ds->id_node; | ||
143 | } | ||
144 | |||
145 | static inline struct nfs4_ff_layout_ds * | 135 | static inline struct nfs4_ff_layout_ds * |
146 | FF_LAYOUT_MIRROR_DS(struct nfs4_deviceid_node *node) | 136 | FF_LAYOUT_MIRROR_DS(struct nfs4_deviceid_node *node) |
147 | { | 137 | { |
@@ -151,9 +141,25 @@ FF_LAYOUT_MIRROR_DS(struct nfs4_deviceid_node *node) | |||
151 | static inline struct nfs4_ff_layout_mirror * | 141 | static inline struct nfs4_ff_layout_mirror * |
152 | FF_LAYOUT_COMP(struct pnfs_layout_segment *lseg, u32 idx) | 142 | FF_LAYOUT_COMP(struct pnfs_layout_segment *lseg, u32 idx) |
153 | { | 143 | { |
154 | if (idx >= FF_LAYOUT_LSEG(lseg)->mirror_array_cnt) | 144 | struct nfs4_ff_layout_segment *fls = FF_LAYOUT_LSEG(lseg); |
155 | return NULL; | 145 | |
156 | return FF_LAYOUT_LSEG(lseg)->mirror_array[idx]; | 146 | if (idx < fls->mirror_array_cnt) |
147 | return fls->mirror_array[idx]; | ||
148 | return NULL; | ||
149 | } | ||
150 | |||
151 | static inline struct nfs4_deviceid_node * | ||
152 | FF_LAYOUT_DEVID_NODE(struct pnfs_layout_segment *lseg, u32 idx) | ||
153 | { | ||
154 | struct nfs4_ff_layout_mirror *mirror = FF_LAYOUT_COMP(lseg, idx); | ||
155 | |||
156 | if (mirror != NULL) { | ||
157 | struct nfs4_ff_layout_ds *mirror_ds = mirror->mirror_ds; | ||
158 | |||
159 | if (!IS_ERR_OR_NULL(mirror_ds)) | ||
160 | return &mirror_ds->id_node; | ||
161 | } | ||
162 | return NULL; | ||
157 | } | 163 | } |
158 | 164 | ||
159 | static inline u32 | 165 | static inline u32 |