diff options
author | Steve Nickel <snickel58@gmail.com> | 2012-02-16 12:53:53 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2012-02-29 15:53:47 -0500 |
commit | b2527bfa535956d99663718b9d9aac0b8fe3f017 (patch) | |
tree | 37eba8dd3eb3da3fbd95fe57a6b63a5866bfe147 /fs/udf | |
parent | fd4287dbc07763595c1e74edbb6520092290185c (diff) |
udf: Fix file entry logicalBlocksRecorded
ECMA 1.67 requires setting logicalBlocksRecorded to zero if the file
has no extents. This should be checked in udf_update_inode().
udf_fill_inode() will then take care of itself.
Signed-off-by: Steven P. Nickel <snickel@focusinfo.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf')
-rw-r--r-- | fs/udf/inode.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 91c6f2311f35..7d7528008359 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -1497,6 +1497,7 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1497 | struct buffer_head *bh = NULL; | 1497 | struct buffer_head *bh = NULL; |
1498 | struct fileEntry *fe; | 1498 | struct fileEntry *fe; |
1499 | struct extendedFileEntry *efe; | 1499 | struct extendedFileEntry *efe; |
1500 | uint64_t lb_recorded; | ||
1500 | uint32_t udfperms; | 1501 | uint32_t udfperms; |
1501 | uint16_t icbflags; | 1502 | uint16_t icbflags; |
1502 | uint16_t crclen; | 1503 | uint16_t crclen; |
@@ -1591,13 +1592,18 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1591 | dsea->minorDeviceIdent = cpu_to_le32(iminor(inode)); | 1592 | dsea->minorDeviceIdent = cpu_to_le32(iminor(inode)); |
1592 | } | 1593 | } |
1593 | 1594 | ||
1595 | if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) | ||
1596 | lb_recorded = 0; /* No extents => no blocks! */ | ||
1597 | else | ||
1598 | lb_recorded = | ||
1599 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> | ||
1600 | (blocksize_bits - 9); | ||
1601 | |||
1594 | if (iinfo->i_efe == 0) { | 1602 | if (iinfo->i_efe == 0) { |
1595 | memcpy(bh->b_data + sizeof(struct fileEntry), | 1603 | memcpy(bh->b_data + sizeof(struct fileEntry), |
1596 | iinfo->i_ext.i_data, | 1604 | iinfo->i_ext.i_data, |
1597 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); | 1605 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); |
1598 | fe->logicalBlocksRecorded = cpu_to_le64( | 1606 | fe->logicalBlocksRecorded = cpu_to_le64(lb_recorded); |
1599 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> | ||
1600 | (blocksize_bits - 9)); | ||
1601 | 1607 | ||
1602 | udf_time_to_disk_stamp(&fe->accessTime, inode->i_atime); | 1608 | udf_time_to_disk_stamp(&fe->accessTime, inode->i_atime); |
1603 | udf_time_to_disk_stamp(&fe->modificationTime, inode->i_mtime); | 1609 | udf_time_to_disk_stamp(&fe->modificationTime, inode->i_mtime); |
@@ -1618,9 +1624,7 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1618 | inode->i_sb->s_blocksize - | 1624 | inode->i_sb->s_blocksize - |
1619 | sizeof(struct extendedFileEntry)); | 1625 | sizeof(struct extendedFileEntry)); |
1620 | efe->objectSize = cpu_to_le64(inode->i_size); | 1626 | efe->objectSize = cpu_to_le64(inode->i_size); |
1621 | efe->logicalBlocksRecorded = cpu_to_le64( | 1627 | efe->logicalBlocksRecorded = cpu_to_le64(lb_recorded); |
1622 | (inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >> | ||
1623 | (blocksize_bits - 9)); | ||
1624 | 1628 | ||
1625 | if (iinfo->i_crtime.tv_sec > inode->i_atime.tv_sec || | 1629 | if (iinfo->i_crtime.tv_sec > inode->i_atime.tv_sec || |
1626 | (iinfo->i_crtime.tv_sec == inode->i_atime.tv_sec && | 1630 | (iinfo->i_crtime.tv_sec == inode->i_atime.tv_sec && |