Commit 5278b4c3 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] knfsd cleanups

all exports for given client are put on the cyclic list
(->cl_list/->ex_list).  Code cleaned up.
parent a90f30b9
......@@ -148,16 +148,14 @@ exp_child(svc_client *clp, struct super_block *sb, struct dentry *dentry)
/* Update parent pointers of all exports */
static void exp_change_parents(svc_client *clp, svc_export *old, svc_export *new)
{
int i;
for (i = 0; i < NFSCLNT_EXPMAX; i++) {
struct list_head *head = &clp->cl_export[i];
struct list_head *head = &clp->cl_list;
struct list_head *p;
list_for_each(p, head) {
svc_export *exp = list_entry(p, svc_export, ex_hash);
svc_export *exp = list_entry(p, svc_export, ex_list);
if (exp->ex_parent == old)
exp->ex_parent = new;
}
}
}
/*
......@@ -270,6 +268,7 @@ exp_export(struct nfsctl_export *nxp)
exp_change_parents(clp, parent, exp);
list_add(&exp->ex_hash, clp->cl_export + EXPORT_HASH(dev));
list_add_tail(&exp->ex_list, &clp->cl_list);
err = 0;
......@@ -317,19 +316,16 @@ exp_do_unexport(svc_export *unexp)
static void
exp_unexport_all(svc_client *clp)
{
int i;
struct list_head *p = &clp->cl_list;
dprintk("unexporting all fs's for clnt %p\n", clp);
for (i = 0; i < NFSCLNT_EXPMAX; i++) {
struct list_head *p = &clp->cl_export[i];
svc_export *exp;
while (!list_empty(p)) {
exp = list_entry(p->next, svc_export, ex_hash);
svc_export *exp = list_entry(p->next, svc_export, ex_list);
list_del(&exp->ex_list);
list_del(&exp->ex_hash);
exp_do_unexport(exp);
}
}
}
/*
......@@ -355,6 +351,7 @@ exp_unexport(struct nfsctl_export *nxp)
svc_export *exp = exp_get(clp, ex_dev, nxp->ex_ino);
if (exp) {
list_del(&exp->ex_hash);
list_del(&exp->ex_list);
exp_do_unexport(exp);
err = 0;
}
......@@ -599,20 +596,19 @@ exp_procfs_exports(char *buffer, char **start, off_t offset,
off_t pos = 0;
off_t begin = 0;
int len = 0;
int i,j;
int j;
len += sprintf(buffer, "# Version 1.1\n");
len += sprintf(buffer+len, "# Path Client(Flags) # IPs\n");
for (clp = clients; clp; clp = clp->cl_next) {
for (i = 0; i < NFSCLNT_EXPMAX; i++) {
struct list_head *list = &clp->cl_export[i];
struct list_head *list = &clp->cl_list;
struct list_head *p;
list_for_each(p, list) {
int first = 0;
exp = list_entry(p, svc_export, ex_hash);
exp = list_entry(p, svc_export, ex_list);
MANGLE(exp->ex_path);
buffer[len++]='\t';
MANGLE(clp->cl_ident);
......@@ -652,7 +648,6 @@ exp_procfs_exports(char *buffer, char **start, off_t offset,
goto done;
}
}
}
*eof = 1;
......@@ -701,6 +696,7 @@ exp_addclient(struct nfsctl_client *ncp)
memset(clp, 0, sizeof(*clp));
for (i = 0; i < NFSCLNT_EXPMAX; i++)
INIT_LIST_HEAD(&clp->cl_export[i]);
INIT_LIST_HEAD(&clp->cl_list);
dprintk("created client %s (%p)\n", ncp->cl_ident, clp);
......
......@@ -55,10 +55,12 @@ struct svc_client {
struct in_addr cl_addr[NFSCLNT_ADDRMAX];
struct svc_uidmap * cl_umap;
struct list_head cl_export[NFSCLNT_EXPMAX];
struct list_head cl_list;
};
struct svc_export {
struct list_head ex_hash;
struct list_head ex_list;
char ex_path[NFS_MAXPATHLEN+1];
struct svc_export * ex_parent;
struct svc_client * ex_client;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment