mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
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>
This commit is contained in:
parent
fd4287dbc0
commit
b2527bfa53
1 changed files with 10 additions and 6 deletions
|
@ -1497,6 +1497,7 @@ static int udf_update_inode(struct inode *inode, int do_sync)
|
||||||
struct buffer_head *bh = NULL;
|
struct buffer_head *bh = NULL;
|
||||||
struct fileEntry *fe;
|
struct fileEntry *fe;
|
||||||
struct extendedFileEntry *efe;
|
struct extendedFileEntry *efe;
|
||||||
|
uint64_t lb_recorded;
|
||||||
uint32_t udfperms;
|
uint32_t udfperms;
|
||||||
uint16_t icbflags;
|
uint16_t icbflags;
|
||||||
uint16_t crclen;
|
uint16_t crclen;
|
||||||
|
@ -1591,13 +1592,18 @@ static int udf_update_inode(struct inode *inode, int do_sync)
|
||||||
dsea->minorDeviceIdent = cpu_to_le32(iminor(inode));
|
dsea->minorDeviceIdent = cpu_to_le32(iminor(inode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB)
|
||||||
|
lb_recorded = 0; /* No extents => no blocks! */
|
||||||
|
else
|
||||||
|
lb_recorded =
|
||||||
|
(inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >>
|
||||||
|
(blocksize_bits - 9);
|
||||||
|
|
||||||
if (iinfo->i_efe == 0) {
|
if (iinfo->i_efe == 0) {
|
||||||
memcpy(bh->b_data + sizeof(struct fileEntry),
|
memcpy(bh->b_data + sizeof(struct fileEntry),
|
||||||
iinfo->i_ext.i_data,
|
iinfo->i_ext.i_data,
|
||||||
inode->i_sb->s_blocksize - sizeof(struct fileEntry));
|
inode->i_sb->s_blocksize - sizeof(struct fileEntry));
|
||||||
fe->logicalBlocksRecorded = cpu_to_le64(
|
fe->logicalBlocksRecorded = cpu_to_le64(lb_recorded);
|
||||||
(inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >>
|
|
||||||
(blocksize_bits - 9));
|
|
||||||
|
|
||||||
udf_time_to_disk_stamp(&fe->accessTime, inode->i_atime);
|
udf_time_to_disk_stamp(&fe->accessTime, inode->i_atime);
|
||||||
udf_time_to_disk_stamp(&fe->modificationTime, inode->i_mtime);
|
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)
|
||||||
inode->i_sb->s_blocksize -
|
inode->i_sb->s_blocksize -
|
||||||
sizeof(struct extendedFileEntry));
|
sizeof(struct extendedFileEntry));
|
||||||
efe->objectSize = cpu_to_le64(inode->i_size);
|
efe->objectSize = cpu_to_le64(inode->i_size);
|
||||||
efe->logicalBlocksRecorded = cpu_to_le64(
|
efe->logicalBlocksRecorded = cpu_to_le64(lb_recorded);
|
||||||
(inode->i_blocks + (1 << (blocksize_bits - 9)) - 1) >>
|
|
||||||
(blocksize_bits - 9));
|
|
||||||
|
|
||||||
if (iinfo->i_crtime.tv_sec > inode->i_atime.tv_sec ||
|
if (iinfo->i_crtime.tv_sec > inode->i_atime.tv_sec ||
|
||||||
(iinfo->i_crtime.tv_sec == inode->i_atime.tv_sec &&
|
(iinfo->i_crtime.tv_sec == inode->i_atime.tv_sec &&
|
||||||
|
|
Loading…
Reference in a new issue