diff options
author | Arnd Bergmann <arnd@arndb.de> | 2018-06-20 04:15:13 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2018-06-27 07:58:00 -0400 |
commit | c3b9cecd89b806e14544af596396e18abd00f145 (patch) | |
tree | 8fa7396a50bf30ba9c5fa6da54cbda067e686c55 | |
parent | 813835028e9ae1f18cd11bb0ec591d0f0577d96a (diff) |
udf: convert inode stamps to timespec64
The VFS structures are finally converted to always use 64-bit timestamps,
and this file system can represent a long range of on-disk timestamps
already, so now let's fit in the missing bits for udf.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r-- | fs/udf/ialloc.c | 2 | ||||
-rw-r--r-- | fs/udf/inode.c | 45 | ||||
-rw-r--r-- | fs/udf/super.c | 8 | ||||
-rw-r--r-- | fs/udf/udf_i.h | 2 | ||||
-rw-r--r-- | fs/udf/udf_sb.h | 2 | ||||
-rw-r--r-- | fs/udf/udfdecl.h | 4 | ||||
-rw-r--r-- | fs/udf/udftime.c | 6 |
7 files changed, 28 insertions, 41 deletions
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 56569023783b..f8e5872f7cc2 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c | |||
@@ -125,7 +125,7 @@ struct inode *udf_new_inode(struct inode *dir, umode_t mode) | |||
125 | else | 125 | else |
126 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; | 126 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; |
127 | inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); | 127 | inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); |
128 | iinfo->i_crtime = timespec64_to_timespec(inode->i_mtime); | 128 | iinfo->i_crtime = inode->i_mtime; |
129 | if (unlikely(insert_inode_locked(inode) < 0)) { | 129 | if (unlikely(insert_inode_locked(inode) < 0)) { |
130 | make_bad_inode(inode); | 130 | make_bad_inode(inode); |
131 | iput(inode); | 131 | iput(inode); |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 9915a58fbabd..5df554a9f9c9 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -1270,7 +1270,6 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode) | |||
1270 | struct udf_inode_info *iinfo = UDF_I(inode); | 1270 | struct udf_inode_info *iinfo = UDF_I(inode); |
1271 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); | 1271 | struct udf_sb_info *sbi = UDF_SB(inode->i_sb); |
1272 | struct kernel_lb_addr *iloc = &iinfo->i_location; | 1272 | struct kernel_lb_addr *iloc = &iinfo->i_location; |
1273 | struct timespec ts; | ||
1274 | unsigned int link_count; | 1273 | unsigned int link_count; |
1275 | unsigned int indirections = 0; | 1274 | unsigned int indirections = 0; |
1276 | int bs = inode->i_sb->s_blocksize; | 1275 | int bs = inode->i_sb->s_blocksize; |
@@ -1443,12 +1442,9 @@ reread: | |||
1443 | inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) << | 1442 | inode->i_blocks = le64_to_cpu(fe->logicalBlocksRecorded) << |
1444 | (inode->i_sb->s_blocksize_bits - 9); | 1443 | (inode->i_sb->s_blocksize_bits - 9); |
1445 | 1444 | ||
1446 | udf_disk_stamp_to_time(&ts, fe->accessTime); | 1445 | udf_disk_stamp_to_time(&inode->i_atime, fe->accessTime); |
1447 | inode->i_atime = timespec_to_timespec64(ts); | 1446 | udf_disk_stamp_to_time(&inode->i_mtime, fe->modificationTime); |
1448 | udf_disk_stamp_to_time(&ts, fe->modificationTime); | 1447 | udf_disk_stamp_to_time(&inode->i_ctime, fe->attrTime); |
1449 | inode->i_mtime = timespec_to_timespec64(ts); | ||
1450 | udf_disk_stamp_to_time(&ts, fe->attrTime); | ||
1451 | inode->i_ctime = timespec_to_timespec64(ts); | ||
1452 | 1448 | ||
1453 | iinfo->i_unique = le64_to_cpu(fe->uniqueID); | 1449 | iinfo->i_unique = le64_to_cpu(fe->uniqueID); |
1454 | iinfo->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr); | 1450 | iinfo->i_lenEAttr = le32_to_cpu(fe->lengthExtendedAttr); |
@@ -1458,13 +1454,10 @@ reread: | |||
1458 | inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) << | 1454 | inode->i_blocks = le64_to_cpu(efe->logicalBlocksRecorded) << |
1459 | (inode->i_sb->s_blocksize_bits - 9); | 1455 | (inode->i_sb->s_blocksize_bits - 9); |
1460 | 1456 | ||
1461 | udf_disk_stamp_to_time(&ts, efe->accessTime); | 1457 | udf_disk_stamp_to_time(&inode->i_atime, efe->accessTime); |
1462 | inode->i_atime = timespec_to_timespec64(ts); | 1458 | udf_disk_stamp_to_time(&inode->i_mtime, efe->modificationTime); |
1463 | udf_disk_stamp_to_time(&ts, efe->modificationTime); | ||
1464 | inode->i_mtime = timespec_to_timespec64(ts); | ||
1465 | udf_disk_stamp_to_time(&iinfo->i_crtime, efe->createTime); | 1459 | udf_disk_stamp_to_time(&iinfo->i_crtime, efe->createTime); |
1466 | udf_disk_stamp_to_time(&ts, efe->attrTime); | 1460 | udf_disk_stamp_to_time(&inode->i_ctime, efe->attrTime); |
1467 | inode->i_ctime = timespec_to_timespec64(ts); | ||
1468 | 1461 | ||
1469 | iinfo->i_unique = le64_to_cpu(efe->uniqueID); | 1462 | iinfo->i_unique = le64_to_cpu(efe->uniqueID); |
1470 | iinfo->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr); | 1463 | iinfo->i_lenEAttr = le32_to_cpu(efe->lengthExtendedAttr); |
@@ -1601,7 +1594,7 @@ static int udf_sync_inode(struct inode *inode) | |||
1601 | return udf_update_inode(inode, 1); | 1594 | return udf_update_inode(inode, 1); |
1602 | } | 1595 | } |
1603 | 1596 | ||
1604 | static void udf_adjust_time(struct udf_inode_info *iinfo, struct timespec time) | 1597 | static void udf_adjust_time(struct udf_inode_info *iinfo, struct timespec64 time) |
1605 | { | 1598 | { |
1606 | if (iinfo->i_crtime.tv_sec > time.tv_sec || | 1599 | if (iinfo->i_crtime.tv_sec > time.tv_sec || |
1607 | (iinfo->i_crtime.tv_sec == time.tv_sec && | 1600 | (iinfo->i_crtime.tv_sec == time.tv_sec && |
@@ -1714,12 +1707,9 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1714 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); | 1707 | inode->i_sb->s_blocksize - sizeof(struct fileEntry)); |
1715 | fe->logicalBlocksRecorded = cpu_to_le64(lb_recorded); | 1708 | fe->logicalBlocksRecorded = cpu_to_le64(lb_recorded); |
1716 | 1709 | ||
1717 | udf_time_to_disk_stamp(&fe->accessTime, | 1710 | udf_time_to_disk_stamp(&fe->accessTime, inode->i_atime); |
1718 | timespec64_to_timespec(inode->i_atime)); | 1711 | udf_time_to_disk_stamp(&fe->modificationTime, inode->i_mtime); |
1719 | udf_time_to_disk_stamp(&fe->modificationTime, | 1712 | udf_time_to_disk_stamp(&fe->attrTime, inode->i_ctime); |
1720 | timespec64_to_timespec(inode->i_mtime)); | ||
1721 | udf_time_to_disk_stamp(&fe->attrTime, | ||
1722 | timespec64_to_timespec(inode->i_ctime)); | ||
1723 | memset(&(fe->impIdent), 0, sizeof(struct regid)); | 1713 | memset(&(fe->impIdent), 0, sizeof(struct regid)); |
1724 | strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER); | 1714 | strcpy(fe->impIdent.ident, UDF_ID_DEVELOPER); |
1725 | fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; | 1715 | fe->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; |
@@ -1738,17 +1728,14 @@ static int udf_update_inode(struct inode *inode, int do_sync) | |||
1738 | efe->objectSize = cpu_to_le64(inode->i_size); | 1728 | efe->objectSize = cpu_to_le64(inode->i_size); |
1739 | efe->logicalBlocksRecorded = cpu_to_le64(lb_recorded); | 1729 | efe->logicalBlocksRecorded = cpu_to_le64(lb_recorded); |
1740 | 1730 | ||
1741 | udf_adjust_time(iinfo, timespec64_to_timespec(inode->i_atime)); | 1731 | udf_adjust_time(iinfo, inode->i_atime); |
1742 | udf_adjust_time(iinfo, timespec64_to_timespec(inode->i_mtime)); | 1732 | udf_adjust_time(iinfo, inode->i_mtime); |
1743 | udf_adjust_time(iinfo, timespec64_to_timespec(inode->i_ctime)); | 1733 | udf_adjust_time(iinfo, inode->i_ctime); |
1744 | 1734 | ||
1745 | udf_time_to_disk_stamp(&efe->accessTime, | 1735 | udf_time_to_disk_stamp(&efe->accessTime, inode->i_atime); |
1746 | timespec64_to_timespec(inode->i_atime)); | 1736 | udf_time_to_disk_stamp(&efe->modificationTime, inode->i_mtime); |
1747 | udf_time_to_disk_stamp(&efe->modificationTime, | ||
1748 | timespec64_to_timespec(inode->i_mtime)); | ||
1749 | udf_time_to_disk_stamp(&efe->createTime, iinfo->i_crtime); | 1737 | udf_time_to_disk_stamp(&efe->createTime, iinfo->i_crtime); |
1750 | udf_time_to_disk_stamp(&efe->attrTime, | 1738 | udf_time_to_disk_stamp(&efe->attrTime, inode->i_ctime); |
1751 | timespec64_to_timespec(inode->i_ctime)); | ||
1752 | 1739 | ||
1753 | memset(&(efe->impIdent), 0, sizeof(efe->impIdent)); | 1740 | memset(&(efe->impIdent), 0, sizeof(efe->impIdent)); |
1754 | strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER); | 1741 | strcpy(efe->impIdent.ident, UDF_ID_DEVELOPER); |
diff --git a/fs/udf/super.c b/fs/udf/super.c index 0c504c8031d3..3040dc2a32f6 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -1980,7 +1980,7 @@ static void udf_open_lvid(struct super_block *sb) | |||
1980 | struct buffer_head *bh = sbi->s_lvid_bh; | 1980 | struct buffer_head *bh = sbi->s_lvid_bh; |
1981 | struct logicalVolIntegrityDesc *lvid; | 1981 | struct logicalVolIntegrityDesc *lvid; |
1982 | struct logicalVolIntegrityDescImpUse *lvidiu; | 1982 | struct logicalVolIntegrityDescImpUse *lvidiu; |
1983 | struct timespec ts; | 1983 | struct timespec64 ts; |
1984 | 1984 | ||
1985 | if (!bh) | 1985 | if (!bh) |
1986 | return; | 1986 | return; |
@@ -1992,7 +1992,7 @@ static void udf_open_lvid(struct super_block *sb) | |||
1992 | mutex_lock(&sbi->s_alloc_mutex); | 1992 | mutex_lock(&sbi->s_alloc_mutex); |
1993 | lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; | 1993 | lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; |
1994 | lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; | 1994 | lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; |
1995 | ktime_get_real_ts(&ts); | 1995 | ktime_get_real_ts64(&ts); |
1996 | udf_time_to_disk_stamp(&lvid->recordingDateAndTime, ts); | 1996 | udf_time_to_disk_stamp(&lvid->recordingDateAndTime, ts); |
1997 | if (le32_to_cpu(lvid->integrityType) == LVID_INTEGRITY_TYPE_CLOSE) | 1997 | if (le32_to_cpu(lvid->integrityType) == LVID_INTEGRITY_TYPE_CLOSE) |
1998 | lvid->integrityType = cpu_to_le32(LVID_INTEGRITY_TYPE_OPEN); | 1998 | lvid->integrityType = cpu_to_le32(LVID_INTEGRITY_TYPE_OPEN); |
@@ -2017,7 +2017,7 @@ static void udf_close_lvid(struct super_block *sb) | |||
2017 | struct buffer_head *bh = sbi->s_lvid_bh; | 2017 | struct buffer_head *bh = sbi->s_lvid_bh; |
2018 | struct logicalVolIntegrityDesc *lvid; | 2018 | struct logicalVolIntegrityDesc *lvid; |
2019 | struct logicalVolIntegrityDescImpUse *lvidiu; | 2019 | struct logicalVolIntegrityDescImpUse *lvidiu; |
2020 | struct timespec ts; | 2020 | struct timespec64 ts; |
2021 | 2021 | ||
2022 | if (!bh) | 2022 | if (!bh) |
2023 | return; | 2023 | return; |
@@ -2029,7 +2029,7 @@ static void udf_close_lvid(struct super_block *sb) | |||
2029 | mutex_lock(&sbi->s_alloc_mutex); | 2029 | mutex_lock(&sbi->s_alloc_mutex); |
2030 | lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; | 2030 | lvidiu->impIdent.identSuffix[0] = UDF_OS_CLASS_UNIX; |
2031 | lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; | 2031 | lvidiu->impIdent.identSuffix[1] = UDF_OS_ID_LINUX; |
2032 | ktime_get_real_ts(&ts); | 2032 | ktime_get_real_ts64(&ts); |
2033 | udf_time_to_disk_stamp(&lvid->recordingDateAndTime, ts); | 2033 | udf_time_to_disk_stamp(&lvid->recordingDateAndTime, ts); |
2034 | if (UDF_MAX_WRITE_VERSION > le16_to_cpu(lvidiu->maxUDFWriteRev)) | 2034 | if (UDF_MAX_WRITE_VERSION > le16_to_cpu(lvidiu->maxUDFWriteRev)) |
2035 | lvidiu->maxUDFWriteRev = cpu_to_le16(UDF_MAX_WRITE_VERSION); | 2035 | lvidiu->maxUDFWriteRev = cpu_to_le16(UDF_MAX_WRITE_VERSION); |
diff --git a/fs/udf/udf_i.h b/fs/udf/udf_i.h index 630426ffb775..2ef0e212f08a 100644 --- a/fs/udf/udf_i.h +++ b/fs/udf/udf_i.h | |||
@@ -28,7 +28,7 @@ struct udf_ext_cache { | |||
28 | */ | 28 | */ |
29 | 29 | ||
30 | struct udf_inode_info { | 30 | struct udf_inode_info { |
31 | struct timespec i_crtime; | 31 | struct timespec64 i_crtime; |
32 | /* Physical address of inode */ | 32 | /* Physical address of inode */ |
33 | struct kernel_lb_addr i_location; | 33 | struct kernel_lb_addr i_location; |
34 | __u64 i_unique; | 34 | __u64 i_unique; |
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h index 9dd3e1b9619e..9424d7cab790 100644 --- a/fs/udf/udf_sb.h +++ b/fs/udf/udf_sb.h | |||
@@ -138,7 +138,7 @@ struct udf_sb_info { | |||
138 | rwlock_t s_cred_lock; | 138 | rwlock_t s_cred_lock; |
139 | 139 | ||
140 | /* Root Info */ | 140 | /* Root Info */ |
141 | struct timespec s_record_time; | 141 | struct timespec64 s_record_time; |
142 | 142 | ||
143 | /* Fileset Info */ | 143 | /* Fileset Info */ |
144 | __u16 s_serial_number; | 144 | __u16 s_serial_number; |
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h index 84c47dde4d26..ee246769dee4 100644 --- a/fs/udf/udfdecl.h +++ b/fs/udf/udfdecl.h | |||
@@ -258,8 +258,8 @@ extern struct long_ad *udf_get_filelongad(uint8_t *, int, uint32_t *, int); | |||
258 | extern struct short_ad *udf_get_fileshortad(uint8_t *, int, uint32_t *, int); | 258 | extern struct short_ad *udf_get_fileshortad(uint8_t *, int, uint32_t *, int); |
259 | 259 | ||
260 | /* udftime.c */ | 260 | /* udftime.c */ |
261 | extern void udf_disk_stamp_to_time(struct timespec *dest, | 261 | extern void udf_disk_stamp_to_time(struct timespec64 *dest, |
262 | struct timestamp src); | 262 | struct timestamp src); |
263 | extern void udf_time_to_disk_stamp(struct timestamp *dest, struct timespec src); | 263 | extern void udf_time_to_disk_stamp(struct timestamp *dest, struct timespec64 src); |
264 | 264 | ||
265 | #endif /* __UDF_DECL_H */ | 265 | #endif /* __UDF_DECL_H */ |
diff --git a/fs/udf/udftime.c b/fs/udf/udftime.c index 67b33ac5d41b..fce4ad976c8c 100644 --- a/fs/udf/udftime.c +++ b/fs/udf/udftime.c | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <linux/time.h> | 41 | #include <linux/time.h> |
42 | 42 | ||
43 | void | 43 | void |
44 | udf_disk_stamp_to_time(struct timespec *dest, struct timestamp src) | 44 | udf_disk_stamp_to_time(struct timespec64 *dest, struct timestamp src) |
45 | { | 45 | { |
46 | u16 typeAndTimezone = le16_to_cpu(src.typeAndTimezone); | 46 | u16 typeAndTimezone = le16_to_cpu(src.typeAndTimezone); |
47 | u16 year = le16_to_cpu(src.year); | 47 | u16 year = le16_to_cpu(src.year); |
@@ -70,9 +70,9 @@ udf_disk_stamp_to_time(struct timespec *dest, struct timestamp src) | |||
70 | } | 70 | } |
71 | 71 | ||
72 | void | 72 | void |
73 | udf_time_to_disk_stamp(struct timestamp *dest, struct timespec ts) | 73 | udf_time_to_disk_stamp(struct timestamp *dest, struct timespec64 ts) |
74 | { | 74 | { |
75 | long seconds; | 75 | time64_t seconds; |
76 | int16_t offset; | 76 | int16_t offset; |
77 | struct tm tm; | 77 | struct tm tm; |
78 | 78 | ||