aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf')
-rw-r--r--fs/udf/balloc.c36
-rw-r--r--fs/udf/dir.c2
-rw-r--r--fs/udf/file.c2
-rw-r--r--fs/udf/ialloc.c8
-rw-r--r--fs/udf/inode.c6
-rw-r--r--fs/udf/super.c24
-rw-r--r--fs/udf/udfdecl.h4
7 files changed, 38 insertions, 44 deletions
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
index 201049ac8a96..ea521f846d97 100644
--- a/fs/udf/balloc.c
+++ b/fs/udf/balloc.c
@@ -152,7 +152,7 @@ static void udf_bitmap_free_blocks(struct super_block * sb,
152 int bitmap_nr; 152 int bitmap_nr;
153 unsigned long overflow; 153 unsigned long overflow;
154 154
155 down(&sbi->s_alloc_sem); 155 mutex_lock(&sbi->s_alloc_mutex);
156 if (bloc.logicalBlockNum < 0 || 156 if (bloc.logicalBlockNum < 0 ||
157 (bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum)) 157 (bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum))
158 { 158 {
@@ -211,7 +211,7 @@ error_return:
211 sb->s_dirt = 1; 211 sb->s_dirt = 1;
212 if (UDF_SB_LVIDBH(sb)) 212 if (UDF_SB_LVIDBH(sb))
213 mark_buffer_dirty(UDF_SB_LVIDBH(sb)); 213 mark_buffer_dirty(UDF_SB_LVIDBH(sb));
214 up(&sbi->s_alloc_sem); 214 mutex_unlock(&sbi->s_alloc_mutex);
215 return; 215 return;
216} 216}
217 217
@@ -226,7 +226,7 @@ static int udf_bitmap_prealloc_blocks(struct super_block * sb,
226 int nr_groups, bitmap_nr; 226 int nr_groups, bitmap_nr;
227 struct buffer_head *bh; 227 struct buffer_head *bh;
228 228
229 down(&sbi->s_alloc_sem); 229 mutex_lock(&sbi->s_alloc_mutex);
230 if (first_block < 0 || first_block >= UDF_SB_PARTLEN(sb, partition)) 230 if (first_block < 0 || first_block >= UDF_SB_PARTLEN(sb, partition))
231 goto out; 231 goto out;
232 232
@@ -275,7 +275,7 @@ out:
275 mark_buffer_dirty(UDF_SB_LVIDBH(sb)); 275 mark_buffer_dirty(UDF_SB_LVIDBH(sb));
276 } 276 }
277 sb->s_dirt = 1; 277 sb->s_dirt = 1;
278 up(&sbi->s_alloc_sem); 278 mutex_unlock(&sbi->s_alloc_mutex);
279 return alloc_count; 279 return alloc_count;
280} 280}
281 281
@@ -291,7 +291,7 @@ static int udf_bitmap_new_block(struct super_block * sb,
291 int newblock = 0; 291 int newblock = 0;
292 292
293 *err = -ENOSPC; 293 *err = -ENOSPC;
294 down(&sbi->s_alloc_sem); 294 mutex_lock(&sbi->s_alloc_mutex);
295 295
296repeat: 296repeat:
297 if (goal < 0 || goal >= UDF_SB_PARTLEN(sb, partition)) 297 if (goal < 0 || goal >= UDF_SB_PARTLEN(sb, partition))
@@ -364,7 +364,7 @@ repeat:
364 } 364 }
365 if (i >= (nr_groups*2)) 365 if (i >= (nr_groups*2))
366 { 366 {
367 up(&sbi->s_alloc_sem); 367 mutex_unlock(&sbi->s_alloc_mutex);
368 return newblock; 368 return newblock;
369 } 369 }
370 if (bit < sb->s_blocksize << 3) 370 if (bit < sb->s_blocksize << 3)
@@ -373,7 +373,7 @@ repeat:
373 bit = udf_find_next_one_bit(bh->b_data, sb->s_blocksize << 3, group_start << 3); 373 bit = udf_find_next_one_bit(bh->b_data, sb->s_blocksize << 3, group_start << 3);
374 if (bit >= sb->s_blocksize << 3) 374 if (bit >= sb->s_blocksize << 3)
375 { 375 {
376 up(&sbi->s_alloc_sem); 376 mutex_unlock(&sbi->s_alloc_mutex);
377 return 0; 377 return 0;
378 } 378 }
379 379
@@ -387,7 +387,7 @@ got_block:
387 */ 387 */
388 if (inode && DQUOT_ALLOC_BLOCK(inode, 1)) 388 if (inode && DQUOT_ALLOC_BLOCK(inode, 1))
389 { 389 {
390 up(&sbi->s_alloc_sem); 390 mutex_unlock(&sbi->s_alloc_mutex);
391 *err = -EDQUOT; 391 *err = -EDQUOT;
392 return 0; 392 return 0;
393 } 393 }
@@ -410,13 +410,13 @@ got_block:
410 mark_buffer_dirty(UDF_SB_LVIDBH(sb)); 410 mark_buffer_dirty(UDF_SB_LVIDBH(sb));
411 } 411 }
412 sb->s_dirt = 1; 412 sb->s_dirt = 1;
413 up(&sbi->s_alloc_sem); 413 mutex_unlock(&sbi->s_alloc_mutex);
414 *err = 0; 414 *err = 0;
415 return newblock; 415 return newblock;
416 416
417error_return: 417error_return:
418 *err = -EIO; 418 *err = -EIO;
419 up(&sbi->s_alloc_sem); 419 mutex_unlock(&sbi->s_alloc_mutex);
420 return 0; 420 return 0;
421} 421}
422 422
@@ -433,7 +433,7 @@ static void udf_table_free_blocks(struct super_block * sb,
433 int8_t etype; 433 int8_t etype;
434 int i; 434 int i;
435 435
436 down(&sbi->s_alloc_sem); 436 mutex_lock(&sbi->s_alloc_mutex);
437 if (bloc.logicalBlockNum < 0 || 437 if (bloc.logicalBlockNum < 0 ||
438 (bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum)) 438 (bloc.logicalBlockNum + count) > UDF_SB_PARTLEN(sb, bloc.partitionReferenceNum))
439 { 439 {
@@ -666,7 +666,7 @@ static void udf_table_free_blocks(struct super_block * sb,
666 666
667error_return: 667error_return:
668 sb->s_dirt = 1; 668 sb->s_dirt = 1;
669 up(&sbi->s_alloc_sem); 669 mutex_unlock(&sbi->s_alloc_mutex);
670 return; 670 return;
671} 671}
672 672
@@ -692,7 +692,7 @@ static int udf_table_prealloc_blocks(struct super_block * sb,
692 else 692 else
693 return 0; 693 return 0;
694 694
695 down(&sbi->s_alloc_sem); 695 mutex_lock(&sbi->s_alloc_mutex);
696 extoffset = sizeof(struct unallocSpaceEntry); 696 extoffset = sizeof(struct unallocSpaceEntry);
697 bloc = UDF_I_LOCATION(table); 697 bloc = UDF_I_LOCATION(table);
698 698
@@ -736,7 +736,7 @@ static int udf_table_prealloc_blocks(struct super_block * sb,
736 mark_buffer_dirty(UDF_SB_LVIDBH(sb)); 736 mark_buffer_dirty(UDF_SB_LVIDBH(sb));
737 sb->s_dirt = 1; 737 sb->s_dirt = 1;
738 } 738 }
739 up(&sbi->s_alloc_sem); 739 mutex_unlock(&sbi->s_alloc_mutex);
740 return alloc_count; 740 return alloc_count;
741} 741}
742 742
@@ -761,7 +761,7 @@ static int udf_table_new_block(struct super_block * sb,
761 else 761 else
762 return newblock; 762 return newblock;
763 763
764 down(&sbi->s_alloc_sem); 764 mutex_lock(&sbi->s_alloc_mutex);
765 if (goal < 0 || goal >= UDF_SB_PARTLEN(sb, partition)) 765 if (goal < 0 || goal >= UDF_SB_PARTLEN(sb, partition))
766 goal = 0; 766 goal = 0;
767 767
@@ -811,7 +811,7 @@ static int udf_table_new_block(struct super_block * sb,
811 if (spread == 0xFFFFFFFF) 811 if (spread == 0xFFFFFFFF)
812 { 812 {
813 udf_release_data(goal_bh); 813 udf_release_data(goal_bh);
814 up(&sbi->s_alloc_sem); 814 mutex_unlock(&sbi->s_alloc_mutex);
815 return 0; 815 return 0;
816 } 816 }
817 817
@@ -827,7 +827,7 @@ static int udf_table_new_block(struct super_block * sb,
827 if (inode && DQUOT_ALLOC_BLOCK(inode, 1)) 827 if (inode && DQUOT_ALLOC_BLOCK(inode, 1))
828 { 828 {
829 udf_release_data(goal_bh); 829 udf_release_data(goal_bh);
830 up(&sbi->s_alloc_sem); 830 mutex_unlock(&sbi->s_alloc_mutex);
831 *err = -EDQUOT; 831 *err = -EDQUOT;
832 return 0; 832 return 0;
833 } 833 }
@@ -846,7 +846,7 @@ static int udf_table_new_block(struct super_block * sb,
846 } 846 }
847 847
848 sb->s_dirt = 1; 848 sb->s_dirt = 1;
849 up(&sbi->s_alloc_sem); 849 mutex_unlock(&sbi->s_alloc_mutex);
850 *err = 0; 850 *err = 0;
851 return newblock; 851 return newblock;
852} 852}
diff --git a/fs/udf/dir.c b/fs/udf/dir.c
index f5222527fe39..8c28efa3b8ff 100644
--- a/fs/udf/dir.c
+++ b/fs/udf/dir.c
@@ -42,7 +42,7 @@ static int do_udf_readdir(struct inode *, struct file *, filldir_t, void *);
42 42
43/* readdir and lookup functions */ 43/* readdir and lookup functions */
44 44
45struct file_operations udf_dir_operations = { 45const struct file_operations udf_dir_operations = {
46 .read = generic_read_dir, 46 .read = generic_read_dir,
47 .readdir = udf_readdir, 47 .readdir = udf_readdir,
48 .ioctl = udf_ioctl, 48 .ioctl = udf_ioctl,
diff --git a/fs/udf/file.c b/fs/udf/file.c
index a6f2acc1f15c..e34b00e303f1 100644
--- a/fs/udf/file.c
+++ b/fs/udf/file.c
@@ -248,7 +248,7 @@ static int udf_release_file(struct inode * inode, struct file * filp)
248 return 0; 248 return 0;
249} 249}
250 250
251struct file_operations udf_file_operations = { 251const struct file_operations udf_file_operations = {
252 .read = generic_file_read, 252 .read = generic_file_read,
253 .ioctl = udf_ioctl, 253 .ioctl = udf_ioctl,
254 .open = generic_file_open, 254 .open = generic_file_open,
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index c9b707b470ca..3873c672cb4c 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -42,7 +42,7 @@ void udf_free_inode(struct inode * inode)
42 42
43 clear_inode(inode); 43 clear_inode(inode);
44 44
45 down(&sbi->s_alloc_sem); 45 mutex_lock(&sbi->s_alloc_mutex);
46 if (sbi->s_lvidbh) { 46 if (sbi->s_lvidbh) {
47 if (S_ISDIR(inode->i_mode)) 47 if (S_ISDIR(inode->i_mode))
48 UDF_SB_LVIDIU(sb)->numDirs = 48 UDF_SB_LVIDIU(sb)->numDirs =
@@ -53,7 +53,7 @@ void udf_free_inode(struct inode * inode)
53 53
54 mark_buffer_dirty(sbi->s_lvidbh); 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 udf_free_blocks(sb, NULL, UDF_I_LOCATION(inode), 0, 1); 58 udf_free_blocks(sb, NULL, UDF_I_LOCATION(inode), 0, 1);
59} 59}
@@ -83,7 +83,7 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err)
83 return NULL; 83 return NULL;
84 } 84 }
85 85
86 down(&sbi->s_alloc_sem); 86 mutex_lock(&sbi->s_alloc_mutex);
87 UDF_I_UNIQUE(inode) = 0; 87 UDF_I_UNIQUE(inode) = 0;
88 UDF_I_LENEXTENTS(inode) = 0; 88 UDF_I_LENEXTENTS(inode) = 0;
89 UDF_I_NEXT_ALLOC_BLOCK(inode) = 0; 89 UDF_I_NEXT_ALLOC_BLOCK(inode) = 0;
@@ -148,7 +148,7 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err)
148 UDF_I_CRTIME(inode) = current_fs_time(inode->i_sb); 148 UDF_I_CRTIME(inode) = current_fs_time(inode->i_sb);
149 insert_inode_hash(inode); 149 insert_inode_hash(inode);
150 mark_inode_dirty(inode); 150 mark_inode_dirty(inode);
151 up(&sbi->s_alloc_sem); 151 mutex_unlock(&sbi->s_alloc_mutex);
152 152
153 if (DQUOT_ALLOC_INODE(inode)) 153 if (DQUOT_ALLOC_INODE(inode))
154 { 154 {
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index d04cff2273b6..81e0e8459af1 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1341,13 +1341,11 @@ udf_update_inode(struct inode *inode, int do_sync)
1341 1341
1342 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET)) 1342 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET))
1343 fe->uid = cpu_to_le32(-1); 1343 fe->uid = cpu_to_le32(-1);
1344 else if (inode->i_uid != UDF_SB(inode->i_sb)->s_uid) 1344 else fe->uid = cpu_to_le32(inode->i_uid);
1345 fe->uid = cpu_to_le32(inode->i_uid);
1346 1345
1347 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_FORGET)) 1346 if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_FORGET))
1348 fe->gid = cpu_to_le32(-1); 1347 fe->gid = cpu_to_le32(-1);
1349 else if (inode->i_gid != UDF_SB(inode->i_sb)->s_gid) 1348 else fe->gid = cpu_to_le32(inode->i_gid);
1350 fe->gid = cpu_to_le32(inode->i_gid);
1351 1349
1352 udfperms = ((inode->i_mode & S_IRWXO) ) | 1350 udfperms = ((inode->i_mode & S_IRWXO) ) |
1353 ((inode->i_mode & S_IRWXG) << 2) | 1351 ((inode->i_mode & S_IRWXG) << 2) |
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 368d8f81fe54..e45789fe38e8 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -140,7 +140,8 @@ static int init_inodecache(void)
140{ 140{
141 udf_inode_cachep = kmem_cache_create("udf_inode_cache", 141 udf_inode_cachep = kmem_cache_create("udf_inode_cache",
142 sizeof(struct udf_inode_info), 142 sizeof(struct udf_inode_info),
143 0, SLAB_RECLAIM_ACCOUNT, 143 0, (SLAB_RECLAIM_ACCOUNT|
144 SLAB_MEM_SPREAD),
144 init_once, NULL); 145 init_once, NULL);
145 if (udf_inode_cachep == NULL) 146 if (udf_inode_cachep == NULL)
146 return -ENOMEM; 147 return -ENOMEM;
@@ -660,8 +661,7 @@ udf_find_anchor(struct super_block *sb)
660 * lastblock 661 * lastblock
661 * however, if the disc isn't closed, it could be 512 */ 662 * however, if the disc isn't closed, it could be 512 */
662 663
663 for (i=0; (!lastblock && i<sizeof(last)/sizeof(int)); i++) 664 for (i = 0; !lastblock && i < ARRAY_SIZE(last); i++) {
664 {
665 if (last[i] < 0 || !(bh = sb_bread(sb, last[i]))) 665 if (last[i] < 0 || !(bh = sb_bread(sb, last[i])))
666 { 666 {
667 ident = location = 0; 667 ident = location = 0;
@@ -672,7 +672,7 @@ udf_find_anchor(struct super_block *sb)
672 location = le32_to_cpu(((tag *)bh->b_data)->tagLocation); 672 location = le32_to_cpu(((tag *)bh->b_data)->tagLocation);
673 udf_release_data(bh); 673 udf_release_data(bh);
674 } 674 }
675 675
676 if (ident == TAG_IDENT_AVDP) 676 if (ident == TAG_IDENT_AVDP)
677 { 677 {
678 if (location == last[i] - UDF_SB_SESSION(sb)) 678 if (location == last[i] - UDF_SB_SESSION(sb))
@@ -753,8 +753,7 @@ udf_find_anchor(struct super_block *sb)
753 } 753 }
754 } 754 }
755 755
756 for (i=0; i<sizeof(UDF_SB_ANCHOR(sb))/sizeof(int); i++) 756 for (i = 0; i < ARRAY_SIZE(UDF_SB_ANCHOR(sb)); i++) {
757 {
758 if (UDF_SB_ANCHOR(sb)[i]) 757 if (UDF_SB_ANCHOR(sb)[i])
759 { 758 {
760 if (!(bh = udf_read_tagged(sb, 759 if (!(bh = udf_read_tagged(sb,
@@ -1313,8 +1312,7 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
1313 if (!sb) 1312 if (!sb)
1314 return 1; 1313 return 1;
1315 1314
1316 for (i=0; i<sizeof(UDF_SB_ANCHOR(sb))/sizeof(int); i++) 1315 for (i = 0; i < ARRAY_SIZE(UDF_SB_ANCHOR(sb)); i++) {
1317 {
1318 if (UDF_SB_ANCHOR(sb)[i] && (bh = udf_read_tagged(sb, 1316 if (UDF_SB_ANCHOR(sb)[i] && (bh = udf_read_tagged(sb,
1319 UDF_SB_ANCHOR(sb)[i], UDF_SB_ANCHOR(sb)[i], &ident))) 1317 UDF_SB_ANCHOR(sb)[i], UDF_SB_ANCHOR(sb)[i], &ident)))
1320 { 1318 {
@@ -1325,7 +1323,7 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
1325 main_e = le32_to_cpu( anchor->mainVolDescSeqExt.extLength ); 1323 main_e = le32_to_cpu( anchor->mainVolDescSeqExt.extLength );
1326 main_e = main_e >> sb->s_blocksize_bits; 1324 main_e = main_e >> sb->s_blocksize_bits;
1327 main_e += main_s; 1325 main_e += main_s;
1328 1326
1329 /* Locate the reserve sequence */ 1327 /* Locate the reserve sequence */
1330 reserve_s = le32_to_cpu(anchor->reserveVolDescSeqExt.extLocation); 1328 reserve_s = le32_to_cpu(anchor->reserveVolDescSeqExt.extLocation);
1331 reserve_e = le32_to_cpu(anchor->reserveVolDescSeqExt.extLength); 1329 reserve_e = le32_to_cpu(anchor->reserveVolDescSeqExt.extLength);
@@ -1344,12 +1342,10 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
1344 } 1342 }
1345 } 1343 }
1346 1344
1347 if (i == sizeof(UDF_SB_ANCHOR(sb))/sizeof(int)) 1345 if (i == ARRAY_SIZE(UDF_SB_ANCHOR(sb))) {
1348 {
1349 udf_debug("No Anchor block found\n"); 1346 udf_debug("No Anchor block found\n");
1350 return 1; 1347 return 1;
1351 } 1348 } else
1352 else
1353 udf_debug("Using anchor in block %d\n", UDF_SB_ANCHOR(sb)[i]); 1349 udf_debug("Using anchor in block %d\n", UDF_SB_ANCHOR(sb)[i]);
1354 1350
1355 for (i=0; i<UDF_SB_NUMPARTS(sb); i++) 1351 for (i=0; i<UDF_SB_NUMPARTS(sb); i++)
@@ -1515,7 +1511,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
1515 sb->s_fs_info = sbi; 1511 sb->s_fs_info = sbi;
1516 memset(UDF_SB(sb), 0x00, sizeof(struct udf_sb_info)); 1512 memset(UDF_SB(sb), 0x00, sizeof(struct udf_sb_info));
1517 1513
1518 init_MUTEX(&sbi->s_alloc_sem); 1514 mutex_init(&sbi->s_alloc_mutex);
1519 1515
1520 if (!udf_parse_options((char *)options, &uopt)) 1516 if (!udf_parse_options((char *)options, &uopt))
1521 goto error_out; 1517 goto error_out;
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index 1d5800e0cbe7..023e19ba5a2e 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -44,9 +44,9 @@ struct buffer_head;
44struct super_block; 44struct super_block;
45 45
46extern struct inode_operations udf_dir_inode_operations; 46extern struct inode_operations udf_dir_inode_operations;
47extern struct file_operations udf_dir_operations; 47extern const struct file_operations udf_dir_operations;
48extern struct inode_operations udf_file_inode_operations; 48extern struct inode_operations udf_file_inode_operations;
49extern struct file_operations udf_file_operations; 49extern const struct file_operations udf_file_operations;
50extern struct address_space_operations udf_aops; 50extern struct address_space_operations udf_aops;
51extern struct address_space_operations udf_adinicb_aops; 51extern struct address_space_operations udf_adinicb_aops;
52extern struct address_space_operations udf_symlink_aops; 52extern struct address_space_operations udf_symlink_aops;