public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] afs: afs_alloc_inode: use kmem_cache_zalloc
@ 2014-02-20 13:16 Fabian Frederick
  2014-02-20 21:30 ` Joe Perches
  2014-02-20 22:23 ` Has slab ctor operation changed? -- was " David Howells
  0 siblings, 2 replies; 7+ messages in thread
From: Fabian Frederick @ 2014-02-20 13:16 UTC (permalink / raw)
  To: linux-kernel; +Cc: dhowells, akpm

afs_vnode is currently cleared with 2 memsets after allocation and 
1 in constructor (afs_i_init_once).
	-This patch calls zalloc for explicit zero fill.
	-Fix some typos.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/afs/super.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/fs/afs/super.c b/fs/afs/super.c
index c486155..e1fc569 100644
--- a/fs/afs/super.c
+++ b/fs/afs/super.c
@@ -76,7 +76,7 @@ static const match_table_t afs_options_list = {
 };
 
 /*
- * initialise the filesystem
+ * Initialize the filesystem
  */
 int __init afs_fs_init(void)
 {
@@ -448,19 +448,19 @@ error:
 static void afs_kill_super(struct super_block *sb)
 {
 	struct afs_super_info *as = sb->s_fs_info;
+
 	kill_anon_super(sb);
 	afs_put_volume(as->volume);
 	kfree(as);
 }
 
 /*
- * initialise an inode cache slab element prior to any use
+ * Initialize an inode cache slab element prior to any use
  */
 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,15 +481,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;
@@ -503,6 +500,7 @@ static void afs_i_callback(struct rcu_head *head)
 {
 	struct inode *inode = container_of(head, struct inode, i_rcu);
 	struct afs_vnode *vnode = AFS_FS_I(inode);
+
 	kmem_cache_free(afs_inode_cachep, vnode);
 }
 
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-02-24 19:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-20 13:16 [PATCH 1/1] afs: afs_alloc_inode: use kmem_cache_zalloc Fabian Frederick
2014-02-20 21:30 ` Joe Perches
2014-02-20 22:03   ` David Howells
2014-02-20 22:23 ` Has slab ctor operation changed? -- was " David Howells
2014-02-20 21:47   ` Fabian Frederick
2014-02-21  0:19   ` Dave Chinner
2014-02-24 19:52   ` Christoph Lameter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox