root/include/linux/locks.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. wait_on_buffer
  2. lock_buffer
  3. wait_on_super
  4. lock_super
  5. unlock_super

   1 #ifndef _LINUX_LOCKS_H
   2 #define _LINUX_LOCKS_H
   3 
   4 #ifndef _LINUX_MM_H
   5 #include <linux/mm.h>
   6 #endif
   7 #ifndef _LINUX_PAGEMAP_H
   8 #include <linux/pagemap.h>
   9 #endif
  10 
  11 /*
  12  * Unlocked, temporary IO buffer_heads gets moved to the reuse_list
  13  * once their page becomes unlocked.  
  14  */
  15 extern struct buffer_head *reuse_list;
  16 
  17 /*
  18  * Buffer cache locking - note that interrupts may only unlock, not
  19  * lock buffers.
  20  */
  21 extern void __wait_on_buffer(struct buffer_head *);
  22 
  23 extern inline void wait_on_buffer(struct buffer_head * bh)
     /* [previous][next][first][last][top][bottom][index][help] */
  24 {
  25         if (test_bit(BH_Lock, &bh->b_state))
  26                 __wait_on_buffer(bh);
  27 }
  28 
  29 extern inline void lock_buffer(struct buffer_head * bh)
     /* [previous][next][first][last][top][bottom][index][help] */
  30 {
  31         if (set_bit(BH_Lock, &bh->b_state))
  32                 __wait_on_buffer(bh);
  33 }
  34 
  35 void unlock_buffer(struct buffer_head *);
  36 
  37 
  38 /*
  39  * super-block locking. Again, interrupts may only unlock
  40  * a super-block (although even this isn't done right now.
  41  * nfs may need it).
  42  */
  43 extern void __wait_on_super(struct super_block *);
  44 
  45 extern inline void wait_on_super(struct super_block * sb)
     /* [previous][next][first][last][top][bottom][index][help] */
  46 {
  47         if (sb->s_lock)
  48                 __wait_on_super(sb);
  49 }
  50 
  51 extern inline void lock_super(struct super_block * sb)
     /* [previous][next][first][last][top][bottom][index][help] */
  52 {
  53         if (sb->s_lock)
  54                 __wait_on_super(sb);
  55         sb->s_lock = 1;
  56 }
  57 
  58 extern inline void unlock_super(struct super_block * sb)
     /* [previous][next][first][last][top][bottom][index][help] */
  59 {
  60         sb->s_lock = 0;
  61         wake_up(&sb->s_wait);
  62 }
  63 
  64 #endif /* _LINUX_LOCKS_H */
  65 

/* [previous][next][first][last][top][bottom][index][help] */