diff options
author | Jeff Layton <jlayton@primarydata.com> | 2014-07-30 14:27:24 +0200 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-08-05 16:55:10 +0200 |
commit | 285abdee5335921b6a41f9719c1fc56c478ac561 (patch) | |
tree | 000ad5303805250f7b9b2a0c5744a6d71099a7ec /fs/nfsd/fault_inject.c | |
parent | nfsd: add more granular locking to *_delegations fault injectors (diff) | |
download | linux-285abdee5335921b6a41f9719c1fc56c478ac561.tar.xz linux-285abdee5335921b6a41f9719c1fc56c478ac561.zip |
nfsd: remove old fault injection infrastructure
Remove the old nfsd_for_n_state function and move nfsd_find_client
higher up into the file to get rid of forward declaration. Remove
the struct nfsd_fault_inject_op arguments from the operations as
they are no longer needed by any of them.
Finally, remove the old "standard" get and set routines, which
also eliminates the client_mutex from this code.
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/fault_inject.c')
-rw-r--r-- | fs/nfsd/fault_inject.c | 51 |
1 files changed, 6 insertions, 45 deletions
diff --git a/fs/nfsd/fault_inject.c b/fs/nfsd/fault_inject.c index 2479dba71c3c..c16bf5af6831 100644 --- a/fs/nfsd/fault_inject.c +++ b/fs/nfsd/fault_inject.c @@ -17,52 +17,13 @@ struct nfsd_fault_inject_op { char *file; - u64 (*get)(struct nfsd_fault_inject_op *); - u64 (*set_val)(struct nfsd_fault_inject_op *, u64); - u64 (*set_clnt)(struct nfsd_fault_inject_op *, - struct sockaddr_storage *, size_t); - u64 (*forget)(struct nfs4_client *, u64); - u64 (*print)(struct nfs4_client *, u64); + u64 (*get)(void); + u64 (*set_val)(u64); + u64 (*set_clnt)(struct sockaddr_storage *, size_t); }; static struct dentry *debug_dir; -static u64 nfsd_inject_set(struct nfsd_fault_inject_op *op, u64 val) -{ - u64 count; - - nfs4_lock_state(); - count = nfsd_for_n_state(val, op->forget); - nfs4_unlock_state(); - return count; -} - -static u64 nfsd_inject_set_client(struct nfsd_fault_inject_op *op, - struct sockaddr_storage *addr, - size_t addr_size) -{ - struct nfs4_client *clp; - u64 count = 0; - - nfs4_lock_state(); - clp = nfsd_find_client(addr, addr_size); - if (clp) - count = op->forget(clp, 0); - nfs4_unlock_state(); - return count; -} - -static u64 nfsd_inject_get(struct nfsd_fault_inject_op *op) -{ - u64 count; - - nfs4_lock_state(); - count = nfsd_for_n_state(0, op->print); - nfs4_unlock_state(); - - return count; -} - static ssize_t fault_inject_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) { @@ -73,7 +34,7 @@ static ssize_t fault_inject_read(struct file *file, char __user *buf, struct nfsd_fault_inject_op *op = file_inode(file)->i_private; if (!pos) - val = op->get(op); + val = op->get(); size = scnprintf(read_buf, sizeof(read_buf), "%llu\n", val); return simple_read_from_buffer(buf, len, ppos, read_buf, size); @@ -103,7 +64,7 @@ static ssize_t fault_inject_write(struct file *file, const char __user *buf, size = rpc_pton(net, write_buf, size, (struct sockaddr *)&sa, sizeof(sa)); if (size > 0) { - val = op->set_clnt(op, &sa, size); + val = op->set_clnt(&sa, size); if (val) pr_info("NFSD [%s]: Client %s had %llu state object(s)\n", op->file, write_buf, val); @@ -114,7 +75,7 @@ static ssize_t fault_inject_write(struct file *file, const char __user *buf, else pr_info("NFSD Fault Injection: %s (n = %llu)", op->file, val); - val = op->set_val(op, val); + val = op->set_val(val); pr_info("NFSD: %s: found %llu", op->file, val); } return len; /* on success, claim we got the whole input */ |