@@ -2151,7 +2151,7 @@ static void add_pending_snapshot(struct btrfs_trans_handle *trans)
list_add(&trans->pending_snapshot->list, &cur_trans->pending_snapshots);
}
-static void update_commit_stats(struct btrfs_fs_info *fs_info, ktime_t interval)
+static void update_commit_stats(struct btrfs_fs_info *fs_info, u64 interval)
{
fs_info->commit_stats.commit_count++;
fs_info->commit_stats.last_commit_dur = interval;
@@ -2301,7 +2301,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
* Get the time spent on the work done by the commit thread and not
* the time spent waiting on a previous commit
*/
- start_time = ktime_get_ns();
+ start_time = ktime_get();
extwriter_counter_dec(cur_trans, trans->type);
@@ -2568,7 +2568,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
trace_btrfs_transaction_commit(fs_info);
- interval = ktime_get_ns() - start_time;
+ interval = ktime_sub(ktime_get(), start_time);
btrfs_scrub_continue(fs_info);
@@ -2577,7 +2577,7 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans)
kmem_cache_free(btrfs_trans_handle_cachep, trans);
- update_commit_stats(fs_info, interval);
+ update_commit_stats(fs_info, ktime_to_ns(interval));
return ret;
In 'update_commit_stats()' and 'btrfs_commit_transaction()', do not assume that 'ktime_t' is a scalar type which may be implicitly converted to (unsigned) 64-bit value but use 'ktime_sub()' and 'ktime_to_ns()' helpers where appropriate. Compile tested only. Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> --- fs/btrfs/transaction.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)