From 5b3243cb528f96e5d90d65f56f96ad179c666ff5 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Tue, 11 Oct 2022 04:49:23 -0400 Subject: [PATCH] bcachefs: Fix cached data accounting Negating without casting to a signed integer means the value wasn't getting sign extended properly - oops. Signed-off-by: Kent Overstreet --- fs/bcachefs/buckets.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index 4b041707cd54..5cb4a00166f9 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -578,7 +578,7 @@ int bch2_mark_alloc(struct btree_trans *trans, if ((flags & BTREE_TRIGGER_BUCKET_INVALIDATE) && old_a.cached_sectors) { ret = update_cached_sectors(c, new, ca->dev_idx, - -old_a.cached_sectors, + -((s64) old_a.cached_sectors), journal_seq, gc); if (ret) { bch2_fs_fatal_error(c, "bch2_mark_alloc(): no replicas entry while updating cached sectors");