aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ceph
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2018-07-13 16:18:34 -0400
committerIlya Dryomov <idryomov@gmail.com>2018-08-02 15:26:12 -0400
commit473bd2d780d1699d81b25f57c0ec4de633a28eb8 (patch)
tree5e7a5a05d3682c1c3e09704263051da78e122c8b /include/linux/ceph
parent67fcd151400242757edbab710402161b2cd38989 (diff)
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>
Diffstat (limited to 'include/linux/ceph')
-rw-r--r--include/linux/ceph/decode.h20
-rw-r--r--include/linux/ceph/messenger.h2
2 files changed, 20 insertions, 2 deletions
diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
index d143ac8879c6..094b9b4a34f3 100644
--- a/include/linux/ceph/decode.h
+++ b/include/linux/ceph/decode.h
@@ -194,8 +194,26 @@ ceph_decode_skip_n(p, end, sizeof(u8), bad)
194 } while (0) 194 } while (0)
195 195
196/* 196/*
197 * struct ceph_timespec <-> struct timespec 197 * struct ceph_timespec <-> struct timespec64
198 */ 198 */
199static inline void ceph_decode_timespec64(struct timespec64 *ts,
200 const struct ceph_timespec *tv)
201{
202 /*
203 * This will still overflow in year 2106. We could extend
204 * the protocol to steal two more bits from tv_nsec to
205 * add three more 136 year epochs after that the way ext4
206 * does if necessary.
207 */
208 ts->tv_sec = (time64_t)le32_to_cpu(tv->tv_sec);
209 ts->tv_nsec = (long)le32_to_cpu(tv->tv_nsec);
210}
211static inline void ceph_encode_timespec64(struct ceph_timespec *tv,
212 const struct timespec64 *ts)
213{
214 tv->tv_sec = cpu_to_le32((u32)ts->tv_sec);
215 tv->tv_nsec = cpu_to_le32((u32)ts->tv_nsec);
216}
199static inline void ceph_decode_timespec(struct timespec *ts, 217static inline void ceph_decode_timespec(struct timespec *ts,
200 const struct ceph_timespec *tv) 218 const struct ceph_timespec *tv)
201{ 219{
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index c7dfcb8a1fb2..a718b877c597 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -330,7 +330,7 @@ struct ceph_connection {
330 int in_base_pos; /* bytes read */ 330 int in_base_pos; /* bytes read */
331 __le64 in_temp_ack; /* for reading an ack */ 331 __le64 in_temp_ack; /* for reading an ack */
332 332
333 struct timespec last_keepalive_ack; /* keepalive2 ack stamp */ 333 struct timespec64 last_keepalive_ack; /* keepalive2 ack stamp */
334 334
335 struct delayed_work work; /* send|recv work */ 335 struct delayed_work work; /* send|recv work */
336 unsigned long delay; /* current delay interval */ 336 unsigned long delay; /* current delay interval */