* [PATCH] fs/fscache/object-list.c: use __seq_open_private()
@ 2014-09-17 8:56 Rob Jones
2014-09-29 15:42 ` Rob Jones
2014-10-14 8:45 ` David Howells
0 siblings, 2 replies; 3+ messages in thread
From: Rob Jones @ 2014-09-17 8:56 UTC (permalink / raw)
To: dhowells; +Cc: linux-cachefs, linux-kernel, linux-kernel, rob.jones
Reduce boilerplate code by using __seq_open_private() instead of seq_open()
in fscache_objlist_open().
Signed-off-by: Rob Jones <rob.jones@codethink.co.uk>
---
Note that sparse generates a warning on this file but it is outside the
remit of this patch.
Note 2, it looks to me like the sparse warning may be a false positive.
fs/fscache/object-list.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/fs/fscache/object-list.c b/fs/fscache/object-list.c
index b5ebc2d..a1ca2f9 100644
--- a/fs/fscache/object-list.c
+++ b/fs/fscache/object-list.c
@@ -380,26 +380,14 @@ no_config:
static int fscache_objlist_open(struct inode *inode, struct file *file)
{
struct fscache_objlist_data *data;
- struct seq_file *m;
- int ret;
- ret = seq_open(file, &fscache_objlist_ops);
- if (ret < 0)
- return ret;
-
- m = file->private_data;
-
- /* buffer for key extraction */
- data = kmalloc(sizeof(struct fscache_objlist_data), GFP_KERNEL);
- if (!data) {
- seq_release(inode, file);
+ data = __seq_open_private(file, &fscache_objlist_ops, sizeof(*data));
+ if (!data)
return -ENOMEM;
- }
/* get the configuration key */
fscache_objlist_config(data);
- m->private = data;
return 0;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fs/fscache/object-list.c: use __seq_open_private()
2014-09-17 8:56 [PATCH] fs/fscache/object-list.c: use __seq_open_private() Rob Jones
@ 2014-09-29 15:42 ` Rob Jones
2014-10-14 8:45 ` David Howells
1 sibling, 0 replies; 3+ messages in thread
From: Rob Jones @ 2014-09-29 15:42 UTC (permalink / raw)
To: dhowells; +Cc: linux-cachefs, linux-kernel, linux-kernel
I submitted the patch below on 17th September but have had no feedback.
It seems to me a worthwhile change (well, I wouldn't have written it
otherwise) but does anybody else have any comments on it?
On 17/09/14 09:56, Rob Jones wrote:
> Reduce boilerplate code by using __seq_open_private() instead of seq_open()
> in fscache_objlist_open().
>
> Signed-off-by: Rob Jones <rob.jones@codethink.co.uk>
> ---
>
> Note that sparse generates a warning on this file but it is outside the
> remit of this patch.
>
> Note 2, it looks to me like the sparse warning may be a false positive.
>
> fs/fscache/object-list.c | 16 ++--------------
> 1 file changed, 2 insertions(+), 14 deletions(-)
>
> diff --git a/fs/fscache/object-list.c b/fs/fscache/object-list.c
> index b5ebc2d..a1ca2f9 100644
> --- a/fs/fscache/object-list.c
> +++ b/fs/fscache/object-list.c
> @@ -380,26 +380,14 @@ no_config:
> static int fscache_objlist_open(struct inode *inode, struct file *file)
> {
> struct fscache_objlist_data *data;
> - struct seq_file *m;
> - int ret;
>
> - ret = seq_open(file, &fscache_objlist_ops);
> - if (ret < 0)
> - return ret;
> -
> - m = file->private_data;
> -
> - /* buffer for key extraction */
> - data = kmalloc(sizeof(struct fscache_objlist_data), GFP_KERNEL);
> - if (!data) {
> - seq_release(inode, file);
> + data = __seq_open_private(file, &fscache_objlist_ops, sizeof(*data));
> + if (!data)
> return -ENOMEM;
> - }
>
> /* get the configuration key */
> fscache_objlist_config(data);
>
> - m->private = data;
> return 0;
> }
>
>
--
Rob Jones
Codethink Ltd
mailto:rob.jones@codethink.co.uk
tel:+44 161 236 5575
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fs/fscache/object-list.c: use __seq_open_private()
2014-09-17 8:56 [PATCH] fs/fscache/object-list.c: use __seq_open_private() Rob Jones
2014-09-29 15:42 ` Rob Jones
@ 2014-10-14 8:45 ` David Howells
1 sibling, 0 replies; 3+ messages in thread
From: David Howells @ 2014-10-14 8:45 UTC (permalink / raw)
To: Rob Jones; +Cc: dhowells, linux-cachefs, linux-kernel, linux-kernel
Rob Jones <rob.jones@codethink.co.uk> wrote:
> I submitted the patch below on 17th September but have had no feedback.
It is now upstream.
David
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-10-14 8:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-17 8:56 [PATCH] fs/fscache/object-list.c: use __seq_open_private() Rob Jones
2014-09-29 15:42 ` Rob Jones
2014-10-14 8:45 ` David Howells
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).