summaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2019-06-19 18:54:45 +0200
committerJ. Bruce Fields <bfields@redhat.com>2019-07-03 23:52:50 +0200
commita204f25e372d942245dc0fdccd12f5c16483bbc1 (patch)
tree5914748c7976a54623d4e0bab4433ab543d9c2ec /fs/nfsd/nfs4state.c
parentnfsd4: show layout stateids (diff)
downloadlinux-a204f25e372d942245dc0fdccd12f5c16483bbc1.tar.xz
linux-a204f25e372d942245dc0fdccd12f5c16483bbc1.zip
nfsd: create get_nfsdfs_clp helper
Factor our some common code. No change in behavior. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index e1936d3b7ece..1e078fb8d6b5 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2216,6 +2216,15 @@ find_stateid_by_type(struct nfs4_client *cl, stateid_t *t, char typemask)
return s;
}
+static struct nfs4_client *get_nfsdfs_clp(struct inode *inode)
+{
+ struct nfsdfs_client *nc;
+ nc = get_nfsdfs_client(inode);
+ if (!nc)
+ return NULL;
+ return container_of(nc, struct nfs4_client, cl_nfsdfs);
+}
+
static void seq_quote_mem(struct seq_file *m, char *data, int len)
{
seq_printf(m, "\"");
@@ -2226,14 +2235,12 @@ static void seq_quote_mem(struct seq_file *m, char *data, int len)
static int client_info_show(struct seq_file *m, void *v)
{
struct inode *inode = m->private;
- struct nfsdfs_client *nc;
struct nfs4_client *clp;
u64 clid;
- nc = get_nfsdfs_client(inode);
- if (!nc)
+ clp = get_nfsdfs_clp(inode);
+ if (!clp)
return -ENXIO;
- clp = container_of(nc, struct nfs4_client, cl_nfsdfs);
memcpy(&clid, &clp->cl_clientid, sizeof(clid));
seq_printf(m, "clientid: 0x%llx\n", clid);
seq_printf(m, "address: \"%pISpc\"\n", (struct sockaddr *)&clp->cl_addr);
@@ -2444,15 +2451,13 @@ static struct seq_operations states_seq_ops = {
static int client_states_open(struct inode *inode, struct file *file)
{
- struct nfsdfs_client *nc;
struct seq_file *s;
struct nfs4_client *clp;
int ret;
- nc = get_nfsdfs_client(inode);
- if (!nc)
+ clp = get_nfsdfs_clp(inode);
+ if (!clp)
return -ENXIO;
- clp = container_of(nc, struct nfs4_client, cl_nfsdfs);
ret = seq_open(file, &states_seq_ops);
if (ret)