Commit 1e7933de authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds

[PATCH] sem2mutex: UDF

Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8e3f9045
...@@ -152,7 +152,7 @@ static void udf_bitmap_free_blocks(struct super_block * sb, ...@@ -152,7 +152,7 @@ static void udf_bitmap_free_blocks(struct super_block * sb,
int bitmap_nr; int bitmap_nr;
unsigned long overflow; unsigned long overflow;
down(&sbi->s_alloc_sem); mutex_lock(&sbi->s_alloc_mutex);
if (bloc.logicalBlockNum < 0 || if (bloc.logicalBlockNum < 0 ||
(bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum)) (bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum))
{ {
...@@ -211,7 +211,7 @@ error_return: ...@@ -211,7 +211,7 @@ error_return:
sb->s_dirt = 1; sb->s_dirt = 1;
if (UDF_SB_LVIDBH(sb)) if (UDF_SB_LVIDBH(sb))
mark_buffer_dirty(UDF_SB_LVIDBH(sb)); mark_buffer_dirty(UDF_SB_LVIDBH(sb));
up(&sbi->s_alloc_sem); mutex_unlock(&sbi->s_alloc_mutex);
return; return;
} }
...@@ -226,7 +226,7 @@ static int udf_bitmap_prealloc_blocks(struct super_block * sb, ...@@ -226,7 +226,7 @@ static int udf_bitmap_prealloc_blocks(struct super_block * sb,
int nr_groups, bitmap_nr; int nr_groups, bitmap_nr;
struct buffer_head *bh; struct buffer_head *bh;
down(&sbi->s_alloc_sem); mutex_lock(&sbi->s_alloc_mutex);
if (first_block < 0 || first_block >= UDF_SB_PARTLEN(sb, partition)) if (first_block < 0 || first_block >= UDF_SB_PARTLEN(sb, partition))
goto out; goto out;
...@@ -275,7 +275,7 @@ out: ...@@ -275,7 +275,7 @@ out:
mark_buffer_dirty(UDF_SB_LVIDBH(sb)); mark_buffer_dirty(UDF_SB_LVIDBH(sb));
} }
sb->s_dirt = 1; sb->s_dirt = 1;
up(&sbi->s_alloc_sem); mutex_unlock(&sbi->s_alloc_mutex);
return alloc_count; return alloc_count;
} }
...@@ -291,7 +291,7 @@ static int udf_bitmap_new_block(struct super_block * sb, ...@@ -291,7 +291,7 @@ static int udf_bitmap_new_block(struct super_block * sb,
int newblock = 0; int newblock = 0;
*err = -ENOSPC; *err = -ENOSPC;
down(&sbi->s_alloc_sem); mutex_lock(&sbi->s_alloc_mutex);
repeat: repeat:
if (goal < 0 || goal >= UDF_SB_PARTLEN(sb, partition)) if (goal < 0 || goal >= UDF_SB_PARTLEN(sb, partition))
...@@ -364,7 +364,7 @@ repeat: ...@@ -364,7 +364,7 @@ repeat:
} }
if (i >= (nr_groups*2)) if (i >= (nr_groups*2))
{ {
up(&sbi->s_alloc_sem); mutex_unlock(&sbi->s_alloc_mutex);
return newblock; return newblock;
} }
if (bit < sb->s_blocksize << 3) if (bit < sb->s_blocksize << 3)
...@@ -373,7 +373,7 @@ repeat: ...@@ -373,7 +373,7 @@ repeat:
bit = udf_find_next_one_bit(bh->b_data, sb->s_blocksize << 3, group_start << 3); bit = udf_find_next_one_bit(bh->b_data, sb->s_blocksize << 3, group_start << 3);
if (bit >= sb->s_blocksize << 3) if (bit >= sb->s_blocksize << 3)
{ {
up(&sbi->s_alloc_sem); mutex_unlock(&sbi->s_alloc_mutex);
return 0; return 0;
} }
...@@ -387,7 +387,7 @@ got_block: ...@@ -387,7 +387,7 @@ got_block:
*/ */
if (inode && DQUOT_ALLOC_BLOCK(inode, 1)) if (inode && DQUOT_ALLOC_BLOCK(inode, 1))
{ {
up(&sbi->s_alloc_sem); mutex_unlock(&sbi->s_alloc_mutex);
*err = -EDQUOT; *err = -EDQUOT;
return 0; return 0;
} }
...@@ -410,13 +410,13 @@ got_block: ...@@ -410,13 +410,13 @@ got_block:
mark_buffer_dirty(UDF_SB_LVIDBH(sb)); mark_buffer_dirty(UDF_SB_LVIDBH(sb));
} }
sb->s_dirt = 1; sb->s_dirt = 1;
up(&sbi->s_alloc_sem); mutex_unlock(&sbi->s_alloc_mutex);
*err = 0; *err = 0;
return newblock; return newblock;
error_return: error_return:
*err = -EIO; *err = -EIO;
up(&sbi->s_alloc_sem); mutex_unlock(&sbi->s_alloc_mutex);
return 0; return 0;
} }
...@@ -433,7 +433,7 @@ static void udf_table_free_blocks(struct super_block * sb, ...@@ -433,7 +433,7 @@ static void udf_table_free_blocks(struct super_block * sb,
int8_t etype; int8_t etype;
int i; int i;
down(&sbi->s_alloc_sem); mutex_lock(&sbi->s_alloc_mutex);
if (bloc.logicalBlockNum < 0 || if (bloc.logicalBlockNum < 0 ||
(bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum)) (bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum))
{ {
...@@ -666,7 +666,7 @@ static void udf_table_free_blocks(struct super_block * sb, ...@@ -666,7 +666,7 @@ static void udf_table_free_blocks(struct super_block * sb,
error_return: error_return:
sb->s_dirt = 1; sb->s_dirt = 1;
up(&sbi->s_alloc_sem); mutex_unlock(&sbi->s_alloc_mutex);
return; return;
} }
...@@ -692,7 +692,7 @@ static int udf_table_prealloc_blocks(struct super_block * sb, ...@@ -692,7 +692,7 @@ static int udf_table_prealloc_blocks(struct super_block * sb,
else else
return 0; return 0;
down(&sbi->s_alloc_sem); mutex_lock(&sbi->s_alloc_mutex);
extoffset = sizeof(struct unallocSpaceEntry); extoffset = sizeof(struct unallocSpaceEntry);
bloc = UDF_I_LOCATION(table); bloc = UDF_I_LOCATION(table);
...@@ -736,7 +736,7 @@ static int udf_table_prealloc_blocks(struct super_block * sb, ...@@ -736,7 +736,7 @@ static int udf_table_prealloc_blocks(struct super_block * sb,
mark_buffer_dirty(UDF_SB_LVIDBH(sb)); mark_buffer_dirty(UDF_SB_LVIDBH(sb));
sb->s_dirt = 1; sb->s_dirt = 1;
} }
up(&sbi->s_alloc_sem); mutex_unlock(&sbi->s_alloc_mutex);
return alloc_count; return alloc_count;
} }
...@@ -761,7 +761,7 @@ static int udf_table_new_block(struct super_block * sb, ...@@ -761,7 +761,7 @@ static int udf_table_new_block(struct super_block * sb,
else else
return newblock; return newblock;
down(&sbi->s_alloc_sem); mutex_lock(&sbi->s_alloc_mutex);
if (goal < 0 || goal >= UDF_SB_PARTLEN(sb, partition)) if (goal < 0 || goal >= UDF_SB_PARTLEN(sb, partition))
goal = 0; goal = 0;
...@@ -811,7 +811,7 @@ static int udf_table_new_block(struct super_block * sb, ...@@ -811,7 +811,7 @@ static int udf_table_new_block(struct super_block * sb,
if (spread == 0xFFFFFFFF) if (spread == 0xFFFFFFFF)
{ {
udf_release_data(goal_bh); udf_release_data(goal_bh);
up(&sbi->s_alloc_sem); mutex_unlock(&sbi->s_alloc_mutex);
return 0; return 0;
} }
...@@ -827,7 +827,7 @@ static int udf_table_new_block(struct super_block * sb, ...@@ -827,7 +827,7 @@ static int udf_table_new_block(struct super_block * sb,
if (inode && DQUOT_ALLOC_BLOCK(inode, 1)) if (inode && DQUOT_ALLOC_BLOCK(inode, 1))
{ {
udf_release_data(goal_bh); udf_release_data(goal_bh);
up(&sbi->s_alloc_sem); mutex_unlock(&sbi->s_alloc_mutex);
*err = -EDQUOT; *err = -EDQUOT;
return 0; return 0;
} }
...@@ -846,7 +846,7 @@ static int udf_table_new_block(struct super_block * sb, ...@@ -846,7 +846,7 @@ static int udf_table_new_block(struct super_block * sb,
} }
sb->s_dirt = 1; sb->s_dirt = 1;
up(&sbi->s_alloc_sem); mutex_unlock(&sbi->s_alloc_mutex);
*err = 0; *err = 0;
return newblock; return newblock;
} }
......
...@@ -42,7 +42,7 @@ void udf_free_inode(struct inode * inode) ...@@ -42,7 +42,7 @@ void udf_free_inode(struct inode * inode)
clear_inode(inode); clear_inode(inode);
down(&sbi->s_alloc_sem); mutex_lock(&sbi->s_alloc_mutex);
if (sbi->s_lvidbh) { if (sbi->s_lvidbh) {
if (S_ISDIR(inode->i_mode)) if (S_ISDIR(inode->i_mode))
UDF_SB_LVIDIU(sb)->numDirs = UDF_SB_LVIDIU(sb)->numDirs =
...@@ -53,7 +53,7 @@ void udf_free_inode(struct inode * inode) ...@@ -53,7 +53,7 @@ void udf_free_inode(struct inode * inode)
mark_buffer_dirty(sbi->s_lvidbh); mark_buffer_dirty(sbi->s_lvidbh);
} }
up(&sbi->s_alloc_sem); mutex_unlock(&sbi->s_alloc_mutex);
udf_free_blocks(sb, NULL, UDF_I_LOCATION(inode), 0, 1); udf_free_blocks(sb, NULL, UDF_I_LOCATION(inode), 0, 1);
} }
...@@ -83,7 +83,7 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) ...@@ -83,7 +83,7 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err)
return NULL; return NULL;
} }
down(&sbi->s_alloc_sem); mutex_lock(&sbi->s_alloc_mutex);
UDF_I_UNIQUE(inode) = 0; UDF_I_UNIQUE(inode) = 0;
UDF_I_LENEXTENTS(inode) = 0; UDF_I_LENEXTENTS(inode) = 0;
UDF_I_NEXT_ALLOC_BLOCK(inode) = 0; UDF_I_NEXT_ALLOC_BLOCK(inode) = 0;
...@@ -148,7 +148,7 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) ...@@ -148,7 +148,7 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err)
UDF_I_CRTIME(inode) = current_fs_time(inode->i_sb); UDF_I_CRTIME(inode) = current_fs_time(inode->i_sb);
insert_inode_hash(inode); insert_inode_hash(inode);
mark_inode_dirty(inode); mark_inode_dirty(inode);
up(&sbi->s_alloc_sem); mutex_unlock(&sbi->s_alloc_mutex);
if (DQUOT_ALLOC_INODE(inode)) if (DQUOT_ALLOC_INODE(inode))
{ {
......
...@@ -1515,7 +1515,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) ...@@ -1515,7 +1515,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
sb->s_fs_info = sbi; sb->s_fs_info = sbi;
memset(UDF_SB(sb), 0x00, sizeof(struct udf_sb_info)); memset(UDF_SB(sb), 0x00, sizeof(struct udf_sb_info));
init_MUTEX(&sbi->s_alloc_sem); mutex_init(&sbi->s_alloc_mutex);
if (!udf_parse_options((char *)options, &uopt)) if (!udf_parse_options((char *)options, &uopt))
goto error_out; goto error_out;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#ifndef _UDF_FS_SB_H #ifndef _UDF_FS_SB_H
#define _UDF_FS_SB_H 1 #define _UDF_FS_SB_H 1
#include <asm/semaphore.h> #include <linux/mutex.h>
#pragma pack(1) #pragma pack(1)
...@@ -111,7 +111,7 @@ struct udf_sb_info ...@@ -111,7 +111,7 @@ struct udf_sb_info
/* VAT inode */ /* VAT inode */
struct inode *s_vat; struct inode *s_vat;
struct semaphore s_alloc_sem; struct mutex s_alloc_mutex;
}; };
#endif /* _UDF_FS_SB_H */ #endif /* _UDF_FS_SB_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment