Commit 3f373e81b1e8d26a90523cd12385cbce588f3f18
Committed by
Anna Schumaker
1 parent
6489a8f413
sunrpc: record rpc client pointer in seq->private directly
pos in rpc_clnt_iter is useless, drop it and record clnt in seq_private. Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Showing 1 changed file with 10 additions and 25 deletions Side-by-side Diff
net/sunrpc/debugfs.c
... | ... | @@ -16,11 +16,6 @@ |
16 | 16 | |
17 | 17 | unsigned int rpc_inject_disconnect; |
18 | 18 | |
19 | -struct rpc_clnt_iter { | |
20 | - struct rpc_clnt *clnt; | |
21 | - loff_t pos; | |
22 | -}; | |
23 | - | |
24 | 19 | static int |
25 | 20 | tasks_show(struct seq_file *f, void *v) |
26 | 21 | { |
27 | 22 | |
28 | 23 | |
... | ... | @@ -47,12 +42,10 @@ |
47 | 42 | tasks_start(struct seq_file *f, loff_t *ppos) |
48 | 43 | __acquires(&clnt->cl_lock) |
49 | 44 | { |
50 | - struct rpc_clnt_iter *iter = f->private; | |
45 | + struct rpc_clnt *clnt = f->private; | |
51 | 46 | loff_t pos = *ppos; |
52 | - struct rpc_clnt *clnt = iter->clnt; | |
53 | 47 | struct rpc_task *task; |
54 | 48 | |
55 | - iter->pos = pos + 1; | |
56 | 49 | spin_lock(&clnt->cl_lock); |
57 | 50 | list_for_each_entry(task, &clnt->cl_tasks, tk_task) |
58 | 51 | if (pos-- == 0) |
59 | 52 | |
... | ... | @@ -63,12 +56,10 @@ |
63 | 56 | static void * |
64 | 57 | tasks_next(struct seq_file *f, void *v, loff_t *pos) |
65 | 58 | { |
66 | - struct rpc_clnt_iter *iter = f->private; | |
67 | - struct rpc_clnt *clnt = iter->clnt; | |
59 | + struct rpc_clnt *clnt = f->private; | |
68 | 60 | struct rpc_task *task = v; |
69 | 61 | struct list_head *next = task->tk_task.next; |
70 | 62 | |
71 | - ++iter->pos; | |
72 | 63 | ++*pos; |
73 | 64 | |
74 | 65 | /* If there's another task on list, return it */ |
... | ... | @@ -81,9 +72,7 @@ |
81 | 72 | tasks_stop(struct seq_file *f, void *v) |
82 | 73 | __releases(&clnt->cl_lock) |
83 | 74 | { |
84 | - struct rpc_clnt_iter *iter = f->private; | |
85 | - struct rpc_clnt *clnt = iter->clnt; | |
86 | - | |
75 | + struct rpc_clnt *clnt = f->private; | |
87 | 76 | spin_unlock(&clnt->cl_lock); |
88 | 77 | } |
89 | 78 | |
90 | 79 | |
91 | 80 | |
... | ... | @@ -96,17 +85,13 @@ |
96 | 85 | |
97 | 86 | static int tasks_open(struct inode *inode, struct file *filp) |
98 | 87 | { |
99 | - int ret = seq_open_private(filp, &tasks_seq_operations, | |
100 | - sizeof(struct rpc_clnt_iter)); | |
101 | - | |
88 | + int ret = seq_open(filp, &tasks_seq_operations); | |
102 | 89 | if (!ret) { |
103 | 90 | struct seq_file *seq = filp->private_data; |
104 | - struct rpc_clnt_iter *iter = seq->private; | |
91 | + struct rpc_clnt *clnt = seq->private = inode->i_private; | |
105 | 92 | |
106 | - iter->clnt = inode->i_private; | |
107 | - | |
108 | - if (!atomic_inc_not_zero(&iter->clnt->cl_count)) { | |
109 | - seq_release_private(inode, filp); | |
93 | + if (!atomic_inc_not_zero(&clnt->cl_count)) { | |
94 | + seq_release(inode, filp); | |
110 | 95 | ret = -EINVAL; |
111 | 96 | } |
112 | 97 | } |
113 | 98 | |
... | ... | @@ -118,10 +103,10 @@ |
118 | 103 | tasks_release(struct inode *inode, struct file *filp) |
119 | 104 | { |
120 | 105 | struct seq_file *seq = filp->private_data; |
121 | - struct rpc_clnt_iter *iter = seq->private; | |
106 | + struct rpc_clnt *clnt = seq->private; | |
122 | 107 | |
123 | - rpc_release_client(iter->clnt); | |
124 | - return seq_release_private(inode, filp); | |
108 | + rpc_release_client(clnt); | |
109 | + return seq_release(inode, filp); | |
125 | 110 | } |
126 | 111 | |
127 | 112 | static const struct file_operations tasks_fops = { |