diff options
author | Eric Paris <eparis@redhat.com> | 2010-07-28 10:18:38 -0400 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2010-07-28 10:18:53 -0400 |
commit | c496313fcc35a41e176e3f19cdda2544ea3a32a6 (patch) | |
tree | 442a90a3a2ac7b7106c3e7ba0583735b17f7153d /fs/notify/dnotify/dnotify.c | |
parent | 7f6b6117e1803777fcf48fe31bd236a7fbf740db (diff) |
dnotify: use the mark in handler functions
dnotify now gets a mark in the should_send_event and handle_event
functions. Rather than look up the mark themselves dnotify should just use
the mark it was handed.
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'fs/notify/dnotify/dnotify.c')
-rw-r--r-- | fs/notify/dnotify/dnotify.c | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c index 2cae9be120db..e3e855ff0dd8 100644 --- a/fs/notify/dnotify/dnotify.c +++ b/fs/notify/dnotify/dnotify.c | |||
@@ -86,7 +86,6 @@ static int dnotify_handle_event(struct fsnotify_group *group, | |||
86 | struct fsnotify_mark *mark, | 86 | struct fsnotify_mark *mark, |
87 | struct fsnotify_event *event) | 87 | struct fsnotify_event *event) |
88 | { | 88 | { |
89 | struct fsnotify_mark *fsn_mark = NULL; | ||
90 | struct dnotify_mark *dn_mark; | 89 | struct dnotify_mark *dn_mark; |
91 | struct inode *to_tell; | 90 | struct inode *to_tell; |
92 | struct dnotify_struct *dn; | 91 | struct dnotify_struct *dn; |
@@ -96,12 +95,9 @@ static int dnotify_handle_event(struct fsnotify_group *group, | |||
96 | 95 | ||
97 | to_tell = event->to_tell; | 96 | to_tell = event->to_tell; |
98 | 97 | ||
99 | fsn_mark = fsnotify_find_inode_mark(group, to_tell); | 98 | dn_mark = container_of(mark, struct dnotify_mark, fsn_mark); |
100 | if (unlikely(!fsn_mark)) | ||
101 | return 0; | ||
102 | dn_mark = container_of(fsn_mark, struct dnotify_mark, fsn_mark); | ||
103 | 99 | ||
104 | spin_lock(&fsn_mark->lock); | 100 | spin_lock(&mark->lock); |
105 | prev = &dn_mark->dn; | 101 | prev = &dn_mark->dn; |
106 | while ((dn = *prev) != NULL) { | 102 | while ((dn = *prev) != NULL) { |
107 | if ((dn->dn_mask & test_mask) == 0) { | 103 | if ((dn->dn_mask & test_mask) == 0) { |
@@ -115,12 +111,11 @@ static int dnotify_handle_event(struct fsnotify_group *group, | |||
115 | else { | 111 | else { |
116 | *prev = dn->dn_next; | 112 | *prev = dn->dn_next; |
117 | kmem_cache_free(dnotify_struct_cache, dn); | 113 | kmem_cache_free(dnotify_struct_cache, dn); |
118 | dnotify_recalc_inode_mask(fsn_mark); | 114 | dnotify_recalc_inode_mask(mark); |
119 | } | 115 | } |
120 | } | 116 | } |
121 | 117 | ||
122 | spin_unlock(&fsn_mark->lock); | 118 | spin_unlock(&mark->lock); |
123 | fsnotify_put_mark(fsn_mark); | ||
124 | 119 | ||
125 | return 0; | 120 | return 0; |
126 | } | 121 | } |
@@ -134,7 +129,6 @@ static bool dnotify_should_send_event(struct fsnotify_group *group, | |||
134 | struct fsnotify_mark *mark, __u32 mask, | 129 | struct fsnotify_mark *mark, __u32 mask, |
135 | void *data, int data_type) | 130 | void *data, int data_type) |
136 | { | 131 | { |
137 | struct fsnotify_mark *fsn_mark; | ||
138 | bool send; | 132 | bool send; |
139 | 133 | ||
140 | /* !dir_notify_enable should never get here, don't waste time checking | 134 | /* !dir_notify_enable should never get here, don't waste time checking |
@@ -145,14 +139,8 @@ static bool dnotify_should_send_event(struct fsnotify_group *group, | |||
145 | if (!S_ISDIR(inode->i_mode)) | 139 | if (!S_ISDIR(inode->i_mode)) |
146 | return false; | 140 | return false; |
147 | 141 | ||
148 | fsn_mark = fsnotify_find_inode_mark(group, inode); | ||
149 | if (!fsn_mark) | ||
150 | return false; | ||
151 | |||
152 | mask = (mask & ~FS_EVENT_ON_CHILD); | 142 | mask = (mask & ~FS_EVENT_ON_CHILD); |
153 | send = (mask & fsn_mark->mask); | 143 | send = (mask & mark->mask); |
154 | |||
155 | fsnotify_put_mark(fsn_mark); /* matches fsnotify_find_inode_mark */ | ||
156 | 144 | ||
157 | return send; | 145 | return send; |
158 | } | 146 | } |