* [PATCH v2] afs: afs_alloc_inode: use kmem_cache_zalloc
@ 2014-02-20 14:00 Fabian Frederick
2014-02-21 21:47 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Fabian Frederick @ 2014-02-20 14:00 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm, dhowells, Joe Perches
This patch calls zalloc for explicit zero fill and removes all memset 0.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
fs/afs/super.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/fs/afs/super.c b/fs/afs/super.c
index c486155..aff91ee 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -460,7 +460,6 @@ static void afs_i_init_once(void *_vnode)
{
struct afs_vnode *vnode = _vnode;
- memset(vnode, 0, sizeof(*vnode));
inode_init_once(&vnode->vfs_inode);
init_waitqueue_head(&vnode->update_waitq);
mutex_init(&vnode->permits_lock);
@@ -481,17 +480,12 @@ static struct inode *afs_alloc_inode(struct super_block *sb)
{
struct afs_vnode *vnode;
- vnode = kmem_cache_alloc(afs_inode_cachep, GFP_KERNEL);
+ vnode = kmem_cache_zalloc(afs_inode_cachep, GFP_KERNEL);
if (!vnode)
return NULL;
atomic_inc(&afs_count_active_inodes);
- memset(&vnode->fid, 0, sizeof(vnode->fid));
- memset(&vnode->status, 0, sizeof(vnode->status));
-
- vnode->volume = NULL;
- vnode->update_cnt = 0;
vnode->flags = 1 << AFS_VNODE_UNSET;
vnode->cb_promised = false;
--
1.8.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] afs: afs_alloc_inode: use kmem_cache_zalloc
2014-02-20 14:00 [PATCH v2] afs: afs_alloc_inode: use kmem_cache_zalloc Fabian Frederick
@ 2014-02-21 21:47 ` Andrew Morton
2014-02-21 21:52 ` Andrew Morton
2014-02-21 22:48 ` David Howells
0 siblings, 2 replies; 4+ messages in thread
From: Andrew Morton @ 2014-02-21 21:47 UTC (permalink / raw)
To: Fabian Frederick; +Cc: linux-kernel, dhowells, Joe Perches
On Thu, 20 Feb 2014 22:00:39 +0800 Fabian Frederick <fabf@skynet.be> wrote:
> This patch calls zalloc for explicit zero fill and removes all memset 0.
>
May as well fix the deceitful comment while we're in there.
--- a/fs/afs/super.c~afs-afs_alloc_inode-use-kmem_cache_zalloc-fix
+++ a/fs/afs/super.c
@@ -474,7 +474,7 @@ static void afs_i_init_once(void *_vnode
}
/*
- * allocate an AFS inode struct from our slab cache
+ * allocate an AFS inode struct
*/
static struct inode *afs_alloc_inode(struct super_block *sb)
{
This isn't the most useful comment in the kernel..
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] afs: afs_alloc_inode: use kmem_cache_zalloc
2014-02-21 21:47 ` Andrew Morton
@ 2014-02-21 21:52 ` Andrew Morton
2014-02-21 22:48 ` David Howells
1 sibling, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2014-02-21 21:52 UTC (permalink / raw)
To: Fabian Frederick, linux-kernel, dhowells, Joe Perches
On Fri, 21 Feb 2014 13:47:16 -0800 Andrew Morton <akpm@linux-foundation.org> wrote:
> --- a/fs/afs/super.c~afs-afs_alloc_inode-use-kmem_cache_zalloc-fix
> +++ a/fs/afs/super.c
> @@ -474,7 +474,7 @@ static void afs_i_init_once(void *_vnode
> }
>
> /*
> - * allocate an AFS inode struct from our slab cache
> + * allocate an AFS inode struct
> */
> static struct inode *afs_alloc_inode(struct super_block *sb)
> {
err, this was obviously a product of senility.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] afs: afs_alloc_inode: use kmem_cache_zalloc
2014-02-21 21:47 ` Andrew Morton
2014-02-21 21:52 ` Andrew Morton
@ 2014-02-21 22:48 ` David Howells
1 sibling, 0 replies; 4+ messages in thread
From: David Howells @ 2014-02-21 22:48 UTC (permalink / raw)
To: Andrew Morton; +Cc: dhowells, Fabian Frederick, linux-kernel, Joe Perches
Andrew Morton <akpm@linux-foundation.org> wrote:
> > - * allocate an AFS inode struct from our slab cache
> > + * allocate an AFS inode struct
> > */
> > static struct inode *afs_alloc_inode(struct super_block *sb)
> > {
>
> err, this was obviously a product of senility.
My comment, or your comment on my comment?
David
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-02-21 22:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-20 14:00 [PATCH v2] afs: afs_alloc_inode: use kmem_cache_zalloc Fabian Frederick
2014-02-21 21:47 ` Andrew Morton
2014-02-21 21:52 ` Andrew Morton
2014-02-21 22:48 ` David Howells
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.