libceph: use timespec64 in for keepalive2 and ticket validity
ceph_con_keepalive_expired() is the last user of timespec_add() and some of the last uses of ktime_get_real_ts(). Replacing this with timespec64 based interfaces lets us remove that deprecated API. I'm introducing new ceph_encode_timespec64()/ceph_decode_timespec64() here that take timespec64 structures and convert to/from ceph_timespec, which is defined to have an unsigned 32-bit tv_sec member. This extends the range of valid times to year 2106, avoiding the year 2038 overflow. The ceph file system portion still uses the old functions for inode timestamps, this will be done separately after the VFS layer is converted. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:

committed by
Ilya Dryomov

parent
67fcd15140
commit
473bd2d780
@@ -194,8 +194,26 @@ ceph_decode_skip_n(p, end, sizeof(u8), bad)
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* struct ceph_timespec <-> struct timespec
|
||||
* struct ceph_timespec <-> struct timespec64
|
||||
*/
|
||||
static inline void ceph_decode_timespec64(struct timespec64 *ts,
|
||||
const struct ceph_timespec *tv)
|
||||
{
|
||||
/*
|
||||
* This will still overflow in year 2106. We could extend
|
||||
* the protocol to steal two more bits from tv_nsec to
|
||||
* add three more 136 year epochs after that the way ext4
|
||||
* does if necessary.
|
||||
*/
|
||||
ts->tv_sec = (time64_t)le32_to_cpu(tv->tv_sec);
|
||||
ts->tv_nsec = (long)le32_to_cpu(tv->tv_nsec);
|
||||
}
|
||||
static inline void ceph_encode_timespec64(struct ceph_timespec *tv,
|
||||
const struct timespec64 *ts)
|
||||
{
|
||||
tv->tv_sec = cpu_to_le32((u32)ts->tv_sec);
|
||||
tv->tv_nsec = cpu_to_le32((u32)ts->tv_nsec);
|
||||
}
|
||||
static inline void ceph_decode_timespec(struct timespec *ts,
|
||||
const struct ceph_timespec *tv)
|
||||
{
|
||||
|
Reference in New Issue
Block a user