[5/6] jbd2: replace current_kernel_time64 with ktime equivalent

Message ID 20180620153322.54221-5-arnd@arndb.de
State Superseded
Headers show
Series
  • [1/6] ext4: sysfs: print ext4_super_block fields as little-endian
Related show

Commit Message

Arnd Bergmann June 20, 2018, 3:33 p.m.
jbd2 is one of the few callers of current_kernel_time64(), which
is a wrapper around ktime_get_coarse_real_ts64(). This calls the
latter directly for consistency with the rest of the kernel that
is moving to the ktime_get_ family of time accessors.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 fs/jbd2/commit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andreas Dilger June 21, 2018, 5:32 p.m. | #1
> On Jun 20, 2018, at 9:33 AM, Arnd Bergmann <arnd@arndb.de> wrote:
> 
> jbd2 is one of the few callers of current_kernel_time64(), which
> is a wrapper around ktime_get_coarse_real_ts64(). This calls the
> latter directly for consistency with the rest of the kernel that
> is moving to the ktime_get_ family of time accessors.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Andreas Dilger <adilger@dilger.ca>

> ---
> fs/jbd2/commit.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
> index 8de0e7723316..150cc030b4d7 100644
> --- a/fs/jbd2/commit.c
> +++ b/fs/jbd2/commit.c
> @@ -121,7 +121,7 @@ static int journal_submit_commit_record(journal_t *journal,
> 	struct commit_header *tmp;
> 	struct buffer_head *bh;
> 	int ret;
> -	struct timespec64 now = current_kernel_time64();
> +	struct timespec64 now;
> 
> 	*cbh = NULL;
> 
> @@ -134,6 +134,7 @@ static int journal_submit_commit_record(journal_t *journal,
> 		return 1;
> 
> 	tmp = (struct commit_header *)bh->b_data;
> +	ktime_get_coarse_real_ts64(&now);
> 	tmp->h_commit_sec = cpu_to_be64(now.tv_sec);
> 	tmp->h_commit_nsec = cpu_to_be32(now.tv_nsec);
> 
> --
> 2.9.0
> 


Cheers, Andreas
Jan Kara June 22, 2018, 7:41 a.m. | #2
On Wed 20-06-18 17:33:02, Arnd Bergmann wrote:
> jbd2 is one of the few callers of current_kernel_time64(), which
> is a wrapper around ktime_get_coarse_real_ts64(). This calls the
> latter directly for consistency with the rest of the kernel that
> is moving to the ktime_get_ family of time accessors.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Looks good. You can add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/jbd2/commit.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
> index 8de0e7723316..150cc030b4d7 100644
> --- a/fs/jbd2/commit.c
> +++ b/fs/jbd2/commit.c
> @@ -121,7 +121,7 @@ static int journal_submit_commit_record(journal_t *journal,
>  	struct commit_header *tmp;
>  	struct buffer_head *bh;
>  	int ret;
> -	struct timespec64 now = current_kernel_time64();
> +	struct timespec64 now;
>  
>  	*cbh = NULL;
>  
> @@ -134,6 +134,7 @@ static int journal_submit_commit_record(journal_t *journal,
>  		return 1;
>  
>  	tmp = (struct commit_header *)bh->b_data;
> +	ktime_get_coarse_real_ts64(&now);
>  	tmp->h_commit_sec = cpu_to_be64(now.tv_sec);
>  	tmp->h_commit_nsec = cpu_to_be32(now.tv_nsec);
>  
> -- 
> 2.9.0
> 
>

Patch

diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 8de0e7723316..150cc030b4d7 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -121,7 +121,7 @@  static int journal_submit_commit_record(journal_t *journal,
 	struct commit_header *tmp;
 	struct buffer_head *bh;
 	int ret;
-	struct timespec64 now = current_kernel_time64();
+	struct timespec64 now;
 
 	*cbh = NULL;
 
@@ -134,6 +134,7 @@  static int journal_submit_commit_record(journal_t *journal,
 		return 1;
 
 	tmp = (struct commit_header *)bh->b_data;
+	ktime_get_coarse_real_ts64(&now);
 	tmp->h_commit_sec = cpu_to_be64(now.tv_sec);
 	tmp->h_commit_nsec = cpu_to_be32(now.tv_nsec);