diff options
author | 2021-04-28 22:51:42 -0400 | |
---|---|---|
committer | 2023-10-22 17:09:02 -0400 | |
commit | 595c1e9bab7fd5512250d0e297e50a549af59b1f (patch) | |
tree | a66d69cfe31dd911c0ca62d426b44b02ac63a93c /fs/bcachefs/super-io.c | |
parent | bcachefs: Add a tracepoint for when we block on journal reclaim (diff) | |
download | linux-595c1e9bab7fd5512250d0e297e50a549af59b1f.tar.gz linux-595c1e9bab7fd5512250d0e297e50a549af59b1f.tar.bz2 linux-595c1e9bab7fd5512250d0e297e50a549af59b1f.zip |
bcachefs: Fix time handling
There were some overflows in the time conversion functions - fix this by
converting tv_sec and tv_nsec separately. Also, set sb->time_min and
sb->time_max.
Fixes xfstest generic/258.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super-io.c')
-rw-r--r-- | fs/bcachefs/super-io.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c index e0de6f0c0cb4..4c7cea4cfc2b 100644 --- a/fs/bcachefs/super-io.c +++ b/fs/bcachefs/super-io.c @@ -373,9 +373,15 @@ static void bch2_sb_update(struct bch_fs *c) c->sb.clean = BCH_SB_CLEAN(src); c->sb.encryption_type = BCH_SB_ENCRYPTION_TYPE(src); c->sb.encoded_extent_max= 1 << BCH_SB_ENCODED_EXTENT_MAX_BITS(src); - c->sb.time_base_lo = le64_to_cpu(src->time_base_lo); + + c->sb.nsec_per_time_unit = le32_to_cpu(src->time_precision); + c->sb.time_units_per_sec = NSEC_PER_SEC / c->sb.nsec_per_time_unit; + + /* XXX this is wrong, we need a 96 or 128 bit integer type */ + c->sb.time_base_lo = div_u64(le64_to_cpu(src->time_base_lo), + c->sb.nsec_per_time_unit); c->sb.time_base_hi = le32_to_cpu(src->time_base_hi); - c->sb.time_precision = le32_to_cpu(src->time_precision); + c->sb.features = le64_to_cpu(src->features[0]); c->sb.compat = le64_to_cpu(src->compat[0]); |