diff options
author | Jan Kara <jack@suse.cz> | 2008-04-07 10:15:04 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2008-04-17 08:23:13 -0400 |
commit | 5fb28aa25ab0b71af2e441d68e63ad257e610a04 (patch) | |
tree | e0cba62535022802a4b47e5d04d49e2cc9f93ced /fs/udf/super.c | |
parent | 423cf6dc04eb79d441bfda2b127bc4b57134b41d (diff) |
udf: Improve anchor block detection
Add <last block>+1 and <last block>-1 to a list of blocks which can be the
real last recorded block on a UDF media. Sebastian Manciulea
<manciuleas@yahoo.com> claims this helps some drive + media combinations
he is able to test.
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf/super.c')
-rw-r--r-- | fs/udf/super.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c index fe0dafebde7..b9e719de070 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -709,14 +709,16 @@ static int udf_check_anchor_block(struct super_block *sb, sector_t block, | |||
709 | static sector_t udf_scan_anchors(struct super_block *sb, bool varconv, | 709 | static sector_t udf_scan_anchors(struct super_block *sb, bool varconv, |
710 | sector_t lastblock) | 710 | sector_t lastblock) |
711 | { | 711 | { |
712 | sector_t last[4]; | 712 | sector_t last[6]; |
713 | int i; | 713 | int i; |
714 | struct udf_sb_info *sbi = UDF_SB(sb); | 714 | struct udf_sb_info *sbi = UDF_SB(sb); |
715 | 715 | ||
716 | last[0] = lastblock; | 716 | last[0] = lastblock; |
717 | last[1] = last[0] - 2; | 717 | last[1] = last[0] - 1; |
718 | last[2] = last[0] - 150; | 718 | last[2] = last[0] + 1; |
719 | last[3] = last[0] - 152; | 719 | last[3] = last[0] - 2; |
720 | last[4] = last[0] - 150; | ||
721 | last[5] = last[0] - 152; | ||
720 | 722 | ||
721 | /* according to spec, anchor is in either: | 723 | /* according to spec, anchor is in either: |
722 | * block 256 | 724 | * block 256 |
@@ -727,6 +729,9 @@ static sector_t udf_scan_anchors(struct super_block *sb, bool varconv, | |||
727 | for (i = 0; i < ARRAY_SIZE(last); i++) { | 729 | for (i = 0; i < ARRAY_SIZE(last); i++) { |
728 | if (last[i] < 0) | 730 | if (last[i] < 0) |
729 | continue; | 731 | continue; |
732 | if (last[i] >= sb->s_bdev->bd_inode->i_size >> | ||
733 | sb->s_blocksize_bits) | ||
734 | continue; | ||
730 | 735 | ||
731 | if (udf_check_anchor_block(sb, last[i], varconv)) { | 736 | if (udf_check_anchor_block(sb, last[i], varconv)) { |
732 | sbi->s_anchor[0] = last[i]; | 737 | sbi->s_anchor[0] = last[i]; |