Commit 1e7933defd0fce79b2d8ecdbc7ca37fed0c188ed

Authored by Ingo Molnar
Committed by Linus Torvalds
1 parent 8e3f90459b

[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: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 4 changed files with 25 additions and 25 deletions Side-by-side Diff

... ... @@ -152,7 +152,7 @@
152 152 int bitmap_nr;
153 153 unsigned long overflow;
154 154  
155   - down(&sbi->s_alloc_sem);
  155 + mutex_lock(&sbi->s_alloc_mutex);
156 156 if (bloc.logicalBlockNum < 0 ||
157 157 (bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum))
158 158 {
... ... @@ -211,7 +211,7 @@
211 211 sb->s_dirt = 1;
212 212 if (UDF_SB_LVIDBH(sb))
213 213 mark_buffer_dirty(UDF_SB_LVIDBH(sb));
214   - up(&sbi->s_alloc_sem);
  214 + mutex_unlock(&sbi->s_alloc_mutex);
215 215 return;
216 216 }
217 217  
... ... @@ -226,7 +226,7 @@
226 226 int nr_groups, bitmap_nr;
227 227 struct buffer_head *bh;
228 228  
229   - down(&sbi->s_alloc_sem);
  229 + mutex_lock(&sbi->s_alloc_mutex);
230 230 if (first_block < 0 || first_block >= UDF_SB_PARTLEN(sb, partition))
231 231 goto out;
232 232  
... ... @@ -275,7 +275,7 @@
275 275 mark_buffer_dirty(UDF_SB_LVIDBH(sb));
276 276 }
277 277 sb->s_dirt = 1;
278   - up(&sbi->s_alloc_sem);
  278 + mutex_unlock(&sbi->s_alloc_mutex);
279 279 return alloc_count;
280 280 }
281 281  
... ... @@ -291,7 +291,7 @@
291 291 int newblock = 0;
292 292  
293 293 *err = -ENOSPC;
294   - down(&sbi->s_alloc_sem);
  294 + mutex_lock(&sbi->s_alloc_mutex);
295 295  
296 296 repeat:
297 297 if (goal < 0 || goal >= UDF_SB_PARTLEN(sb, partition))
... ... @@ -364,7 +364,7 @@
364 364 }
365 365 if (i >= (nr_groups*2))
366 366 {
367   - up(&sbi->s_alloc_sem);
  367 + mutex_unlock(&sbi->s_alloc_mutex);
368 368 return newblock;
369 369 }
370 370 if (bit < sb->s_blocksize << 3)
... ... @@ -373,7 +373,7 @@
373 373 bit = udf_find_next_one_bit(bh->b_data, sb->s_blocksize << 3, group_start << 3);
374 374 if (bit >= sb->s_blocksize << 3)
375 375 {
376   - up(&sbi->s_alloc_sem);
  376 + mutex_unlock(&sbi->s_alloc_mutex);
377 377 return 0;
378 378 }
379 379  
... ... @@ -387,7 +387,7 @@
387 387 */
388 388 if (inode && DQUOT_ALLOC_BLOCK(inode, 1))
389 389 {
390   - up(&sbi->s_alloc_sem);
  390 + mutex_unlock(&sbi->s_alloc_mutex);
391 391 *err = -EDQUOT;
392 392 return 0;
393 393 }
394 394  
... ... @@ -410,13 +410,13 @@
410 410 mark_buffer_dirty(UDF_SB_LVIDBH(sb));
411 411 }
412 412 sb->s_dirt = 1;
413   - up(&sbi->s_alloc_sem);
  413 + mutex_unlock(&sbi->s_alloc_mutex);
414 414 *err = 0;
415 415 return newblock;
416 416  
417 417 error_return:
418 418 *err = -EIO;
419   - up(&sbi->s_alloc_sem);
  419 + mutex_unlock(&sbi->s_alloc_mutex);
420 420 return 0;
421 421 }
422 422  
... ... @@ -433,7 +433,7 @@
433 433 int8_t etype;
434 434 int i;
435 435  
436   - down(&sbi->s_alloc_sem);
  436 + mutex_lock(&sbi->s_alloc_mutex);
437 437 if (bloc.logicalBlockNum < 0 ||
438 438 (bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum))
439 439 {
... ... @@ -666,7 +666,7 @@
666 666  
667 667 error_return:
668 668 sb->s_dirt = 1;
669   - up(&sbi->s_alloc_sem);
  669 + mutex_unlock(&sbi->s_alloc_mutex);
670 670 return;
671 671 }
672 672  
... ... @@ -692,7 +692,7 @@
692 692 else
693 693 return 0;
694 694  
695   - down(&sbi->s_alloc_sem);
  695 + mutex_lock(&sbi->s_alloc_mutex);
696 696 extoffset = sizeof(struct unallocSpaceEntry);
697 697 bloc = UDF_I_LOCATION(table);
698 698  
... ... @@ -736,7 +736,7 @@
736 736 mark_buffer_dirty(UDF_SB_LVIDBH(sb));
737 737 sb->s_dirt = 1;
738 738 }
739   - up(&sbi->s_alloc_sem);
  739 + mutex_unlock(&sbi->s_alloc_mutex);
740 740 return alloc_count;
741 741 }
742 742  
... ... @@ -761,7 +761,7 @@
761 761 else
762 762 return newblock;
763 763  
764   - down(&sbi->s_alloc_sem);
  764 + mutex_lock(&sbi->s_alloc_mutex);
765 765 if (goal < 0 || goal >= UDF_SB_PARTLEN(sb, partition))
766 766 goal = 0;
767 767  
... ... @@ -811,7 +811,7 @@
811 811 if (spread == 0xFFFFFFFF)
812 812 {
813 813 udf_release_data(goal_bh);
814   - up(&sbi->s_alloc_sem);
  814 + mutex_unlock(&sbi->s_alloc_mutex);
815 815 return 0;
816 816 }
817 817  
... ... @@ -827,7 +827,7 @@
827 827 if (inode && DQUOT_ALLOC_BLOCK(inode, 1))
828 828 {
829 829 udf_release_data(goal_bh);
830   - up(&sbi->s_alloc_sem);
  830 + mutex_unlock(&sbi->s_alloc_mutex);
831 831 *err = -EDQUOT;
832 832 return 0;
833 833 }
... ... @@ -846,7 +846,7 @@
846 846 }
847 847  
848 848 sb->s_dirt = 1;
849   - up(&sbi->s_alloc_sem);
  849 + mutex_unlock(&sbi->s_alloc_mutex);
850 850 *err = 0;
851 851 return newblock;
852 852 }
... ... @@ -42,7 +42,7 @@
42 42  
43 43 clear_inode(inode);
44 44  
45   - down(&sbi->s_alloc_sem);
  45 + mutex_lock(&sbi->s_alloc_mutex);
46 46 if (sbi->s_lvidbh) {
47 47 if (S_ISDIR(inode->i_mode))
48 48 UDF_SB_LVIDIU(sb)->numDirs =
... ... @@ -53,7 +53,7 @@
53 53  
54 54 mark_buffer_dirty(sbi->s_lvidbh);
55 55 }
56   - up(&sbi->s_alloc_sem);
  56 + mutex_unlock(&sbi->s_alloc_mutex);
57 57  
58 58 udf_free_blocks(sb, NULL, UDF_I_LOCATION(inode), 0, 1);
59 59 }
... ... @@ -83,7 +83,7 @@
83 83 return NULL;
84 84 }
85 85  
86   - down(&sbi->s_alloc_sem);
  86 + mutex_lock(&sbi->s_alloc_mutex);
87 87 UDF_I_UNIQUE(inode) = 0;
88 88 UDF_I_LENEXTENTS(inode) = 0;
89 89 UDF_I_NEXT_ALLOC_BLOCK(inode) = 0;
... ... @@ -148,7 +148,7 @@
148 148 UDF_I_CRTIME(inode) = current_fs_time(inode->i_sb);
149 149 insert_inode_hash(inode);
150 150 mark_inode_dirty(inode);
151   - up(&sbi->s_alloc_sem);
  151 + mutex_unlock(&sbi->s_alloc_mutex);
152 152  
153 153 if (DQUOT_ALLOC_INODE(inode))
154 154 {
... ... @@ -1515,7 +1515,7 @@
1515 1515 sb->s_fs_info = sbi;
1516 1516 memset(UDF_SB(sb), 0x00, sizeof(struct udf_sb_info));
1517 1517  
1518   - init_MUTEX(&sbi->s_alloc_sem);
  1518 + mutex_init(&sbi->s_alloc_mutex);
1519 1519  
1520 1520 if (!udf_parse_options((char *)options, &uopt))
1521 1521 goto error_out;
include/linux/udf_fs_sb.h
... ... @@ -13,7 +13,7 @@
13 13 #ifndef _UDF_FS_SB_H
14 14 #define _UDF_FS_SB_H 1
15 15  
16   -#include <asm/semaphore.h>
  16 +#include <linux/mutex.h>
17 17  
18 18 #pragma pack(1)
19 19  
... ... @@ -111,7 +111,7 @@
111 111 /* VAT inode */
112 112 struct inode *s_vat;
113 113  
114   - struct semaphore s_alloc_sem;
  114 + struct mutex s_alloc_mutex;
115 115 };
116 116  
117 117 #endif /* _UDF_FS_SB_H */