summaryrefslogtreecommitdiff
path: root/fs/udf
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2008-04-07 16:15:04 +0200
committerJan Kara <jack@suse.cz>2008-04-17 14:23:13 +0200
commit5fb28aa25ab0b71af2e441d68e63ad257e610a04 (patch)
treee0cba62535022802a4b47e5d04d49e2cc9f93ced /fs/udf
parent423cf6dc04eb79d441bfda2b127bc4b57134b41d (diff)
downloadlwn-5fb28aa25ab0b71af2e441d68e63ad257e610a04.tar.gz
lwn-5fb28aa25ab0b71af2e441d68e63ad257e610a04.zip
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')
-rw-r--r--fs/udf/super.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/udf/super.c b/fs/udf/super.c
index fe0dafebde71..b9e719de0704 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,
static sector_t udf_scan_anchors(struct super_block *sb, bool varconv,
sector_t lastblock)
{
- sector_t last[4];
+ sector_t last[6];
int i;
struct udf_sb_info *sbi = UDF_SB(sb);
last[0] = lastblock;
- last[1] = last[0] - 2;
- last[2] = last[0] - 150;
- last[3] = last[0] - 152;
+ last[1] = last[0] - 1;
+ last[2] = last[0] + 1;
+ last[3] = last[0] - 2;
+ last[4] = last[0] - 150;
+ last[5] = last[0] - 152;
/* according to spec, anchor is in either:
* block 256
@@ -727,6 +729,9 @@ static sector_t udf_scan_anchors(struct super_block *sb, bool varconv,
for (i = 0; i < ARRAY_SIZE(last); i++) {
if (last[i] < 0)
continue;
+ if (last[i] >= sb->s_bdev->bd_inode->i_size >>
+ sb->s_blocksize_bits)
+ continue;
if (udf_check_anchor_block(sb, last[i], varconv)) {
sbi->s_anchor[0] = last[i];