Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb04b91b authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Linus Torvalds
Browse files

nilfs2: use time64_t internally

The superblock and segment timestamps are used only internally in nilfs2
and can be read out using sysfs.

Since we are using the old 'get_seconds()' interface and store the data
as timestamps, the behavior differs slightly between 64-bit and 32-bit
kernels, the latter will show incorrect timestamps after 2038 in sysfs,
and presumably fail completely in 2106 as comparisons go wrong.

This changes nilfs2 to use time64_t with ktime_get_real_seconds() to
handle timestamps, making the behavior consistent and correct on both
32-bit and 64-bit machines.

The on-disk format already uses 64-bit timestamps, so nothing changes
there.

Link: http://lkml.kernel.org/r/20180122211050.1286441-1-arnd@arndb.de


Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ca3a4569
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ int nilfs_segbuf_extend_payload(struct nilfs_segment_buffer *segbuf,
}

int nilfs_segbuf_reset(struct nilfs_segment_buffer *segbuf, unsigned int flags,
		       time_t ctime, __u64 cno)
		       time64_t ctime, __u64 cno)
{
	int err;

+2 −2
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ struct nilfs_segsum_info {
	unsigned long		nfileblk;
	u64			seg_seq;
	__u64			cno;
	time_t			ctime;
	time64_t		ctime;
	sector_t		next;
};

@@ -120,7 +120,7 @@ void nilfs_segbuf_map_cont(struct nilfs_segment_buffer *segbuf,
			   struct nilfs_segment_buffer *prev);
void nilfs_segbuf_set_next_segnum(struct nilfs_segment_buffer *, __u64,
				  struct the_nilfs *);
int nilfs_segbuf_reset(struct nilfs_segment_buffer *, unsigned int, time_t,
int nilfs_segbuf_reset(struct nilfs_segment_buffer *, unsigned int, time64_t,
		       __u64);
int nilfs_segbuf_extend_segsum(struct nilfs_segment_buffer *);
int nilfs_segbuf_extend_payload(struct nilfs_segment_buffer *,
+1 −1
Original line number Diff line number Diff line
@@ -2040,7 +2040,7 @@ static int nilfs_segctor_do_construct(struct nilfs_sc_info *sci, int mode)
			goto out;

		/* Update time stamp */
		sci->sc_seg_ctime = get_seconds();
		sci->sc_seg_ctime = ktime_get_real_seconds();

		err = nilfs_segctor_collect(sci, nilfs, mode);
		if (unlikely(err))
+1 −1
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ struct nilfs_sc_info {
	unsigned long		sc_blk_cnt;
	unsigned long		sc_datablk_cnt;
	unsigned long		sc_nblk_this_inc;
	time_t			sc_seg_ctime;
	time64_t		sc_seg_ctime;
	__u64			sc_cno;
	unsigned long		sc_flags;

+1 −1
Original line number Diff line number Diff line
@@ -526,7 +526,7 @@ int nilfs_sufile_mark_dirty(struct inode *sufile, __u64 segnum)
 * @modtime: modification time (option)
 */
int nilfs_sufile_set_segment_usage(struct inode *sufile, __u64 segnum,
				   unsigned long nblocks, time_t modtime)
				   unsigned long nblocks, time64_t modtime)
{
	struct buffer_head *bh;
	struct nilfs_segment_usage *su;
Loading