diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-11 17:40:45 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-01 11:47:38 -0500 |
commit | 25f64e997e4bd864b4426ba40b3a48d276665fea (patch) | |
tree | c4aa1ed5c6f36ad6bc2a2c0bb52de7e06b57ce4b /fs/bcachefs/alloc_background.c | |
parent | 086a52f7fa9d7dd0755a93c368f51253ea0852c8 (diff) | |
download | linux-stable-25f64e997e4bd864b4426ba40b3a48d276665fea.tar.gz linux-stable-25f64e997e4bd864b4426ba40b3a48d276665fea.tar.bz2 linux-stable-25f64e997e4bd864b4426ba40b3a48d276665fea.zip |
bcachefs: Don't use update_cached_sectors() in bch2_mark_alloc()
bch2_update_cached_sectors_list() is closer to how the new disk space
accounting works, called from trans_mark().
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/alloc_background.c')
-rw-r--r-- | fs/bcachefs/alloc_background.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c index 3326b7a90204..dcfe26fdb500 100644 --- a/fs/bcachefs/alloc_background.c +++ b/fs/bcachefs/alloc_background.c @@ -847,6 +847,19 @@ int bch2_trans_mark_alloc(struct btree_trans *trans, return ret; } + /* + * need to know if we're getting called from the invalidate path or + * not: + */ + + if ((flags & BTREE_TRIGGER_BUCKET_INVALIDATE) && + old_a->cached_sectors) { + ret = bch2_update_cached_sectors_list(trans, new->k.p.inode, + -((s64) old_a->cached_sectors)); + if (ret) + return ret; + } + return 0; } |