|
Lines 25-30
Link Here
|
| 25 |
#include <linux/fsnotify.h> |
25 |
#include <linux/fsnotify.h> |
| 26 |
#include <linux/mount.h> |
26 |
#include <linux/mount.h> |
| 27 |
#include <linux/async.h> |
27 |
#include <linux/async.h> |
|
|
28 |
#include <linux/rwsem.h> |
| 28 |
|
29 |
|
| 29 |
/* |
30 |
/* |
| 30 |
* This is needed for the following functions: |
31 |
* This is needed for the following functions: |
|
Lines 93-99
DEFINE_SPINLOCK(inode_lock);
Link Here
|
| 93 |
* from its final dispose_list, the struct super_block they refer to |
94 |
* from its final dispose_list, the struct super_block they refer to |
| 94 |
* (for inode->i_sb->s_op) may already have been freed and reused. |
95 |
* (for inode->i_sb->s_op) may already have been freed and reused. |
| 95 |
*/ |
96 |
*/ |
| 96 |
static DEFINE_MUTEX(iprune_mutex); |
97 |
static DECLARE_RWSEM(iprune_sem); |
| 97 |
|
98 |
|
| 98 |
/* |
99 |
/* |
| 99 |
* Statistics gathering.. |
100 |
* Statistics gathering.. |
|
Lines 365-371
static int invalidate_list(struct list_h
Link Here
|
| 365 |
/* |
366 |
/* |
| 366 |
* We can reschedule here without worrying about the list's |
367 |
* We can reschedule here without worrying about the list's |
| 367 |
* consistency because the per-sb list of inodes must not |
368 |
* consistency because the per-sb list of inodes must not |
| 368 |
* change during umount anymore, and because iprune_mutex keeps |
369 |
* change during umount anymore, and because iprune_sem keeps |
| 369 |
* shrink_icache_memory() away. |
370 |
* shrink_icache_memory() away. |
| 370 |
*/ |
371 |
*/ |
| 371 |
cond_resched_lock(&inode_lock); |
372 |
cond_resched_lock(&inode_lock); |
|
Lines 404-410
int invalidate_inodes(struct super_block
Link Here
|
| 404 |
int busy; |
405 |
int busy; |
| 405 |
LIST_HEAD(throw_away); |
406 |
LIST_HEAD(throw_away); |
| 406 |
|
407 |
|
| 407 |
mutex_lock(&iprune_mutex); |
408 |
down_write(&iprune_sem); |
| 408 |
spin_lock(&inode_lock); |
409 |
spin_lock(&inode_lock); |
| 409 |
inotify_unmount_inodes(&sb->s_inodes); |
410 |
inotify_unmount_inodes(&sb->s_inodes); |
| 410 |
fsnotify_unmount_inodes(&sb->s_inodes); |
411 |
fsnotify_unmount_inodes(&sb->s_inodes); |
|
Lines 412-418
int invalidate_inodes(struct super_block
Link Here
|
| 412 |
spin_unlock(&inode_lock); |
413 |
spin_unlock(&inode_lock); |
| 413 |
|
414 |
|
| 414 |
dispose_list(&throw_away); |
415 |
dispose_list(&throw_away); |
| 415 |
mutex_unlock(&iprune_mutex); |
416 |
up_write(&iprune_sem); |
| 416 |
|
417 |
|
| 417 |
return busy; |
418 |
return busy; |
| 418 |
} |
419 |
} |
|
Lines 451-457
static void prune_icache(int nr_to_scan)
Link Here
|
| 451 |
int nr_scanned; |
452 |
int nr_scanned; |
| 452 |
unsigned long reap = 0; |
453 |
unsigned long reap = 0; |
| 453 |
|
454 |
|
| 454 |
mutex_lock(&iprune_mutex); |
455 |
down_read(&iprune_sem); |
| 455 |
spin_lock(&inode_lock); |
456 |
spin_lock(&inode_lock); |
| 456 |
for (nr_scanned = 0; nr_scanned < nr_to_scan; nr_scanned++) { |
457 |
for (nr_scanned = 0; nr_scanned < nr_to_scan; nr_scanned++) { |
| 457 |
struct inode *inode; |
458 |
struct inode *inode; |
|
Lines 493-499
static void prune_icache(int nr_to_scan)
Link Here
|
| 493 |
spin_unlock(&inode_lock); |
494 |
spin_unlock(&inode_lock); |
| 494 |
|
495 |
|
| 495 |
dispose_list(&freeable); |
496 |
dispose_list(&freeable); |
| 496 |
mutex_unlock(&iprune_mutex); |
497 |
up_read(&iprune_sem); |
| 497 |
} |
498 |
} |
| 498 |
|
499 |
|
| 499 |
/* |
500 |
/* |