aboutsummaryrefslogtreecommitdiffstats
path: root/fs/notify/mark.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-12-21 18:06:12 +0100
committerJan Kara <jack@suse.cz>2017-04-10 17:37:36 +0200
commit054c636e5c8054884ede889be82ce059879945e6 (patch)
tree0559d887ce9f1bd9ba0e594b0fc876d597327bc1 /fs/notify/mark.c
parentfsnotify: Add group pointer in fsnotify_init_mark() (diff)
downloadlinux-dev-054c636e5c8054884ede889be82ce059879945e6.tar.xz
linux-dev-054c636e5c8054884ede889be82ce059879945e6.zip
fsnotify: Move ->free_mark callback to fsnotify_ops
Pointer to ->free_mark callback unnecessarily occupies one long in each fsnotify_mark although they are the same for all marks from one notification group. Move the callback pointer to fsnotify_ops. Reviewed-by: Miklos Szeredi <mszeredi@redhat.com> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/notify/mark.c')
-rw-r--r--fs/notify/mark.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/notify/mark.c b/fs/notify/mark.c
index 2f743e2035e4..55955ded338d 100644
--- a/fs/notify/mark.c
+++ b/fs/notify/mark.c
@@ -195,9 +195,12 @@ static struct inode *fsnotify_detach_connector_from_object(
static void fsnotify_final_mark_destroy(struct fsnotify_mark *mark)
{
- if (mark->group)
- fsnotify_put_group(mark->group);
- mark->free_mark(mark);
+ struct fsnotify_group *group = mark->group;
+
+ if (WARN_ON_ONCE(!group))
+ return;
+ group->ops->free_mark(mark);
+ fsnotify_put_group(group);
}
void fsnotify_put_mark(struct fsnotify_mark *mark)
@@ -732,13 +735,11 @@ void fsnotify_destroy_marks(struct fsnotify_mark_connector __rcu **connp)
* Nothing fancy, just initialize lists and locks and counters.
*/
void fsnotify_init_mark(struct fsnotify_mark *mark,
- struct fsnotify_group *group,
- void (*free_mark)(struct fsnotify_mark *mark))
+ struct fsnotify_group *group)
{
memset(mark, 0, sizeof(*mark));
spin_lock_init(&mark->lock);
atomic_set(&mark->refcnt, 1);
- mark->free_mark = free_mark;
fsnotify_get_group(group);
mark->group = group;
}