Merge branch 'master' of ssh://crater.dragonflybsd.org/repository/git/dragonfly
authorMichael Neumann <mneumann@ntecs.de>
Tue, 14 Jul 2009 14:01:40 +0000 (16:01 +0200)
committerMichael Neumann <mneumann@ntecs.de>
Tue, 14 Jul 2009 14:01:40 +0000 (16:01 +0200)
1  2 
sys/conf/files
sys/vfs/hammer/hammer.h

diff --combined sys/conf/files
@@@ -121,6 -121,8 +121,8 @@@ dev/disk/advansys/adw_pci.c                optional a
  dev/disk/advansys/adwcam.c            optional adw
  dev/disk/advansys/adwlib.c            optional adw
  dev/disk/advansys/adwmcode.c          optional adw
+ dev/netif/ae/if_ae.c                  optional ae
+ dev/netif/age/if_age.c                        optional age
  dev/netif/an/if_an.c                  optional an
  dev/netif/an/if_an_isa.c              optional an isa
  dev/netif/an/if_an_pci.c              optional an pci
@@@ -1380,7 -1382,6 +1382,7 @@@ vfs/userfs/userfs_elms.c        optional userf
  vfs/hammer/hammer_blockmap.c  optional hammer
  vfs/hammer/hammer_btree.c     optional hammer
  vfs/hammer/hammer_cursor.c    optional hammer
 +vfs/hammer/hammer_expand.c    optional hammer
  vfs/hammer/hammer_flusher.c   optional hammer
  vfs/hammer/hammer_freemap.c   optional hammer
  vfs/hammer/hammer_inode.c     optional hammer
diff --combined sys/vfs/hammer/hammer.h
@@@ -124,17 -124,24 +124,24 @@@ typedef struct hammer_transaction *hamm
   * HAMMER locks
   */
  struct hammer_lock {
-       int     refs;           /* active references delay writes */
-       int     lockcount;      /* lock count for exclusive/shared access */
-       int     wanted;
-       int     exwanted;       /* number of threads waiting for ex lock */
-       struct thread *locktd;
+       int             refs;           /* active references delay writes */
+       volatile u_int  lockval;        /* lock count and control bits */
+       struct thread   *owner;         /* owner if exclusively held */
  };
  
+ #define HAMMER_LOCKF_EXCLUSIVE        0x40000000
+ #define HAMMER_LOCKF_WANTED   0x80000000
+ static __inline int
+ hammer_notlocked(struct hammer_lock *lock)
+ {
+       return(lock->lockval == 0);
+ }
  static __inline int
  hammer_islocked(struct hammer_lock *lock)
  {
-       return(lock->lockcount != 0);
+       return(lock->lockval != 0);
  }
  
  static __inline int
@@@ -155,8 -162,10 +162,10 @@@ hammer_islastref(struct hammer_lock *lo
  static __inline int
  hammer_lock_excl_owned(struct hammer_lock *lock, thread_t td)
  {
-       if (lock->lockcount > 0 && lock->locktd == td)
+       if ((lock->lockval & HAMMER_LOCKF_EXCLUSIVE) &&
+           lock->owner == td) {
                return(1);
+       }
        return(0);
  }
  
@@@ -1209,8 -1218,6 +1218,8 @@@ int hammer_ioc_upgrade_pseudofs(hammer_
                          struct hammer_ioc_pseudofs_rw *pfs);
  int hammer_ioc_wait_pseudofs(hammer_transaction_t trans, hammer_inode_t ip,
                          struct hammer_ioc_pseudofs_rw *pfs);
 +int hammer_ioc_expand(hammer_transaction_t trans, hammer_inode_t ip,
 +                        struct hammer_ioc_expand *expand);
  
  int hammer_signal_check(hammer_mount_t hmp);