diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-05-31 07:13:39 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:05 +0300 |
commit | d7fc453bdb012d5bc021e693896989fd5973823f (patch) | |
tree | b6fbed2c5acb3a1cfc2a3e78306d621e4ec49292 /fs | |
parent | 649d9a4dfc834230b55c4ae34b60067d1d54c4d1 (diff) | |
download | linux-d7fc453bdb012d5bc021e693896989fd5973823f.tar.xz |
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>
Diffstat (limited to 'fs')
-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 812620d3de31..54d8e2f32a37 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; |