aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4namespace.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2008-08-20 16:10:21 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-10-07 18:17:20 -0400
commit460cdbc83268dd9641b57d893b03ef52fcc3f96d (patch)
tree400fefcd6e9e481c9ae7481f4483e7f86face8f7 /fs/nfs/nfs4namespace.c
parent4ada29d5c4dd2d3ba89510bdbc64be22961fd1cb (diff)
nfs: replace while loop by for loops in nfs_follow_referral
Whoever wrote this had a bizarre allergy to for loops. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4namespace.c')
-rw-r--r--fs/nfs/nfs4namespace.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index 956cbbc2ae9f..6bcc5696f911 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -116,24 +116,22 @@ static struct vfsmount *try_location(struct nfs_clone_mount *mountdata,
116{ 116{
117 struct vfsmount *mnt = ERR_PTR(-ENOENT); 117 struct vfsmount *mnt = ERR_PTR(-ENOENT);
118 char *mnt_path; 118 char *mnt_path;
119 unsigned int s = 0; 119 unsigned int s;
120 120
121 mnt_path = nfs4_pathname_string(&location->rootpath, page2, PAGE_SIZE); 121 mnt_path = nfs4_pathname_string(&location->rootpath, page2, PAGE_SIZE);
122 if (IS_ERR(mnt_path)) 122 if (IS_ERR(mnt_path))
123 return mnt; 123 return mnt;
124 mountdata->mnt_path = mnt_path; 124 mountdata->mnt_path = mnt_path;
125 125
126 while (s < location->nservers) { 126 for (s = 0; s < location->nservers; s++) {
127 struct sockaddr_in addr = { 127 struct sockaddr_in addr = {
128 .sin_family = AF_INET, 128 .sin_family = AF_INET,
129 .sin_port = htons(NFS_PORT), 129 .sin_port = htons(NFS_PORT),
130 }; 130 };
131 131
132 if (location->servers[s].len <= 0 || 132 if (location->servers[s].len <= 0 ||
133 valid_ipaddr4(location->servers[s].data) < 0) { 133 valid_ipaddr4(location->servers[s].data) < 0)
134 s++;
135 continue; 134 continue;
136 }
137 135
138 mountdata->hostname = location->servers[s].data; 136 mountdata->hostname = location->servers[s].data;
139 addr.sin_addr.s_addr = in_aton(mountdata->hostname), 137 addr.sin_addr.s_addr = in_aton(mountdata->hostname),
@@ -147,7 +145,6 @@ static struct vfsmount *try_location(struct nfs_clone_mount *mountdata,
147 mnt = vfs_kern_mount(&nfs4_referral_fs_type, 0, page, mountdata); 145 mnt = vfs_kern_mount(&nfs4_referral_fs_type, 0, page, mountdata);
148 if (!IS_ERR(mnt)) 146 if (!IS_ERR(mnt))
149 break; 147 break;
150 s++;
151 } 148 }
152 return mnt; 149 return mnt;
153} 150}
@@ -193,20 +190,16 @@ static struct vfsmount *nfs_follow_referral(const struct vfsmount *mnt_parent,
193 goto out; 190 goto out;
194 } 191 }
195 192
196 loc = 0; 193 for (loc = 0; loc < locations->nlocations; loc++) {
197 while (loc < locations->nlocations) {
198 const struct nfs4_fs_location *location = &locations->locations[loc]; 194 const struct nfs4_fs_location *location = &locations->locations[loc];
199 195
200 if (location == NULL || location->nservers <= 0 || 196 if (location == NULL || location->nservers <= 0 ||
201 location->rootpath.ncomponents == 0) { 197 location->rootpath.ncomponents == 0)
202 loc++;
203 continue; 198 continue;
204 }
205 199
206 mnt = try_location(&mountdata, page, page2, location); 200 mnt = try_location(&mountdata, page, page2, location);
207 if (!IS_ERR(mnt)) 201 if (!IS_ERR(mnt))
208 break; 202 break;
209 loc++;
210 } 203 }
211 204
212out: 205out: