aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2010-07-28 10:18:37 -0400
committerEric Paris <eparis@redhat.com>2010-07-28 10:18:50 -0400
commit5ba08e2eeb06355f66ed62ae97bb87d145973a9a (patch)
tree4d0b26a125c8805234e0ebb58101bf1c5a75e61e
parent80af2588676483ac4e998b5092e9d008dab3ab62 (diff)
fsnotify: add pr_debug throughout
It can be hard to debug fsnotify since there are so few printks. Use pr_debug to allow for dynamic debugging. Signed-off-by: Eric Paris <eparis@redhat.com>
-rw-r--r--fs/notify/fsnotify.c4
-rw-r--r--fs/notify/inotify/inotify_fsnotify.c6
-rw-r--r--fs/notify/inotify/inotify_user.c10
-rw-r--r--fs/notify/notification.c13
4 files changed, 33 insertions, 0 deletions
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index 076c10e959d5..72aae4045314 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -174,6 +174,10 @@ static int send_to_group(struct fsnotify_group *group, struct inode *to_tell,
174 int data_is, u32 cookie, const unsigned char *file_name, 174 int data_is, u32 cookie, const unsigned char *file_name,
175 struct fsnotify_event **event) 175 struct fsnotify_event **event)
176{ 176{
177 pr_debug("%s: group=%p to_tell=%p mnt=%p mask=%x data=%p data_is=%d"
178 " cookie=%d event=%p\n", __func__, group, to_tell, mnt,
179 mask, data, data_is, cookie, *event);
180
177 if (!group->ops->should_send_event(group, to_tell, mnt, mask, 181 if (!group->ops->should_send_event(group, to_tell, mnt, mask,
178 data, data_is)) 182 data, data_is))
179 return 0; 183 return 0;
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
index 9d332e7f5a5c..906b72761b17 100644
--- a/fs/notify/inotify/inotify_fsnotify.c
+++ b/fs/notify/inotify/inotify_fsnotify.c
@@ -98,6 +98,9 @@ static int inotify_handle_event(struct fsnotify_group *group, struct fsnotify_ev
98 struct fsnotify_event_private_data *fsn_event_priv; 98 struct fsnotify_event_private_data *fsn_event_priv;
99 int wd, ret; 99 int wd, ret;
100 100
101 pr_debug("%s: group=%p event=%p to_tell=%p mask=%x\n", __func__, group,
102 event, event->to_tell, event->mask);
103
101 to_tell = event->to_tell; 104 to_tell = event->to_tell;
102 105
103 fsn_mark = fsnotify_find_inode_mark(group, to_tell); 106 fsn_mark = fsnotify_find_inode_mark(group, to_tell);
@@ -151,6 +154,9 @@ static bool inotify_should_send_event(struct fsnotify_group *group, struct inode
151 struct fsnotify_mark *fsn_mark; 154 struct fsnotify_mark *fsn_mark;
152 bool send; 155 bool send;
153 156
157 pr_debug("%s: group=%p inode=%p mask=%x data=%p data_type=%d\n",
158 __func__, group, inode, mask, data, data_type);
159
154 fsn_mark = fsnotify_find_inode_mark(group, inode); 160 fsn_mark = fsnotify_find_inode_mark(group, inode);
155 if (!fsn_mark) 161 if (!fsn_mark)
156 return false; 162 return false;
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 7dc940c869b6..1068e1ca9cb0 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -141,6 +141,8 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
141 141
142 event = fsnotify_peek_notify_event(group); 142 event = fsnotify_peek_notify_event(group);
143 143
144 pr_debug("%s: group=%p event=%p\n", __func__, group, event);
145
144 if (event->name_len) 146 if (event->name_len)
145 event_size += roundup(event->name_len + 1, event_size); 147 event_size += roundup(event->name_len + 1, event_size);
146 148
@@ -170,6 +172,8 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
170 size_t event_size = sizeof(struct inotify_event); 172 size_t event_size = sizeof(struct inotify_event);
171 size_t name_len = 0; 173 size_t name_len = 0;
172 174
175 pr_debug("%s: group=%p event=%p\n", __func__, group, event);
176
173 /* we get the inotify watch descriptor from the event private data */ 177 /* we get the inotify watch descriptor from the event private data */
174 spin_lock(&event->lock); 178 spin_lock(&event->lock);
175 fsn_priv = fsnotify_remove_priv_from_event(group, event); 179 fsn_priv = fsnotify_remove_priv_from_event(group, event);
@@ -242,6 +246,8 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
242 kevent = get_one_event(group, count); 246 kevent = get_one_event(group, count);
243 mutex_unlock(&group->notification_mutex); 247 mutex_unlock(&group->notification_mutex);
244 248
249 pr_debug("%s: group=%p kevent=%p\n", __func__, group, kevent);
250
245 if (kevent) { 251 if (kevent) {
246 ret = PTR_ERR(kevent); 252 ret = PTR_ERR(kevent);
247 if (IS_ERR(kevent)) 253 if (IS_ERR(kevent))
@@ -286,6 +292,8 @@ static int inotify_release(struct inode *ignored, struct file *file)
286 struct fsnotify_group *group = file->private_data; 292 struct fsnotify_group *group = file->private_data;
287 struct user_struct *user = group->inotify_data.user; 293 struct user_struct *user = group->inotify_data.user;
288 294
295 pr_debug("%s: group=%p\n", __func__, group);
296
289 fsnotify_clear_marks_by_group(group); 297 fsnotify_clear_marks_by_group(group);
290 298
291 /* free this group, matching get was inotify_init->fsnotify_obtain_group */ 299 /* free this group, matching get was inotify_init->fsnotify_obtain_group */
@@ -309,6 +317,8 @@ static long inotify_ioctl(struct file *file, unsigned int cmd,
309 group = file->private_data; 317 group = file->private_data;
310 p = (void __user *) arg; 318 p = (void __user *) arg;
311 319
320 pr_debug("%s: group=%p cmd=%u\n", __func__, group, cmd);
321
312 switch (cmd) { 322 switch (cmd) {
313 case FIONREAD: 323 case FIONREAD:
314 mutex_lock(&group->notification_mutex); 324 mutex_lock(&group->notification_mutex);
diff --git a/fs/notify/notification.c b/fs/notify/notification.c
index b35faafacd38..e6dde25fb99b 100644
--- a/fs/notify/notification.c
+++ b/fs/notify/notification.c
@@ -87,6 +87,8 @@ void fsnotify_put_event(struct fsnotify_event *event)
87 return; 87 return;
88 88
89 if (atomic_dec_and_test(&event->refcnt)) { 89 if (atomic_dec_and_test(&event->refcnt)) {
90 pr_debug("%s: event=%p\n", __func__, event);
91
90 if (event->data_type == FSNOTIFY_EVENT_PATH) 92 if (event->data_type == FSNOTIFY_EVENT_PATH)
91 path_put(&event->path); 93 path_put(&event->path);
92 94
@@ -146,6 +148,8 @@ int fsnotify_add_notify_event(struct fsnotify_group *group, struct fsnotify_even
146 struct list_head *list = &group->notification_list; 148 struct list_head *list = &group->notification_list;
147 int rc = 0; 149 int rc = 0;
148 150
151 pr_debug("%s: group=%p event=%p priv=%p\n", __func__, group, event, priv);
152
149 /* 153 /*
150 * There is one fsnotify_event_holder embedded inside each fsnotify_event. 154 * There is one fsnotify_event_holder embedded inside each fsnotify_event.
151 * Check if we expect to be able to use that holder. If not alloc a new 155 * Check if we expect to be able to use that holder. If not alloc a new
@@ -222,6 +226,8 @@ struct fsnotify_event *fsnotify_remove_notify_event(struct fsnotify_group *group
222 226
223 BUG_ON(!mutex_is_locked(&group->notification_mutex)); 227 BUG_ON(!mutex_is_locked(&group->notification_mutex));
224 228
229 pr_debug("%s: group=%p\n", __func__, group);
230
225 holder = list_first_entry(&group->notification_list, struct fsnotify_event_holder, event_list); 231 holder = list_first_entry(&group->notification_list, struct fsnotify_event_holder, event_list);
226 232
227 event = holder->event; 233 event = holder->event;
@@ -307,6 +313,8 @@ int fsnotify_replace_event(struct fsnotify_event_holder *old_holder,
307 SPINLOCK_NEW, 313 SPINLOCK_NEW,
308 }; 314 };
309 315
316 pr_debug("%s: old_event=%p new_event=%p\n", __func__, old_event, new_event);
317
310 /* 318 /*
311 * if the new_event's embedded holder is in use someone 319 * if the new_event's embedded holder is in use someone
312 * screwed up and didn't give us a clean new event. 320 * screwed up and didn't give us a clean new event.
@@ -340,6 +348,8 @@ struct fsnotify_event *fsnotify_clone_event(struct fsnotify_event *old_event)
340 if (!event) 348 if (!event)
341 return NULL; 349 return NULL;
342 350
351 pr_debug("%s: old_event=%p new_event=%p\n", __func__, old_event, event);
352
343 memcpy(event, old_event, sizeof(*event)); 353 memcpy(event, old_event, sizeof(*event));
344 initialize_event(event); 354 initialize_event(event);
345 355
@@ -379,6 +389,9 @@ struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask,
379 if (!event) 389 if (!event)
380 return NULL; 390 return NULL;
381 391
392 pr_debug("%s: event=%p to_tell=%p mask=%x data=%p data_type=%d\n",
393 __func__, event, to_tell, mask, data, data_type);
394
382 initialize_event(event); 395 initialize_event(event);
383 396
384 if (name) { 397 if (name) {