From: Eric Paris <eparis@redhat.com>
To: linux-kernel@vger.kernel.org, viro@ZenIV.linux.org.uk
Subject: [PATCH 5/5] fsnotify: use kmem_cache_zalloc to simplify event initialization
Date: Sun, 09 Aug 2009 17:59:59 -0400 [thread overview]
Message-ID: <20090809215958.26204.11952.stgit@paris.rdu.redhat.com> (raw)
In-Reply-To: <20090809215935.26204.46787.stgit@paris.rdu.redhat.com>
fsnotify event initialization is done entry by entry with almost everything
set to either 0 or NULL. Use kmem_cache_zalloc and only initialize things
that need non-zero initialization. Also means we don't have to change
initialization entries based on the config options.
Signed-off-by: Eric Paris <eparis@redhat.com>
---
fs/notify/notification.c | 13 +------------
1 files changed, 1 insertions(+), 12 deletions(-)
diff --git a/fs/notify/notification.c b/fs/notify/notification.c
index 4ab9243..96ffbd0 100644
--- a/fs/notify/notification.c
+++ b/fs/notify/notification.c
@@ -311,25 +311,14 @@ void fsnotify_flush_notify(struct fsnotify_group *group)
static void initialize_event(struct fsnotify_event *event)
{
- event->holder.event = NULL;
INIT_LIST_HEAD(&event->holder.event_list);
atomic_set(&event->refcnt, 1);
spin_lock_init(&event->lock);
- event->path.dentry = NULL;
- event->path.mnt = NULL;
- event->inode = NULL;
event->data_type = FSNOTIFY_EVENT_NONE;
INIT_LIST_HEAD(&event->private_data_list);
-
- event->to_tell = NULL;
-
- event->file_name = NULL;
- event->name_len = 0;
-
- event->sync_cookie = 0;
}
/*
@@ -350,7 +339,7 @@ struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask,
{
struct fsnotify_event *event;
- event = kmem_cache_alloc(fsnotify_event_cachep, gfp);
+ event = kmem_cache_zalloc(fsnotify_event_cachep, gfp);
if (!event)
return NULL;
prev parent reply other threads:[~2009-08-09 22:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-09 21:59 [PATCH 1/5] fsnotify: use fsnotify_create_event to allocate the q_overflow event Eric Paris
2009-08-09 21:59 ` [PATCH 2/5] inotify: use ZERO_PAGE instead of private static declaration Eric Paris
2009-08-10 14:12 ` Eric Paris
2009-08-09 21:59 ` [PATCH 3/5] inotify: use container_of instead of casting Eric Paris
2009-08-09 21:59 ` [PATCH 4/5] fsnotify: kzalloc fsnotify groups Eric Paris
2009-08-09 21:59 ` Eric Paris [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090809215958.26204.11952.stgit@paris.rdu.redhat.com \
--to=eparis@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®