From 0447dad04ab82a25db9fb3c8611fad0510347f97 Mon Sep 17 00:00:00 2001 From: Paul Gortmaker Date: Sun, 16 Jan 2011 20:07:06 -0500 Subject: [PATCH] affs: convert from semaphore to mutex This is one of several extractions from the merge up to 33-rc8. You can find the origin of this change in the tip merge commit: commit 5f854cfc024622e4aae14d7cf422f6ff86278688 Merge: cc24da0 4ec62b2 Author: Thomas Gleixner Date: Sun Feb 21 20:17:22 2010 +0100 Forward to 2.6.33-rc8 Merge branch 'linus' into rt/head with a pile of conflicts. Signed-off-by: Thomas Gleixner Normally there are not significant changes/additions in a merge commit that are not from any other "normal" commit. But in this case there are, so break them out into separate explicit commits. Signed-off-by: Paul Gortmaker --- fs/affs/affs.h | 26 +++++++++----------------- fs/affs/super.c | 4 ++-- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/fs/affs/affs.h b/fs/affs/affs.h index 861dae6..6abe86f 100644 --- a/fs/affs/affs.h +++ b/fs/affs/affs.h @@ -50,9 +50,8 @@ struct affs_ext_key { */ struct affs_inode_info { atomic_t i_opencnt; - struct semaphore i_link_lock; /* Protects internal inode access. */ - struct semaphore i_ext_lock; /* Protects internal inode access. */ -#define i_hash_lock i_ext_lock + struct mutex i_link_lock; /* Protects internal inode access. */ + struct mutex i_ext_lock; /* Protects internal inode access. */ u32 i_blkcnt; /* block count */ u32 i_extcnt; /* extended block count */ u32 *i_lc; /* linear cache of extended blocks */ @@ -276,30 +275,23 @@ affs_adjust_bitmapchecksum(struct buffer_head *bh, u32 val) static inline void affs_lock_link(struct inode *inode) { - down(&AFFS_I(inode)->i_link_lock); + mutex_lock(&AFFS_I(inode)->i_link_lock); } static inline void affs_unlock_link(struct inode *inode) { - up(&AFFS_I(inode)->i_link_lock); -} -static inline void -affs_lock_dir(struct inode *inode) -{ - down(&AFFS_I(inode)->i_hash_lock); -} -static inline void -affs_unlock_dir(struct inode *inode) -{ - up(&AFFS_I(inode)->i_hash_lock); + mutex_unlock(&AFFS_I(inode)->i_link_lock); } static inline void affs_lock_ext(struct inode *inode) { - down(&AFFS_I(inode)->i_ext_lock); + mutex_lock(&AFFS_I(inode)->i_ext_lock); } static inline void affs_unlock_ext(struct inode *inode) { - up(&AFFS_I(inode)->i_ext_lock); + mutex_unlock(&AFFS_I(inode)->i_ext_lock); } + +#define affs_lock_dir(i) affs_lock_ext(i) +#define affs_unlock_dir(i) affs_unlock_ext(i) diff --git a/fs/affs/super.c b/fs/affs/super.c index 51e326f..8ada98f 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c @@ -114,8 +114,8 @@ static void init_once(void *foo) { struct affs_inode_info *ei = (struct affs_inode_info *) foo; - semaphore_init(&ei->i_link_lock); - semaphore_init(&ei->i_ext_lock); + mutex_init(&ei->i_link_lock); + mutex_init(&ei->i_ext_lock); inode_init_once(&ei->vfs_inode); } -- 1.7.0.4