summaryrefslogtreecommitdiffstats
path: root/fs/udf/balloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf/balloc.c')
-rw-r--r--fs/udf/balloc.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
index e0fd65fe73e8..1b961b1d9699 100644
--- a/fs/udf/balloc.c
+++ b/fs/udf/balloc.c
@@ -58,7 +58,7 @@ static int __load_block_bitmap(struct super_block *sb,
58 int nr_groups = bitmap->s_nr_groups; 58 int nr_groups = bitmap->s_nr_groups;
59 59
60 if (block_group >= nr_groups) { 60 if (block_group >= nr_groups) {
61 udf_debug("block_group (%d) > nr_groups (%d)\n", 61 udf_debug("block_group (%u) > nr_groups (%d)\n",
62 block_group, nr_groups); 62 block_group, nr_groups);
63 } 63 }
64 64
@@ -122,7 +122,7 @@ static void udf_bitmap_free_blocks(struct super_block *sb,
122 partmap = &sbi->s_partmaps[bloc->partitionReferenceNum]; 122 partmap = &sbi->s_partmaps[bloc->partitionReferenceNum];
123 if (bloc->logicalBlockNum + count < count || 123 if (bloc->logicalBlockNum + count < count ||
124 (bloc->logicalBlockNum + count) > partmap->s_partition_len) { 124 (bloc->logicalBlockNum + count) > partmap->s_partition_len) {
125 udf_debug("%d < %d || %d + %d > %d\n", 125 udf_debug("%u < %d || %u + %u > %u\n",
126 bloc->logicalBlockNum, 0, 126 bloc->logicalBlockNum, 0,
127 bloc->logicalBlockNum, count, 127 bloc->logicalBlockNum, count,
128 partmap->s_partition_len); 128 partmap->s_partition_len);
@@ -151,9 +151,9 @@ static void udf_bitmap_free_blocks(struct super_block *sb,
151 bh = bitmap->s_block_bitmap[bitmap_nr]; 151 bh = bitmap->s_block_bitmap[bitmap_nr];
152 for (i = 0; i < count; i++) { 152 for (i = 0; i < count; i++) {
153 if (udf_set_bit(bit + i, bh->b_data)) { 153 if (udf_set_bit(bit + i, bh->b_data)) {
154 udf_debug("bit %ld already set\n", bit + i); 154 udf_debug("bit %lu already set\n", bit + i);
155 udf_debug("byte=%2x\n", 155 udf_debug("byte=%2x\n",
156 ((char *)bh->b_data)[(bit + i) >> 3]); 156 ((__u8 *)bh->b_data)[(bit + i) >> 3]);
157 } 157 }
158 } 158 }
159 udf_add_free_space(sb, sbi->s_partition, count); 159 udf_add_free_space(sb, sbi->s_partition, count);
@@ -218,16 +218,18 @@ out:
218 return alloc_count; 218 return alloc_count;
219} 219}
220 220
221static int udf_bitmap_new_block(struct super_block *sb, 221static udf_pblk_t udf_bitmap_new_block(struct super_block *sb,
222 struct udf_bitmap *bitmap, uint16_t partition, 222 struct udf_bitmap *bitmap, uint16_t partition,
223 uint32_t goal, int *err) 223 uint32_t goal, int *err)
224{ 224{
225 struct udf_sb_info *sbi = UDF_SB(sb); 225 struct udf_sb_info *sbi = UDF_SB(sb);
226 int newbit, bit = 0, block, block_group, group_start; 226 int newbit, bit = 0;
227 udf_pblk_t block;
228 int block_group, group_start;
227 int end_goal, nr_groups, bitmap_nr, i; 229 int end_goal, nr_groups, bitmap_nr, i;
228 struct buffer_head *bh = NULL; 230 struct buffer_head *bh = NULL;
229 char *ptr; 231 char *ptr;
230 int newblock = 0; 232 udf_pblk_t newblock = 0;
231 233
232 *err = -ENOSPC; 234 *err = -ENOSPC;
233 mutex_lock(&sbi->s_alloc_mutex); 235 mutex_lock(&sbi->s_alloc_mutex);
@@ -362,7 +364,7 @@ static void udf_table_free_blocks(struct super_block *sb,
362 partmap = &sbi->s_partmaps[bloc->partitionReferenceNum]; 364 partmap = &sbi->s_partmaps[bloc->partitionReferenceNum];
363 if (bloc->logicalBlockNum + count < count || 365 if (bloc->logicalBlockNum + count < count ||
364 (bloc->logicalBlockNum + count) > partmap->s_partition_len) { 366 (bloc->logicalBlockNum + count) > partmap->s_partition_len) {
365 udf_debug("%d < %d || %d + %d > %d\n", 367 udf_debug("%u < %d || %u + %u > %u\n",
366 bloc->logicalBlockNum, 0, 368 bloc->logicalBlockNum, 0,
367 bloc->logicalBlockNum, count, 369 bloc->logicalBlockNum, count,
368 partmap->s_partition_len); 370 partmap->s_partition_len);
@@ -515,7 +517,7 @@ static int udf_table_prealloc_blocks(struct super_block *sb,
515 517
516 while (first_block != eloc.logicalBlockNum && 518 while (first_block != eloc.logicalBlockNum &&
517 (etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1) { 519 (etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1) {
518 udf_debug("eloc=%d, elen=%d, first_block=%d\n", 520 udf_debug("eloc=%u, elen=%u, first_block=%u\n",
519 eloc.logicalBlockNum, elen, first_block); 521 eloc.logicalBlockNum, elen, first_block);
520 ; /* empty loop body */ 522 ; /* empty loop body */
521 } 523 }
@@ -545,13 +547,14 @@ static int udf_table_prealloc_blocks(struct super_block *sb,
545 return alloc_count; 547 return alloc_count;
546} 548}
547 549
548static int udf_table_new_block(struct super_block *sb, 550static udf_pblk_t udf_table_new_block(struct super_block *sb,
549 struct inode *table, uint16_t partition, 551 struct inode *table, uint16_t partition,
550 uint32_t goal, int *err) 552 uint32_t goal, int *err)
551{ 553{
552 struct udf_sb_info *sbi = UDF_SB(sb); 554 struct udf_sb_info *sbi = UDF_SB(sb);
553 uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF; 555 uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF;
554 uint32_t newblock = 0, adsize; 556 udf_pblk_t newblock = 0;
557 uint32_t adsize;
555 uint32_t elen, goal_elen = 0; 558 uint32_t elen, goal_elen = 0;
556 struct kernel_lb_addr eloc, uninitialized_var(goal_eloc); 559 struct kernel_lb_addr eloc, uninitialized_var(goal_eloc);
557 struct extent_position epos, goal_epos; 560 struct extent_position epos, goal_epos;
@@ -700,12 +703,12 @@ inline int udf_prealloc_blocks(struct super_block *sb,
700 return allocated; 703 return allocated;
701} 704}
702 705
703inline int udf_new_block(struct super_block *sb, 706inline udf_pblk_t udf_new_block(struct super_block *sb,
704 struct inode *inode, 707 struct inode *inode,
705 uint16_t partition, uint32_t goal, int *err) 708 uint16_t partition, uint32_t goal, int *err)
706{ 709{
707 struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition]; 710 struct udf_part_map *map = &UDF_SB(sb)->s_partmaps[partition];
708 int block; 711 udf_pblk_t block;
709 712
710 if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) 713 if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP)
711 block = udf_bitmap_new_block(sb, 714 block = udf_bitmap_new_block(sb,