diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-24 12:57:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-24 12:57:10 -0400 |
commit | d7ed9c05ebf56c04811276207d7110706debe09f (patch) | |
tree | 8248800681e1dc4ea0385ea6f821387f2d56baa7 /fs | |
parent | 4d8d4d251df8eaaa3dae71c8cfa7fbf4510d967d (diff) | |
parent | 3391faa4f18e4e33666d3d24e90e3086fcf9b922 (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-udf-2.6
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-udf-2.6:
udf: remove redundant tests on unsigned
udf: Use device size when drive reported bogus number of written blocks
Diffstat (limited to 'fs')
-rw-r--r-- | fs/udf/balloc.c | 9 | ||||
-rw-r--r-- | fs/udf/lowlevel.c | 7 |
2 files changed, 10 insertions, 6 deletions
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c index e48e9a3af763..1e068535b58b 100644 --- a/fs/udf/balloc.c +++ b/fs/udf/balloc.c | |||
@@ -238,7 +238,7 @@ static int udf_bitmap_prealloc_blocks(struct super_block *sb, | |||
238 | 238 | ||
239 | mutex_lock(&sbi->s_alloc_mutex); | 239 | mutex_lock(&sbi->s_alloc_mutex); |
240 | part_len = sbi->s_partmaps[partition].s_partition_len; | 240 | part_len = sbi->s_partmaps[partition].s_partition_len; |
241 | if (first_block < 0 || first_block >= part_len) | 241 | if (first_block >= part_len) |
242 | goto out; | 242 | goto out; |
243 | 243 | ||
244 | if (first_block + block_count > part_len) | 244 | if (first_block + block_count > part_len) |
@@ -297,7 +297,7 @@ static int udf_bitmap_new_block(struct super_block *sb, | |||
297 | mutex_lock(&sbi->s_alloc_mutex); | 297 | mutex_lock(&sbi->s_alloc_mutex); |
298 | 298 | ||
299 | repeat: | 299 | repeat: |
300 | if (goal < 0 || goal >= sbi->s_partmaps[partition].s_partition_len) | 300 | if (goal >= sbi->s_partmaps[partition].s_partition_len) |
301 | goal = 0; | 301 | goal = 0; |
302 | 302 | ||
303 | nr_groups = bitmap->s_nr_groups; | 303 | nr_groups = bitmap->s_nr_groups; |
@@ -666,8 +666,7 @@ static int udf_table_prealloc_blocks(struct super_block *sb, | |||
666 | int8_t etype = -1; | 666 | int8_t etype = -1; |
667 | struct udf_inode_info *iinfo; | 667 | struct udf_inode_info *iinfo; |
668 | 668 | ||
669 | if (first_block < 0 || | 669 | if (first_block >= sbi->s_partmaps[partition].s_partition_len) |
670 | first_block >= sbi->s_partmaps[partition].s_partition_len) | ||
671 | return 0; | 670 | return 0; |
672 | 671 | ||
673 | iinfo = UDF_I(table); | 672 | iinfo = UDF_I(table); |
@@ -743,7 +742,7 @@ static int udf_table_new_block(struct super_block *sb, | |||
743 | return newblock; | 742 | return newblock; |
744 | 743 | ||
745 | mutex_lock(&sbi->s_alloc_mutex); | 744 | mutex_lock(&sbi->s_alloc_mutex); |
746 | if (goal < 0 || goal >= sbi->s_partmaps[partition].s_partition_len) | 745 | if (goal >= sbi->s_partmaps[partition].s_partition_len) |
747 | goal = 0; | 746 | goal = 0; |
748 | 747 | ||
749 | /* We search for the closest matching block to goal. If we find | 748 | /* We search for the closest matching block to goal. If we find |
diff --git a/fs/udf/lowlevel.c b/fs/udf/lowlevel.c index 703843f30ffd..1b88fd5df05d 100644 --- a/fs/udf/lowlevel.c +++ b/fs/udf/lowlevel.c | |||
@@ -56,7 +56,12 @@ unsigned long udf_get_last_block(struct super_block *sb) | |||
56 | struct block_device *bdev = sb->s_bdev; | 56 | struct block_device *bdev = sb->s_bdev; |
57 | unsigned long lblock = 0; | 57 | unsigned long lblock = 0; |
58 | 58 | ||
59 | if (ioctl_by_bdev(bdev, CDROM_LAST_WRITTEN, (unsigned long) &lblock)) | 59 | /* |
60 | * ioctl failed or returned obviously bogus value? | ||
61 | * Try using the device size... | ||
62 | */ | ||
63 | if (ioctl_by_bdev(bdev, CDROM_LAST_WRITTEN, (unsigned long) &lblock) || | ||
64 | lblock == 0) | ||
60 | lblock = bdev->bd_inode->i_size >> sb->s_blocksize_bits; | 65 | lblock = bdev->bd_inode->i_size >> sb->s_blocksize_bits; |
61 | 66 | ||
62 | if (lblock) | 67 | if (lblock) |