diff options
author | Ingo Molnar <mingo@elte.hu> | 2006-03-26 01:37:12 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-26 08:56:55 -0800 |
commit | 353ab6e97b8f209dbecc9f650f1f84e3da2a7bb1 (patch) | |
tree | bffabd9a5a493ffd2b41dd825e71e848ca6ba6d7 /fs/cramfs/inode.c | |
parent | e655a250d5fc12b6dfe0d436180ba4a3bfffdc9f (diff) | |
download | linux-353ab6e97b8f209dbecc9f650f1f84e3da2a7bb1.tar.bz2 |
[PATCH] sem2mutex: fs/
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>
Cc: Eric Van Hensbergen <ericvh@ericvh.myip.org>
Cc: Robert Love <rml@tech9.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/cramfs/inode.c')
-rw-r--r-- | fs/cramfs/inode.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index 8ad52f5bf255..acc1b2c10a86 100644 --- a/fs/cramfs/inode.c +++ b/fs/cramfs/inode.c @@ -22,6 +22,7 @@ #include <linux/cramfs_fs_sb.h> #include <linux/buffer_head.h> #include <linux/vfs.h> +#include <linux/mutex.h> #include <asm/semaphore.h> #include <asm/uaccess.h> @@ -31,7 +32,7 @@ static struct inode_operations cramfs_dir_inode_operations; static struct file_operations cramfs_directory_operations; static struct address_space_operations cramfs_aops; -static DECLARE_MUTEX(read_mutex); +static DEFINE_MUTEX(read_mutex); /* These two macros may change in future, to provide better st_ino @@ -250,20 +251,20 @@ static int cramfs_fill_super(struct super_block *sb, void *data, int silent) memset(sbi, 0, sizeof(struct cramfs_sb_info)); /* Invalidate the read buffers on mount: think disk change.. */ - down(&read_mutex); + mutex_lock(&read_mutex); for (i = 0; i < READ_BUFFERS; i++) buffer_blocknr[i] = -1; /* Read the first block and get the superblock from it */ memcpy(&super, cramfs_read(sb, 0, sizeof(super)), sizeof(super)); - up(&read_mutex); + mutex_unlock(&read_mutex); /* Do sanity checks on the superblock */ if (super.magic != CRAMFS_MAGIC) { /* check at 512 byte offset */ - down(&read_mutex); + mutex_lock(&read_mutex); memcpy(&super, cramfs_read(sb, 512, sizeof(super)), sizeof(super)); - up(&read_mutex); + mutex_unlock(&read_mutex); if (super.magic != CRAMFS_MAGIC) { if (!silent) printk(KERN_ERR "cramfs: wrong magic\n"); @@ -366,7 +367,7 @@ static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir) mode_t mode; int namelen, error; - down(&read_mutex); + mutex_lock(&read_mutex); de = cramfs_read(sb, OFFSET(inode) + offset, sizeof(*de)+256); name = (char *)(de+1); @@ -379,7 +380,7 @@ static int cramfs_readdir(struct file *filp, void *dirent, filldir_t filldir) memcpy(buf, name, namelen); ino = CRAMINO(de); mode = de->mode; - up(&read_mutex); + mutex_unlock(&read_mutex); nextoffset = offset + sizeof(*de) + namelen; for (;;) { if (!namelen) { @@ -410,7 +411,7 @@ static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry, s unsigned int offset = 0; int sorted; - down(&read_mutex); + mutex_lock(&read_mutex); sorted = CRAMFS_SB(dir->i_sb)->flags & CRAMFS_FLAG_SORTED_DIRS; while (offset < dir->i_size) { struct cramfs_inode *de; @@ -433,7 +434,7 @@ static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry, s for (;;) { if (!namelen) { - up(&read_mutex); + mutex_unlock(&read_mutex); return ERR_PTR(-EIO); } if (name[namelen-1]) @@ -447,7 +448,7 @@ static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry, s continue; if (!retval) { struct cramfs_inode entry = *de; - up(&read_mutex); + mutex_unlock(&read_mutex); d_add(dentry, get_cramfs_inode(dir->i_sb, &entry)); return NULL; } @@ -455,7 +456,7 @@ static struct dentry * cramfs_lookup(struct inode *dir, struct dentry *dentry, s if (sorted) break; } - up(&read_mutex); + mutex_unlock(&read_mutex); d_add(dentry, NULL); return NULL; } @@ -474,21 +475,21 @@ static int cramfs_readpage(struct file *file, struct page * page) u32 start_offset, compr_len; start_offset = OFFSET(inode) + maxblock*4; - down(&read_mutex); + mutex_lock(&read_mutex); if (page->index) start_offset = *(u32 *) cramfs_read(sb, blkptr_offset-4, 4); compr_len = (*(u32 *) cramfs_read(sb, blkptr_offset, 4) - start_offset); - up(&read_mutex); + mutex_unlock(&read_mutex); pgdata = kmap(page); if (compr_len == 0) ; /* hole */ else { - down(&read_mutex); + mutex_lock(&read_mutex); bytes_filled = cramfs_uncompress_block(pgdata, PAGE_CACHE_SIZE, cramfs_read(sb, start_offset, compr_len), compr_len); - up(&read_mutex); + mutex_unlock(&read_mutex); } } else pgdata = kmap(page); |