aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-14 17:13:11 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-14 17:13:11 -0500
commitf14fc0ccee5521e5b38cdd1df4385d32c6e1805b (patch)
tree0d16887967fee217cae343ffebc6666e3fd4265d /fs/udf
parent23281c8034879c47639ee0f76c34d13ef6beb8ce (diff)
parent838bee9e756ec46e9b5be25f9e44388d7e185a2a (diff)
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull quota, ext2, isofs and udf fixes from Jan Kara: - two small quota error handling fixes - two isofs fixes for architectures with signed char - several udf block number overflow and signedness fixes - ext2 rework of mount option handling to avoid GFP_KERNEL allocation with spinlock held - ... it also contains a patch to implement auditing of responses to fanotify permission events. That should have been in the fanotify pull request but I mistakenly merged that patch into a wrong branch and noticed only now at which point I don't think it's worth rebasing and redoing. * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: quota: be aware of error from dquot_initialize quota: fix potential infinite loop isofs: use unsigned char types consistently isofs: fix timestamps beyond 2027 udf: Fix some sign-conversion warnings udf: Fix signed/unsigned format specifiers udf: Fix 64-bit sign extension issues affecting blocks > 0x7FFFFFFF udf: Remove some outdate references from documentation udf: Avoid overflow when session starts at large offset ext2: Fix possible sleep in atomic during mount option parsing ext2: Parse mount options into a dedicated structure audit: Record fanotify access control decisions
Diffstat (limited to 'fs/udf')
-rw-r--r--fs/udf/balloc.c29
-rw-r--r--fs/udf/dir.c2
-rw-r--r--fs/udf/directory.c9
-rw-r--r--fs/udf/ialloc.c2
-rw-r--r--fs/udf/inode.c50
-rw-r--r--fs/udf/misc.c8
-rw-r--r--fs/udf/namei.c13
-rw-r--r--fs/udf/partition.c6
-rw-r--r--fs/udf/super.c56
-rw-r--r--fs/udf/truncate.c2
-rw-r--r--fs/udf/udfdecl.h21
-rw-r--r--fs/udf/unicode.c2
12 files changed, 105 insertions, 95 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,
diff --git a/fs/udf/dir.c b/fs/udf/dir.c
index 2d0e028067eb..c19dba45aa20 100644
--- a/fs/udf/dir.c
+++ b/fs/udf/dir.c
@@ -43,7 +43,7 @@ static int udf_readdir(struct file *file, struct dir_context *ctx)
43 struct udf_fileident_bh fibh = { .sbh = NULL, .ebh = NULL}; 43 struct udf_fileident_bh fibh = { .sbh = NULL, .ebh = NULL};
44 struct fileIdentDesc *fi = NULL; 44 struct fileIdentDesc *fi = NULL;
45 struct fileIdentDesc cfi; 45 struct fileIdentDesc cfi;
46 int block, iblock; 46 udf_pblk_t block, iblock;
47 loff_t nf_pos; 47 loff_t nf_pos;
48 int flen; 48 int flen;
49 unsigned char *fname = NULL, *copy_name = NULL; 49 unsigned char *fname = NULL, *copy_name = NULL;
diff --git a/fs/udf/directory.c b/fs/udf/directory.c
index 7aa48bd7cbaf..0a98a2369738 100644
--- a/fs/udf/directory.c
+++ b/fs/udf/directory.c
@@ -26,7 +26,8 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
26 sector_t *offset) 26 sector_t *offset)
27{ 27{
28 struct fileIdentDesc *fi; 28 struct fileIdentDesc *fi;
29 int i, num, block; 29 int i, num;
30 udf_pblk_t block;
30 struct buffer_head *tmp, *bha[16]; 31 struct buffer_head *tmp, *bha[16];
31 struct udf_inode_info *iinfo = UDF_I(dir); 32 struct udf_inode_info *iinfo = UDF_I(dir);
32 33
@@ -51,7 +52,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
51 } 52 }
52 53
53 if (fibh->eoffset == dir->i_sb->s_blocksize) { 54 if (fibh->eoffset == dir->i_sb->s_blocksize) {
54 int lextoffset = epos->offset; 55 uint32_t lextoffset = epos->offset;
55 unsigned char blocksize_bits = dir->i_sb->s_blocksize_bits; 56 unsigned char blocksize_bits = dir->i_sb->s_blocksize_bits;
56 57
57 if (udf_next_aext(dir, epos, eloc, elen, 1) != 58 if (udf_next_aext(dir, epos, eloc, elen, 1) !=
@@ -110,7 +111,7 @@ struct fileIdentDesc *udf_fileident_read(struct inode *dir, loff_t *nf_pos,
110 memcpy((uint8_t *)cfi, (uint8_t *)fi, 111 memcpy((uint8_t *)cfi, (uint8_t *)fi,
111 sizeof(struct fileIdentDesc)); 112 sizeof(struct fileIdentDesc));
112 } else if (fibh->eoffset > dir->i_sb->s_blocksize) { 113 } else if (fibh->eoffset > dir->i_sb->s_blocksize) {
113 int lextoffset = epos->offset; 114 uint32_t lextoffset = epos->offset;
114 115
115 if (udf_next_aext(dir, epos, eloc, elen, 1) != 116 if (udf_next_aext(dir, epos, eloc, elen, 1) !=
116 (EXT_RECORDED_ALLOCATED >> 30)) 117 (EXT_RECORDED_ALLOCATED >> 30))
@@ -175,7 +176,7 @@ struct fileIdentDesc *udf_get_fileident(void *buffer, int bufsize, int *offset)
175 if (fi->descTag.tagIdent != cpu_to_le16(TAG_IDENT_FID)) { 176 if (fi->descTag.tagIdent != cpu_to_le16(TAG_IDENT_FID)) {
176 udf_debug("0x%x != TAG_IDENT_FID\n", 177 udf_debug("0x%x != TAG_IDENT_FID\n",
177 le16_to_cpu(fi->descTag.tagIdent)); 178 le16_to_cpu(fi->descTag.tagIdent));
178 udf_debug("offset: %u sizeof: %lu bufsize: %u\n", 179 udf_debug("offset: %d sizeof: %lu bufsize: %d\n",
179 *offset, (unsigned long)sizeof(struct fileIdentDesc), 180 *offset, (unsigned long)sizeof(struct fileIdentDesc),
180 bufsize); 181 bufsize);
181 return NULL; 182 return NULL;
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index c1ed18a10ce4..b6e420c1bfeb 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -50,7 +50,7 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode)
50 struct super_block *sb = dir->i_sb; 50 struct super_block *sb = dir->i_sb;
51 struct udf_sb_info *sbi = UDF_SB(sb); 51 struct udf_sb_info *sbi = UDF_SB(sb);
52 struct inode *inode; 52 struct inode *inode;
53 int block; 53 udf_pblk_t block;
54 uint32_t start = UDF_I(dir)->i_location.logicalBlockNum; 54 uint32_t start = UDF_I(dir)->i_location.logicalBlockNum;
55 struct udf_inode_info *iinfo; 55 struct udf_inode_info *iinfo;
56 struct udf_inode_info *dinfo = UDF_I(dir); 56 struct udf_inode_info *dinfo = UDF_I(dir);
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 8dacf4f57414..c23744d5ae5c 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -52,7 +52,7 @@ static int udf_alloc_i_data(struct inode *inode, size_t size);
52static sector_t inode_getblk(struct inode *, sector_t, int *, int *); 52static sector_t inode_getblk(struct inode *, sector_t, int *, int *);
53static int8_t udf_insert_aext(struct inode *, struct extent_position, 53static int8_t udf_insert_aext(struct inode *, struct extent_position,
54 struct kernel_lb_addr, uint32_t); 54 struct kernel_lb_addr, uint32_t);
55static void udf_split_extents(struct inode *, int *, int, int, 55static void udf_split_extents(struct inode *, int *, int, udf_pblk_t,
56 struct kernel_long_ad *, int *); 56 struct kernel_long_ad *, int *);
57static void udf_prealloc_extents(struct inode *, int, int, 57static void udf_prealloc_extents(struct inode *, int, int,
58 struct kernel_long_ad *, int *); 58 struct kernel_long_ad *, int *);
@@ -316,10 +316,10 @@ int udf_expand_file_adinicb(struct inode *inode)
316 return err; 316 return err;
317} 317}
318 318
319struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block, 319struct buffer_head *udf_expand_dir_adinicb(struct inode *inode,
320 int *err) 320 udf_pblk_t *block, int *err)
321{ 321{
322 int newblock; 322 udf_pblk_t newblock;
323 struct buffer_head *dbh = NULL; 323 struct buffer_head *dbh = NULL;
324 struct kernel_lb_addr eloc; 324 struct kernel_lb_addr eloc;
325 uint8_t alloctype; 325 uint8_t alloctype;
@@ -446,7 +446,7 @@ abort:
446 return err; 446 return err;
447} 447}
448 448
449static struct buffer_head *udf_getblk(struct inode *inode, long block, 449static struct buffer_head *udf_getblk(struct inode *inode, udf_pblk_t block,
450 int create, int *err) 450 int create, int *err)
451{ 451{
452 struct buffer_head *bh; 452 struct buffer_head *bh;
@@ -480,7 +480,7 @@ static int udf_do_extend_file(struct inode *inode,
480 int count = 0, fake = !(last_ext->extLength & UDF_EXTENT_LENGTH_MASK); 480 int count = 0, fake = !(last_ext->extLength & UDF_EXTENT_LENGTH_MASK);
481 struct super_block *sb = inode->i_sb; 481 struct super_block *sb = inode->i_sb;
482 struct kernel_lb_addr prealloc_loc = {}; 482 struct kernel_lb_addr prealloc_loc = {};
483 int prealloc_len = 0; 483 uint32_t prealloc_len = 0;
484 struct udf_inode_info *iinfo; 484 struct udf_inode_info *iinfo;
485 int err; 485 int err;
486 486
@@ -663,11 +663,11 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
663 struct kernel_lb_addr eloc, tmpeloc; 663 struct kernel_lb_addr eloc, tmpeloc;
664 int c = 1; 664 int c = 1;
665 loff_t lbcount = 0, b_off = 0; 665 loff_t lbcount = 0, b_off = 0;
666 uint32_t newblocknum, newblock; 666 udf_pblk_t newblocknum, newblock;
667 sector_t offset = 0; 667 sector_t offset = 0;
668 int8_t etype; 668 int8_t etype;
669 struct udf_inode_info *iinfo = UDF_I(inode); 669 struct udf_inode_info *iinfo = UDF_I(inode);
670 int goal = 0, pgoal = iinfo->i_location.logicalBlockNum; 670 udf_pblk_t goal = 0, pgoal = iinfo->i_location.logicalBlockNum;
671 int lastblock = 0; 671 int lastblock = 0;
672 bool isBeyondEOF; 672 bool isBeyondEOF;
673 673
@@ -879,8 +879,8 @@ out_free:
879} 879}
880 880
881static void udf_split_extents(struct inode *inode, int *c, int offset, 881static void udf_split_extents(struct inode *inode, int *c, int offset,
882 int newblocknum, struct kernel_long_ad *laarr, 882 udf_pblk_t newblocknum,
883 int *endnum) 883 struct kernel_long_ad *laarr, int *endnum)
884{ 884{
885 unsigned long blocksize = inode->i_sb->s_blocksize; 885 unsigned long blocksize = inode->i_sb->s_blocksize;
886 unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits; 886 unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits;
@@ -1166,7 +1166,7 @@ static void udf_update_extents(struct inode *inode, struct kernel_long_ad *laarr
1166 } 1166 }
1167} 1167}
1168 1168
1169struct buffer_head *udf_bread(struct inode *inode, int block, 1169struct buffer_head *udf_bread(struct inode *inode, udf_pblk_t block,
1170 int create, int *err) 1170 int create, int *err)
1171{ 1171{
1172 struct buffer_head *bh = NULL; 1172 struct buffer_head *bh = NULL;
@@ -1193,7 +1193,7 @@ int udf_setsize(struct inode *inode, loff_t newsize)
1193{ 1193{
1194 int err; 1194 int err;
1195 struct udf_inode_info *iinfo; 1195 struct udf_inode_info *iinfo;
1196 int bsize = i_blocksize(inode); 1196 unsigned int bsize = i_blocksize(inode);
1197 1197
1198 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || 1198 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
1199 S_ISLNK(inode->i_mode))) 1199 S_ISLNK(inode->i_mode)))
@@ -1278,14 +1278,14 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
1278 1278
1279reread: 1279reread:
1280 if (iloc->partitionReferenceNum >= sbi->s_partitions) { 1280 if (iloc->partitionReferenceNum >= sbi->s_partitions) {
1281 udf_debug("partition reference: %d > logical volume partitions: %d\n", 1281 udf_debug("partition reference: %u > logical volume partitions: %u\n",
1282 iloc->partitionReferenceNum, sbi->s_partitions); 1282 iloc->partitionReferenceNum, sbi->s_partitions);
1283 return -EIO; 1283 return -EIO;
1284 } 1284 }
1285 1285
1286 if (iloc->logicalBlockNum >= 1286 if (iloc->logicalBlockNum >=
1287 sbi->s_partmaps[iloc->partitionReferenceNum].s_partition_len) { 1287 sbi->s_partmaps[iloc->partitionReferenceNum].s_partition_len) {
1288 udf_debug("block=%d, partition=%d out of range\n", 1288 udf_debug("block=%u, partition=%u out of range\n",
1289 iloc->logicalBlockNum, iloc->partitionReferenceNum); 1289 iloc->logicalBlockNum, iloc->partitionReferenceNum);
1290 return -EIO; 1290 return -EIO;
1291 } 1291 }
@@ -1304,13 +1304,13 @@ reread:
1304 */ 1304 */
1305 bh = udf_read_ptagged(inode->i_sb, iloc, 0, &ident); 1305 bh = udf_read_ptagged(inode->i_sb, iloc, 0, &ident);
1306 if (!bh) { 1306 if (!bh) {
1307 udf_err(inode->i_sb, "(ino %ld) failed !bh\n", inode->i_ino); 1307 udf_err(inode->i_sb, "(ino %lu) failed !bh\n", inode->i_ino);
1308 return -EIO; 1308 return -EIO;
1309 } 1309 }
1310 1310
1311 if (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE && 1311 if (ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE &&
1312 ident != TAG_IDENT_USE) { 1312 ident != TAG_IDENT_USE) {
1313 udf_err(inode->i_sb, "(ino %ld) failed ident=%d\n", 1313 udf_err(inode->i_sb, "(ino %lu) failed ident=%u\n",
1314 inode->i_ino, ident); 1314 inode->i_ino, ident);
1315 goto out; 1315 goto out;
1316 } 1316 }
@@ -1346,7 +1346,7 @@ reread:
1346 } 1346 }
1347 brelse(ibh); 1347 brelse(ibh);
1348 } else if (fe->icbTag.strategyType != cpu_to_le16(4)) { 1348 } else if (fe->icbTag.strategyType != cpu_to_le16(4)) {
1349 udf_err(inode->i_sb, "unsupported strategy type: %d\n", 1349 udf_err(inode->i_sb, "unsupported strategy type: %u\n",
1350 le16_to_cpu(fe->icbTag.strategyType)); 1350 le16_to_cpu(fe->icbTag.strategyType));
1351 goto out; 1351 goto out;
1352 } 1352 }
@@ -1547,7 +1547,7 @@ reread:
1547 udf_debug("METADATA BITMAP FILE-----\n"); 1547 udf_debug("METADATA BITMAP FILE-----\n");
1548 break; 1548 break;
1549 default: 1549 default:
1550 udf_err(inode->i_sb, "(ino %ld) failed unknown file type=%d\n", 1550 udf_err(inode->i_sb, "(ino %lu) failed unknown file type=%u\n",
1551 inode->i_ino, fe->icbTag.fileType); 1551 inode->i_ino, fe->icbTag.fileType);
1552 goto out; 1552 goto out;
1553 } 1553 }
@@ -1852,7 +1852,7 @@ struct inode *__udf_iget(struct super_block *sb, struct kernel_lb_addr *ino,
1852 return inode; 1852 return inode;
1853} 1853}
1854 1854
1855int udf_setup_indirect_aext(struct inode *inode, int block, 1855int udf_setup_indirect_aext(struct inode *inode, udf_pblk_t block,
1856 struct extent_position *epos) 1856 struct extent_position *epos)
1857{ 1857{
1858 struct super_block *sb = inode->i_sb; 1858 struct super_block *sb = inode->i_sb;
@@ -1994,7 +1994,7 @@ int udf_add_aext(struct inode *inode, struct extent_position *epos,
1994 1994
1995 if (epos->offset + (2 * adsize) > sb->s_blocksize) { 1995 if (epos->offset + (2 * adsize) > sb->s_blocksize) {
1996 int err; 1996 int err;
1997 int new_block; 1997 udf_pblk_t new_block;
1998 1998
1999 new_block = udf_new_block(sb, NULL, 1999 new_block = udf_new_block(sb, NULL,
2000 epos->block.partitionReferenceNum, 2000 epos->block.partitionReferenceNum,
@@ -2076,7 +2076,7 @@ int8_t udf_next_aext(struct inode *inode, struct extent_position *epos,
2076 2076
2077 while ((etype = udf_current_aext(inode, epos, eloc, elen, inc)) == 2077 while ((etype = udf_current_aext(inode, epos, eloc, elen, inc)) ==
2078 (EXT_NEXT_EXTENT_ALLOCDECS >> 30)) { 2078 (EXT_NEXT_EXTENT_ALLOCDECS >> 30)) {
2079 int block; 2079 udf_pblk_t block;
2080 2080
2081 if (++indirections > UDF_MAX_INDIR_EXTS) { 2081 if (++indirections > UDF_MAX_INDIR_EXTS) {
2082 udf_err(inode->i_sb, 2082 udf_err(inode->i_sb,
@@ -2091,7 +2091,7 @@ int8_t udf_next_aext(struct inode *inode, struct extent_position *epos,
2091 block = udf_get_lb_pblock(inode->i_sb, &epos->block, 0); 2091 block = udf_get_lb_pblock(inode->i_sb, &epos->block, 0);
2092 epos->bh = udf_tread(inode->i_sb, block); 2092 epos->bh = udf_tread(inode->i_sb, block);
2093 if (!epos->bh) { 2093 if (!epos->bh) {
2094 udf_debug("reading block %d failed!\n", block); 2094 udf_debug("reading block %u failed!\n", block);
2095 return -1; 2095 return -1;
2096 } 2096 }
2097 } 2097 }
@@ -2146,7 +2146,7 @@ int8_t udf_current_aext(struct inode *inode, struct extent_position *epos,
2146 *elen = le32_to_cpu(lad->extLength) & UDF_EXTENT_LENGTH_MASK; 2146 *elen = le32_to_cpu(lad->extLength) & UDF_EXTENT_LENGTH_MASK;
2147 break; 2147 break;
2148 default: 2148 default:
2149 udf_debug("alloc_type = %d unsupported\n", iinfo->i_alloc_type); 2149 udf_debug("alloc_type = %u unsupported\n", iinfo->i_alloc_type);
2150 return -1; 2150 return -1;
2151 } 2151 }
2152 2152
@@ -2289,13 +2289,13 @@ int8_t inode_bmap(struct inode *inode, sector_t block,
2289 return etype; 2289 return etype;
2290} 2290}
2291 2291
2292long udf_block_map(struct inode *inode, sector_t block) 2292udf_pblk_t udf_block_map(struct inode *inode, sector_t block)
2293{ 2293{
2294 struct kernel_lb_addr eloc; 2294 struct kernel_lb_addr eloc;
2295 uint32_t elen; 2295 uint32_t elen;
2296 sector_t offset; 2296 sector_t offset;
2297 struct extent_position epos = {}; 2297 struct extent_position epos = {};
2298 int ret; 2298 udf_pblk_t ret;
2299 2299
2300 down_read(&UDF_I(inode)->i_data_sem); 2300 down_read(&UDF_I(inode)->i_data_sem);
2301 2301
diff --git a/fs/udf/misc.c b/fs/udf/misc.c
index 3949c4bec3a3..401e64cde1be 100644
--- a/fs/udf/misc.c
+++ b/fs/udf/misc.c
@@ -28,7 +28,7 @@
28#include "udf_i.h" 28#include "udf_i.h"
29#include "udf_sb.h" 29#include "udf_sb.h"
30 30
31struct buffer_head *udf_tgetblk(struct super_block *sb, int block) 31struct buffer_head *udf_tgetblk(struct super_block *sb, udf_pblk_t block)
32{ 32{
33 if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV)) 33 if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV))
34 return sb_getblk(sb, udf_fixed_to_variable(block)); 34 return sb_getblk(sb, udf_fixed_to_variable(block));
@@ -36,7 +36,7 @@ struct buffer_head *udf_tgetblk(struct super_block *sb, int block)
36 return sb_getblk(sb, block); 36 return sb_getblk(sb, block);
37} 37}
38 38
39struct buffer_head *udf_tread(struct super_block *sb, int block) 39struct buffer_head *udf_tread(struct super_block *sb, udf_pblk_t block)
40{ 40{
41 if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV)) 41 if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV))
42 return sb_bread(sb, udf_fixed_to_variable(block)); 42 return sb_bread(sb, udf_fixed_to_variable(block));
@@ -209,7 +209,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
209 209
210 bh = udf_tread(sb, block); 210 bh = udf_tread(sb, block);
211 if (!bh) { 211 if (!bh) {
212 udf_err(sb, "read failed, block=%u, location=%d\n", 212 udf_err(sb, "read failed, block=%u, location=%u\n",
213 block, location); 213 block, location);
214 return NULL; 214 return NULL;
215 } 215 }
@@ -247,7 +247,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
247 le16_to_cpu(tag_p->descCRCLength))) 247 le16_to_cpu(tag_p->descCRCLength)))
248 return bh; 248 return bh;
249 249
250 udf_debug("Crc failure block %d: crc = %d, crclen = %d\n", block, 250 udf_debug("Crc failure block %u: crc = %u, crclen = %u\n", block,
251 le16_to_cpu(tag_p->descCRC), 251 le16_to_cpu(tag_p->descCRC),
252 le16_to_cpu(tag_p->descCRCLength)); 252 le16_to_cpu(tag_p->descCRCLength));
253error_out: 253error_out:
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index 885198dfd9f8..0458dd47e105 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -164,7 +164,8 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir,
164{ 164{
165 struct fileIdentDesc *fi = NULL; 165 struct fileIdentDesc *fi = NULL;
166 loff_t f_pos; 166 loff_t f_pos;
167 int block, flen; 167 udf_pblk_t block;
168 int flen;
168 unsigned char *fname = NULL, *copy_name = NULL; 169 unsigned char *fname = NULL, *copy_name = NULL;
169 unsigned char *nameptr; 170 unsigned char *nameptr;
170 uint8_t lfi; 171 uint8_t lfi;
@@ -352,7 +353,7 @@ static struct fileIdentDesc *udf_add_entry(struct inode *dir,
352 int nfidlen; 353 int nfidlen;
353 uint8_t lfi; 354 uint8_t lfi;
354 uint16_t liu; 355 uint16_t liu;
355 int block; 356 udf_pblk_t block;
356 struct kernel_lb_addr eloc; 357 struct kernel_lb_addr eloc;
357 uint32_t elen = 0; 358 uint32_t elen = 0;
358 sector_t offset; 359 sector_t offset;
@@ -749,7 +750,7 @@ static int empty_dir(struct inode *dir)
749 struct udf_fileident_bh fibh; 750 struct udf_fileident_bh fibh;
750 loff_t f_pos; 751 loff_t f_pos;
751 loff_t size = udf_ext0_offset(dir) + dir->i_size; 752 loff_t size = udf_ext0_offset(dir) + dir->i_size;
752 int block; 753 udf_pblk_t block;
753 struct kernel_lb_addr eloc; 754 struct kernel_lb_addr eloc;
754 uint32_t elen; 755 uint32_t elen;
755 sector_t offset; 756 sector_t offset;
@@ -839,7 +840,7 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry)
839 if (retval) 840 if (retval)
840 goto end_rmdir; 841 goto end_rmdir;
841 if (inode->i_nlink != 2) 842 if (inode->i_nlink != 2)
842 udf_warn(inode->i_sb, "empty directory has nlink != 2 (%d)\n", 843 udf_warn(inode->i_sb, "empty directory has nlink != 2 (%u)\n",
843 inode->i_nlink); 844 inode->i_nlink);
844 clear_nlink(inode); 845 clear_nlink(inode);
845 inode->i_size = 0; 846 inode->i_size = 0;
@@ -881,7 +882,7 @@ static int udf_unlink(struct inode *dir, struct dentry *dentry)
881 goto end_unlink; 882 goto end_unlink;
882 883
883 if (!inode->i_nlink) { 884 if (!inode->i_nlink) {
884 udf_debug("Deleting nonexistent file (%lu), %d\n", 885 udf_debug("Deleting nonexistent file (%lu), %u\n",
885 inode->i_ino, inode->i_nlink); 886 inode->i_ino, inode->i_nlink);
886 set_nlink(inode, 1); 887 set_nlink(inode, 1);
887 } 888 }
@@ -913,7 +914,7 @@ static int udf_symlink(struct inode *dir, struct dentry *dentry,
913 int eoffset, elen = 0; 914 int eoffset, elen = 0;
914 uint8_t *ea; 915 uint8_t *ea;
915 int err; 916 int err;
916 int block; 917 udf_pblk_t block;
917 unsigned char *name = NULL; 918 unsigned char *name = NULL;
918 int namelen; 919 int namelen;
919 struct udf_inode_info *iinfo; 920 struct udf_inode_info *iinfo;
diff --git a/fs/udf/partition.c b/fs/udf/partition.c
index 888c364b2fe9..090baff83990 100644
--- a/fs/udf/partition.c
+++ b/fs/udf/partition.c
@@ -32,7 +32,7 @@ uint32_t udf_get_pblock(struct super_block *sb, uint32_t block,
32 struct udf_sb_info *sbi = UDF_SB(sb); 32 struct udf_sb_info *sbi = UDF_SB(sb);
33 struct udf_part_map *map; 33 struct udf_part_map *map;
34 if (partition >= sbi->s_partitions) { 34 if (partition >= sbi->s_partitions) {
35 udf_debug("block=%d, partition=%d, offset=%d: invalid partition\n", 35 udf_debug("block=%u, partition=%u, offset=%u: invalid partition\n",
36 block, partition, offset); 36 block, partition, offset);
37 return 0xFFFFFFFF; 37 return 0xFFFFFFFF;
38 } 38 }
@@ -59,7 +59,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
59 vdata = &map->s_type_specific.s_virtual; 59 vdata = &map->s_type_specific.s_virtual;
60 60
61 if (block > vdata->s_num_entries) { 61 if (block > vdata->s_num_entries) {
62 udf_debug("Trying to access block beyond end of VAT (%d max %d)\n", 62 udf_debug("Trying to access block beyond end of VAT (%u max %u)\n",
63 block, vdata->s_num_entries); 63 block, vdata->s_num_entries);
64 return 0xFFFFFFFF; 64 return 0xFFFFFFFF;
65 } 65 }
@@ -83,7 +83,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
83 83
84 bh = sb_bread(sb, loc); 84 bh = sb_bread(sb, loc);
85 if (!bh) { 85 if (!bh) {
86 udf_debug("get_pblock(UDF_VIRTUAL_MAP:%p,%d,%d) VAT: %d[%d]\n", 86 udf_debug("get_pblock(UDF_VIRTUAL_MAP:%p,%u,%u) VAT: %u[%u]\n",
87 sb, block, partition, loc, index); 87 sb, block, partition, loc, index);
88 return 0xFFFFFFFF; 88 return 0xFFFFFFFF;
89 } 89 }
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 99cb81d0077f..f80e0a0f24d3 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -366,7 +366,7 @@ static int udf_show_options(struct seq_file *seq, struct dentry *root)
366 if (sbi->s_dmode != UDF_INVALID_MODE) 366 if (sbi->s_dmode != UDF_INVALID_MODE)
367 seq_printf(seq, ",dmode=%ho", sbi->s_dmode); 367 seq_printf(seq, ",dmode=%ho", sbi->s_dmode);
368 if (UDF_QUERY_FLAG(sb, UDF_FLAG_SESSION_SET)) 368 if (UDF_QUERY_FLAG(sb, UDF_FLAG_SESSION_SET))
369 seq_printf(seq, ",session=%u", sbi->s_session); 369 seq_printf(seq, ",session=%d", sbi->s_session);
370 if (UDF_QUERY_FLAG(sb, UDF_FLAG_LASTBLOCK_SET)) 370 if (UDF_QUERY_FLAG(sb, UDF_FLAG_LASTBLOCK_SET))
371 seq_printf(seq, ",lastblock=%u", sbi->s_last_block); 371 seq_printf(seq, ",lastblock=%u", sbi->s_last_block);
372 if (sbi->s_anchor != 0) 372 if (sbi->s_anchor != 0)
@@ -703,9 +703,9 @@ static loff_t udf_check_vsd(struct super_block *sb)
703 else 703 else
704 sectorsize = sb->s_blocksize; 704 sectorsize = sb->s_blocksize;
705 705
706 sector += (sbi->s_session << sb->s_blocksize_bits); 706 sector += (((loff_t)sbi->s_session) << sb->s_blocksize_bits);
707 707
708 udf_debug("Starting at sector %u (%ld byte sectors)\n", 708 udf_debug("Starting at sector %u (%lu byte sectors)\n",
709 (unsigned int)(sector >> sb->s_blocksize_bits), 709 (unsigned int)(sector >> sb->s_blocksize_bits),
710 sb->s_blocksize); 710 sb->s_blocksize);
711 /* Process the sequence (if applicable). The hard limit on the sector 711 /* Process the sequence (if applicable). The hard limit on the sector
@@ -868,7 +868,7 @@ static int udf_find_fileset(struct super_block *sb,
868 868
869 if ((fileset->logicalBlockNum != 0xFFFFFFFF || 869 if ((fileset->logicalBlockNum != 0xFFFFFFFF ||
870 fileset->partitionReferenceNum != 0xFFFF) && bh) { 870 fileset->partitionReferenceNum != 0xFFFF) && bh) {
871 udf_debug("Fileset at block=%d, partition=%d\n", 871 udf_debug("Fileset at block=%u, partition=%u\n",
872 fileset->logicalBlockNum, 872 fileset->logicalBlockNum,
873 fileset->partitionReferenceNum); 873 fileset->partitionReferenceNum);
874 874
@@ -981,14 +981,14 @@ static int udf_load_metadata_files(struct super_block *sb, int partition,
981 mdata->s_phys_partition_ref = type1_index; 981 mdata->s_phys_partition_ref = type1_index;
982 982
983 /* metadata address */ 983 /* metadata address */
984 udf_debug("Metadata file location: block = %d part = %d\n", 984 udf_debug("Metadata file location: block = %u part = %u\n",
985 mdata->s_meta_file_loc, mdata->s_phys_partition_ref); 985 mdata->s_meta_file_loc, mdata->s_phys_partition_ref);
986 986
987 fe = udf_find_metadata_inode_efe(sb, mdata->s_meta_file_loc, 987 fe = udf_find_metadata_inode_efe(sb, mdata->s_meta_file_loc,
988 mdata->s_phys_partition_ref); 988 mdata->s_phys_partition_ref);
989 if (IS_ERR(fe)) { 989 if (IS_ERR(fe)) {
990 /* mirror file entry */ 990 /* mirror file entry */
991 udf_debug("Mirror metadata file location: block = %d part = %d\n", 991 udf_debug("Mirror metadata file location: block = %u part = %u\n",
992 mdata->s_mirror_file_loc, mdata->s_phys_partition_ref); 992 mdata->s_mirror_file_loc, mdata->s_phys_partition_ref);
993 993
994 fe = udf_find_metadata_inode_efe(sb, mdata->s_mirror_file_loc, 994 fe = udf_find_metadata_inode_efe(sb, mdata->s_mirror_file_loc,
@@ -1012,7 +1012,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition,
1012 addr.logicalBlockNum = mdata->s_bitmap_file_loc; 1012 addr.logicalBlockNum = mdata->s_bitmap_file_loc;
1013 addr.partitionReferenceNum = mdata->s_phys_partition_ref; 1013 addr.partitionReferenceNum = mdata->s_phys_partition_ref;
1014 1014
1015 udf_debug("Bitmap file location: block = %d part = %d\n", 1015 udf_debug("Bitmap file location: block = %u part = %u\n",
1016 addr.logicalBlockNum, addr.partitionReferenceNum); 1016 addr.logicalBlockNum, addr.partitionReferenceNum);
1017 1017
1018 fe = udf_iget_special(sb, &addr); 1018 fe = udf_iget_special(sb, &addr);
@@ -1042,7 +1042,7 @@ static void udf_load_fileset(struct super_block *sb, struct buffer_head *bh,
1042 1042
1043 UDF_SB(sb)->s_serial_number = le16_to_cpu(fset->descTag.tagSerialNum); 1043 UDF_SB(sb)->s_serial_number = le16_to_cpu(fset->descTag.tagSerialNum);
1044 1044
1045 udf_debug("Rootdir at block=%d, partition=%d\n", 1045 udf_debug("Rootdir at block=%u, partition=%u\n",
1046 root->logicalBlockNum, root->partitionReferenceNum); 1046 root->logicalBlockNum, root->partitionReferenceNum);
1047} 1047}
1048 1048
@@ -1097,7 +1097,7 @@ static int udf_fill_partdesc_info(struct super_block *sb,
1097 if (p->accessType == cpu_to_le32(PD_ACCESS_TYPE_OVERWRITABLE)) 1097 if (p->accessType == cpu_to_le32(PD_ACCESS_TYPE_OVERWRITABLE))
1098 map->s_partition_flags |= UDF_PART_FLAG_OVERWRITABLE; 1098 map->s_partition_flags |= UDF_PART_FLAG_OVERWRITABLE;
1099 1099
1100 udf_debug("Partition (%d type %x) starts at physical %d, block length %d\n", 1100 udf_debug("Partition (%d type %x) starts at physical %u, block length %u\n",
1101 p_index, map->s_partition_type, 1101 p_index, map->s_partition_type,
1102 map->s_partition_root, map->s_partition_len); 1102 map->s_partition_root, map->s_partition_len);
1103 1103
@@ -1122,7 +1122,7 @@ static int udf_fill_partdesc_info(struct super_block *sb,
1122 } 1122 }
1123 map->s_uspace.s_table = inode; 1123 map->s_uspace.s_table = inode;
1124 map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_TABLE; 1124 map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_TABLE;
1125 udf_debug("unallocSpaceTable (part %d) @ %ld\n", 1125 udf_debug("unallocSpaceTable (part %d) @ %lu\n",
1126 p_index, map->s_uspace.s_table->i_ino); 1126 p_index, map->s_uspace.s_table->i_ino);
1127 } 1127 }
1128 1128
@@ -1134,7 +1134,7 @@ static int udf_fill_partdesc_info(struct super_block *sb,
1134 bitmap->s_extPosition = le32_to_cpu( 1134 bitmap->s_extPosition = le32_to_cpu(
1135 phd->unallocSpaceBitmap.extPosition); 1135 phd->unallocSpaceBitmap.extPosition);
1136 map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_BITMAP; 1136 map->s_partition_flags |= UDF_PART_FLAG_UNALLOC_BITMAP;
1137 udf_debug("unallocSpaceBitmap (part %d) @ %d\n", 1137 udf_debug("unallocSpaceBitmap (part %d) @ %u\n",
1138 p_index, bitmap->s_extPosition); 1138 p_index, bitmap->s_extPosition);
1139 } 1139 }
1140 1140
@@ -1157,7 +1157,7 @@ static int udf_fill_partdesc_info(struct super_block *sb,
1157 } 1157 }
1158 map->s_fspace.s_table = inode; 1158 map->s_fspace.s_table = inode;
1159 map->s_partition_flags |= UDF_PART_FLAG_FREED_TABLE; 1159 map->s_partition_flags |= UDF_PART_FLAG_FREED_TABLE;
1160 udf_debug("freedSpaceTable (part %d) @ %ld\n", 1160 udf_debug("freedSpaceTable (part %d) @ %lu\n",
1161 p_index, map->s_fspace.s_table->i_ino); 1161 p_index, map->s_fspace.s_table->i_ino);
1162 } 1162 }
1163 1163
@@ -1169,7 +1169,7 @@ static int udf_fill_partdesc_info(struct super_block *sb,
1169 bitmap->s_extPosition = le32_to_cpu( 1169 bitmap->s_extPosition = le32_to_cpu(
1170 phd->freedSpaceBitmap.extPosition); 1170 phd->freedSpaceBitmap.extPosition);
1171 map->s_partition_flags |= UDF_PART_FLAG_FREED_BITMAP; 1171 map->s_partition_flags |= UDF_PART_FLAG_FREED_BITMAP;
1172 udf_debug("freedSpaceBitmap (part %d) @ %d\n", 1172 udf_debug("freedSpaceBitmap (part %d) @ %u\n",
1173 p_index, bitmap->s_extPosition); 1173 p_index, bitmap->s_extPosition);
1174 } 1174 }
1175 return 0; 1175 return 0;
@@ -1282,7 +1282,7 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block)
1282 /* First scan for TYPE1 and SPARABLE partitions */ 1282 /* First scan for TYPE1 and SPARABLE partitions */
1283 for (i = 0; i < sbi->s_partitions; i++) { 1283 for (i = 0; i < sbi->s_partitions; i++) {
1284 map = &sbi->s_partmaps[i]; 1284 map = &sbi->s_partmaps[i];
1285 udf_debug("Searching map: (%d == %d)\n", 1285 udf_debug("Searching map: (%u == %u)\n",
1286 map->s_partition_num, partitionNumber); 1286 map->s_partition_num, partitionNumber);
1287 if (map->s_partition_num == partitionNumber && 1287 if (map->s_partition_num == partitionNumber &&
1288 (map->s_partition_type == UDF_TYPE1_MAP15 || 1288 (map->s_partition_type == UDF_TYPE1_MAP15 ||
@@ -1291,7 +1291,7 @@ static int udf_load_partdesc(struct super_block *sb, sector_t block)
1291 } 1291 }
1292 1292
1293 if (i >= sbi->s_partitions) { 1293 if (i >= sbi->s_partitions) {
1294 udf_debug("Partition (%d) not found in partition map\n", 1294 udf_debug("Partition (%u) not found in partition map\n",
1295 partitionNumber); 1295 partitionNumber);
1296 ret = 0; 1296 ret = 0;
1297 goto out_bh; 1297 goto out_bh;
@@ -1483,7 +1483,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,
1483 struct metadataPartitionMap *mdm = 1483 struct metadataPartitionMap *mdm =
1484 (struct metadataPartitionMap *) 1484 (struct metadataPartitionMap *)
1485 &(lvd->partitionMaps[offset]); 1485 &(lvd->partitionMaps[offset]);
1486 udf_debug("Parsing Logical vol part %d type %d id=%s\n", 1486 udf_debug("Parsing Logical vol part %d type %u id=%s\n",
1487 i, type, UDF_ID_METADATA); 1487 i, type, UDF_ID_METADATA);
1488 1488
1489 map->s_partition_type = UDF_METADATA_MAP25; 1489 map->s_partition_type = UDF_METADATA_MAP25;
@@ -1505,17 +1505,17 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,
1505 udf_debug("Metadata Ident suffix=0x%x\n", 1505 udf_debug("Metadata Ident suffix=0x%x\n",
1506 le16_to_cpu(*(__le16 *) 1506 le16_to_cpu(*(__le16 *)
1507 mdm->partIdent.identSuffix)); 1507 mdm->partIdent.identSuffix));
1508 udf_debug("Metadata part num=%d\n", 1508 udf_debug("Metadata part num=%u\n",
1509 le16_to_cpu(mdm->partitionNum)); 1509 le16_to_cpu(mdm->partitionNum));
1510 udf_debug("Metadata part alloc unit size=%d\n", 1510 udf_debug("Metadata part alloc unit size=%u\n",
1511 le32_to_cpu(mdm->allocUnitSize)); 1511 le32_to_cpu(mdm->allocUnitSize));
1512 udf_debug("Metadata file loc=%d\n", 1512 udf_debug("Metadata file loc=%u\n",
1513 le32_to_cpu(mdm->metadataFileLoc)); 1513 le32_to_cpu(mdm->metadataFileLoc));
1514 udf_debug("Mirror file loc=%d\n", 1514 udf_debug("Mirror file loc=%u\n",
1515 le32_to_cpu(mdm->metadataMirrorFileLoc)); 1515 le32_to_cpu(mdm->metadataMirrorFileLoc));
1516 udf_debug("Bitmap file loc=%d\n", 1516 udf_debug("Bitmap file loc=%u\n",
1517 le32_to_cpu(mdm->metadataBitmapFileLoc)); 1517 le32_to_cpu(mdm->metadataBitmapFileLoc));
1518 udf_debug("Flags: %d %d\n", 1518 udf_debug("Flags: %d %u\n",
1519 mdata->s_flags, mdm->flags); 1519 mdata->s_flags, mdm->flags);
1520 } else { 1520 } else {
1521 udf_debug("Unknown ident: %s\n", 1521 udf_debug("Unknown ident: %s\n",
@@ -1525,7 +1525,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,
1525 map->s_volumeseqnum = le16_to_cpu(upm2->volSeqNum); 1525 map->s_volumeseqnum = le16_to_cpu(upm2->volSeqNum);
1526 map->s_partition_num = le16_to_cpu(upm2->partitionNum); 1526 map->s_partition_num = le16_to_cpu(upm2->partitionNum);
1527 } 1527 }
1528 udf_debug("Partition (%d:%d) type %d on volume %d\n", 1528 udf_debug("Partition (%d:%u) type %u on volume %u\n",
1529 i, map->s_partition_num, type, map->s_volumeseqnum); 1529 i, map->s_partition_num, type, map->s_volumeseqnum);
1530 } 1530 }
1531 1531
@@ -1533,7 +1533,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block,
1533 struct long_ad *la = (struct long_ad *)&(lvd->logicalVolContentsUse[0]); 1533 struct long_ad *la = (struct long_ad *)&(lvd->logicalVolContentsUse[0]);
1534 1534
1535 *fileset = lelb_to_cpu(la->extLocation); 1535 *fileset = lelb_to_cpu(la->extLocation);
1536 udf_debug("FileSet found in LogicalVolDesc at block=%d, partition=%d\n", 1536 udf_debug("FileSet found in LogicalVolDesc at block=%u, partition=%u\n",
1537 fileset->logicalBlockNum, 1537 fileset->logicalBlockNum,
1538 fileset->partitionReferenceNum); 1538 fileset->partitionReferenceNum);
1539 } 1539 }
@@ -2159,7 +2159,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
2159 ret = udf_load_vrs(sb, &uopt, silent, &fileset); 2159 ret = udf_load_vrs(sb, &uopt, silent, &fileset);
2160 if (ret < 0) { 2160 if (ret < 0) {
2161 if (!silent && ret != -EACCES) { 2161 if (!silent && ret != -EACCES) {
2162 pr_notice("Scanning with blocksize %d failed\n", 2162 pr_notice("Scanning with blocksize %u failed\n",
2163 uopt.blocksize); 2163 uopt.blocksize);
2164 } 2164 }
2165 brelse(sbi->s_lvid_bh); 2165 brelse(sbi->s_lvid_bh);
@@ -2184,7 +2184,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
2184 goto error_out; 2184 goto error_out;
2185 } 2185 }
2186 2186
2187 udf_debug("Lastblock=%d\n", sbi->s_last_block); 2187 udf_debug("Lastblock=%u\n", sbi->s_last_block);
2188 2188
2189 if (sbi->s_lvid_bh) { 2189 if (sbi->s_lvid_bh) {
2190 struct logicalVolIntegrityDescImpUse *lvidiu = 2190 struct logicalVolIntegrityDescImpUse *lvidiu =
@@ -2255,7 +2255,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
2255 /* perhaps it's not extensible enough, but for now ... */ 2255 /* perhaps it's not extensible enough, but for now ... */
2256 inode = udf_iget(sb, &rootdir); 2256 inode = udf_iget(sb, &rootdir);
2257 if (IS_ERR(inode)) { 2257 if (IS_ERR(inode)) {
2258 udf_err(sb, "Error in udf_iget, block=%d, partition=%d\n", 2258 udf_err(sb, "Error in udf_iget, block=%u, partition=%u\n",
2259 rootdir.logicalBlockNum, rootdir.partitionReferenceNum); 2259 rootdir.logicalBlockNum, rootdir.partitionReferenceNum);
2260 ret = PTR_ERR(inode); 2260 ret = PTR_ERR(inode);
2261 goto error_out; 2261 goto error_out;
@@ -2389,7 +2389,7 @@ static unsigned int udf_count_free_bitmap(struct super_block *sb,
2389 struct buffer_head *bh = NULL; 2389 struct buffer_head *bh = NULL;
2390 unsigned int accum = 0; 2390 unsigned int accum = 0;
2391 int index; 2391 int index;
2392 int block = 0, newblock; 2392 udf_pblk_t block = 0, newblock;
2393 struct kernel_lb_addr loc; 2393 struct kernel_lb_addr loc;
2394 uint32_t bytes; 2394 uint32_t bytes;
2395 uint8_t *ptr; 2395 uint8_t *ptr;
diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c
index 42b8c57795cb..b647f0bd150c 100644
--- a/fs/udf/truncate.c
+++ b/fs/udf/truncate.c
@@ -48,7 +48,7 @@ static void extent_trunc(struct inode *inode, struct extent_position *epos,
48 48
49 if (elen != nelen) { 49 if (elen != nelen) {
50 udf_write_aext(inode, epos, &neloc, nelen, 0); 50 udf_write_aext(inode, epos, &neloc, nelen, 0);
51 if (last_block - first_block > 0) { 51 if (last_block > first_block) {
52 if (etype == (EXT_RECORDED_ALLOCATED >> 30)) 52 if (etype == (EXT_RECORDED_ALLOCATED >> 30))
53 mark_inode_dirty(inode); 53 mark_inode_dirty(inode);
54 54
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index fa206558128d..f5e0fe78979e 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -74,6 +74,8 @@ static inline size_t udf_ext0_offset(struct inode *inode)
74/* computes tag checksum */ 74/* computes tag checksum */
75u8 udf_tag_checksum(const struct tag *t); 75u8 udf_tag_checksum(const struct tag *t);
76 76
77typedef uint32_t udf_pblk_t;
78
77struct dentry; 79struct dentry;
78struct inode; 80struct inode;
79struct task_struct; 81struct task_struct;
@@ -145,15 +147,17 @@ static inline struct inode *udf_iget(struct super_block *sb,
145 return __udf_iget(sb, ino, false); 147 return __udf_iget(sb, ino, false);
146} 148}
147extern int udf_expand_file_adinicb(struct inode *); 149extern int udf_expand_file_adinicb(struct inode *);
148extern struct buffer_head *udf_expand_dir_adinicb(struct inode *, int *, int *); 150extern struct buffer_head *udf_expand_dir_adinicb(struct inode *inode,
149extern struct buffer_head *udf_bread(struct inode *, int, int, int *); 151 udf_pblk_t *block, int *err);
152extern struct buffer_head *udf_bread(struct inode *inode, udf_pblk_t block,
153 int create, int *err);
150extern int udf_setsize(struct inode *, loff_t); 154extern int udf_setsize(struct inode *, loff_t);
151extern void udf_evict_inode(struct inode *); 155extern void udf_evict_inode(struct inode *);
152extern int udf_write_inode(struct inode *, struct writeback_control *wbc); 156extern int udf_write_inode(struct inode *, struct writeback_control *wbc);
153extern long udf_block_map(struct inode *, sector_t); 157extern udf_pblk_t udf_block_map(struct inode *inode, sector_t block);
154extern int8_t inode_bmap(struct inode *, sector_t, struct extent_position *, 158extern int8_t inode_bmap(struct inode *, sector_t, struct extent_position *,
155 struct kernel_lb_addr *, uint32_t *, sector_t *); 159 struct kernel_lb_addr *, uint32_t *, sector_t *);
156extern int udf_setup_indirect_aext(struct inode *inode, int block, 160extern int udf_setup_indirect_aext(struct inode *inode, udf_pblk_t block,
157 struct extent_position *epos); 161 struct extent_position *epos);
158extern int __udf_add_aext(struct inode *inode, struct extent_position *epos, 162extern int __udf_add_aext(struct inode *inode, struct extent_position *epos,
159 struct kernel_lb_addr *eloc, uint32_t elen, int inc); 163 struct kernel_lb_addr *eloc, uint32_t elen, int inc);
@@ -169,8 +173,9 @@ extern int8_t udf_current_aext(struct inode *, struct extent_position *,
169 struct kernel_lb_addr *, uint32_t *, int); 173 struct kernel_lb_addr *, uint32_t *, int);
170 174
171/* misc.c */ 175/* misc.c */
172extern struct buffer_head *udf_tgetblk(struct super_block *, int); 176extern struct buffer_head *udf_tgetblk(struct super_block *sb,
173extern struct buffer_head *udf_tread(struct super_block *, int); 177 udf_pblk_t block);
178extern struct buffer_head *udf_tread(struct super_block *sb, udf_pblk_t block);
174extern struct genericFormat *udf_add_extendedattr(struct inode *, uint32_t, 179extern struct genericFormat *udf_add_extendedattr(struct inode *, uint32_t,
175 uint32_t, uint8_t); 180 uint32_t, uint8_t);
176extern struct genericFormat *udf_get_extendedattr(struct inode *, uint32_t, 181extern struct genericFormat *udf_get_extendedattr(struct inode *, uint32_t,
@@ -229,8 +234,8 @@ extern void udf_free_blocks(struct super_block *, struct inode *,
229 struct kernel_lb_addr *, uint32_t, uint32_t); 234 struct kernel_lb_addr *, uint32_t, uint32_t);
230extern int udf_prealloc_blocks(struct super_block *, struct inode *, uint16_t, 235extern int udf_prealloc_blocks(struct super_block *, struct inode *, uint16_t,
231 uint32_t, uint32_t); 236 uint32_t, uint32_t);
232extern int udf_new_block(struct super_block *, struct inode *, uint16_t, 237extern udf_pblk_t udf_new_block(struct super_block *sb, struct inode *inode,
233 uint32_t, int *); 238 uint16_t partition, uint32_t goal, int *err);
234 239
235/* directory.c */ 240/* directory.c */
236extern struct fileIdentDesc *udf_fileident_read(struct inode *, loff_t *, 241extern struct fileIdentDesc *udf_fileident_read(struct inode *, loff_t *,
diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c
index 695389a4fc23..f897e55f2cd0 100644
--- a/fs/udf/unicode.c
+++ b/fs/udf/unicode.c
@@ -200,7 +200,7 @@ static int udf_name_from_CS0(uint8_t *str_o, int str_max_len,
200 cmp_id = ocu[0]; 200 cmp_id = ocu[0];
201 if (cmp_id != 8 && cmp_id != 16) { 201 if (cmp_id != 8 && cmp_id != 16) {
202 memset(str_o, 0, str_max_len); 202 memset(str_o, 0, str_max_len);
203 pr_err("unknown compression code (%d)\n", cmp_id); 203 pr_err("unknown compression code (%u)\n", cmp_id);
204 return -EINVAL; 204 return -EINVAL;
205 } 205 }
206 u_ch = cmp_id >> 3; 206 u_ch = cmp_id >> 3;