Commit f24075bd0c1cd1cc2cf86d394f960aa0401de573

Authored by Ingo Molnar
Committed by Linus Torvalds
1 parent a11f3a0574

[PATCH] sem2mutex: iprune

Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 3 changed files with 12 additions and 12 deletions Side-by-side Diff

... ... @@ -84,14 +84,14 @@
84 84 DEFINE_SPINLOCK(inode_lock);
85 85  
86 86 /*
87   - * iprune_sem provides exclusion between the kswapd or try_to_free_pages
  87 + * iprune_mutex provides exclusion between the kswapd or try_to_free_pages
88 88 * icache shrinking path, and the umount path. Without this exclusion,
89 89 * by the time prune_icache calls iput for the inode whose pages it has
90 90 * been invalidating, or by the time it calls clear_inode & destroy_inode
91 91 * from its final dispose_list, the struct super_block they refer to
92 92 * (for inode->i_sb->s_op) may already have been freed and reused.
93 93 */
94   -DECLARE_MUTEX(iprune_sem);
  94 +DEFINE_MUTEX(iprune_mutex);
95 95  
96 96 /*
97 97 * Statistics gathering..
... ... @@ -319,7 +319,7 @@
319 319 /*
320 320 * We can reschedule here without worrying about the list's
321 321 * consistency because the per-sb list of inodes must not
322   - * change during umount anymore, and because iprune_sem keeps
  322 + * change during umount anymore, and because iprune_mutex keeps
323 323 * shrink_icache_memory() away.
324 324 */
325 325 cond_resched_lock(&inode_lock);
326 326  
... ... @@ -355,14 +355,14 @@
355 355 int busy;
356 356 LIST_HEAD(throw_away);
357 357  
358   - down(&iprune_sem);
  358 + mutex_lock(&iprune_mutex);
359 359 spin_lock(&inode_lock);
360 360 inotify_unmount_inodes(&sb->s_inodes);
361 361 busy = invalidate_list(&sb->s_inodes, &throw_away);
362 362 spin_unlock(&inode_lock);
363 363  
364 364 dispose_list(&throw_away);
365   - up(&iprune_sem);
  365 + mutex_unlock(&iprune_mutex);
366 366  
367 367 return busy;
368 368 }
... ... @@ -377,7 +377,7 @@
377 377 if (sb) {
378 378 /*
379 379 * no need to lock the super, get_super holds the
380   - * read semaphore so the filesystem cannot go away
  380 + * read mutex so the filesystem cannot go away
381 381 * under us (->put_super runs with the write lock
382 382 * hold).
383 383 */
... ... @@ -423,7 +423,7 @@
423 423 int nr_scanned;
424 424 unsigned long reap = 0;
425 425  
426   - down(&iprune_sem);
  426 + mutex_lock(&iprune_mutex);
427 427 spin_lock(&inode_lock);
428 428 for (nr_scanned = 0; nr_scanned < nr_to_scan; nr_scanned++) {
429 429 struct inode *inode;
... ... @@ -459,7 +459,7 @@
459 459 spin_unlock(&inode_lock);
460 460  
461 461 dispose_list(&freeable);
462   - up(&iprune_sem);
  462 + mutex_unlock(&iprune_mutex);
463 463  
464 464 if (current_is_kswapd())
465 465 mod_page_state(kswapd_inodesteal, reap);
... ... @@ -54,7 +54,7 @@
54 54 * Lock ordering:
55 55 *
56 56 * dentry->d_lock (used to keep d_move() away from dentry->d_parent)
57   - * iprune_sem (synchronize shrink_icache_memory())
  57 + * iprune_mutex (synchronize shrink_icache_memory())
58 58 * inode_lock (protects the super_block->s_inodes list)
59 59 * inode->inotify_mutex (protects inode->inotify_watches and watches->i_list)
60 60 * inotify_dev->mutex (protects inotify_device and watches->d_list)
... ... @@ -569,7 +569,7 @@
569 569 * @list: list of inodes being unmounted (sb->s_inodes)
570 570 *
571 571 * Called with inode_lock held, protecting the unmounting super block's list
572   - * of inodes, and with iprune_sem held, keeping shrink_icache_memory() at bay.
  572 + * of inodes, and with iprune_mutex held, keeping shrink_icache_memory() at bay.
573 573 * We temporarily drop inode_lock, however, and CAN block.
574 574 */
575 575 void inotify_unmount_inodes(struct list_head *list)
... ... @@ -618,7 +618,7 @@
618 618 * We can safely drop inode_lock here because we hold
619 619 * references on both inode and next_i. Also no new inodes
620 620 * will be added since the umount has begun. Finally,
621   - * iprune_sem keeps shrink_icache_memory() away.
  621 + * iprune_mutex keeps shrink_icache_memory() away.
622 622 */
623 623 spin_unlock(&inode_lock);
624 624  
... ... @@ -1534,7 +1534,7 @@
1534 1534 extern struct inode *new_inode(struct super_block *);
1535 1535 extern int remove_suid(struct dentry *);
1536 1536 extern void remove_dquot_ref(struct super_block *, int, struct list_head *);
1537   -extern struct semaphore iprune_sem;
  1537 +extern struct mutex iprune_mutex;
1538 1538  
1539 1539 extern void __insert_inode_hash(struct inode *, unsigned long hashval);
1540 1540 extern void remove_inode_hash(struct inode *);