1 From: Jan Kara <jack@suse.cz>
2 Subject: udf: Use device size when drive reported bogus number of written blocks
6 Some drives report 0 as the number of written blocks when there are some blocks
7 recorded. Use device size in such case so that we can automagically mount such
10 Signed-off-by: Jan Kara <jack@suse.cz>
12 diff -rupX /home/jack/.kerndiffexclude linux-2.6.27-SLE11_BRANCH/fs/udf/lowlevel.c linux-2.6.27-SLE11_BRANCH-1-udf_last_block_fix/fs/udf/lowlevel.c
13 --- linux-2.6.27-SLE11_BRANCH/fs/udf/lowlevel.c 2008-10-10 00:13:53.000000000 +0200
14 +++ linux-2.6.27-SLE11_BRANCH-1-udf_last_block_fix/fs/udf/lowlevel.c 2009-06-18 12:08:11.000000000 +0200
15 @@ -56,7 +56,12 @@ unsigned long udf_get_last_block(struct
16 struct block_device *bdev = sb->s_bdev;
17 unsigned long lblock = 0;
19 - if (ioctl_by_bdev(bdev, CDROM_LAST_WRITTEN, (unsigned long) &lblock))
21 + * ioctl failed or returned obviously bogus value?
22 + * Try using the device size...
24 + if (ioctl_by_bdev(bdev, CDROM_LAST_WRITTEN, (unsigned long) &lblock) ||
26 lblock = bdev->bd_inode->i_size >> sb->s_blocksize_bits;