diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-05-31 00:13:39 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2021-05-31 14:59:15 -0400 |
commit | 3913e0cac34e0993ab6dde67a2dec1ea485a2e28 (patch) | |
tree | 4e86cb2513ad23a66af17a4f21979ab10a440b5b | |
parent | 675144f15addd6312ad6b1eed7fb3c330124da54 (diff) |
bcachefs: Journal space calculation fix
When devices have different bucket sizes, we may accumulate a journal
write that doesn't fit on some of our devices - previously, we'd
underflow when calculating space on that device and then everything
would get weird.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r-- | fs/bcachefs/journal_reclaim.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/bcachefs/journal_reclaim.c b/fs/bcachefs/journal_reclaim.c index 427be2da1dfc..7a0ae5d3431c 100644 --- a/fs/bcachefs/journal_reclaim.c +++ b/fs/bcachefs/journal_reclaim.c @@ -93,6 +93,10 @@ journal_dev_space_available(struct journal *j, struct bch_dev *ca, * until we write it out - thus, account for it here: */ while ((unwritten = get_unwritten_sectors(j, &idx))) { + /* entry won't fit on this device, skip: */ + if (unwritten > ca->mi.bucket_size) + continue; + if (unwritten >= sectors) { if (!buckets) { sectors = 0; |