diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2018-09-30 18:28:23 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:10 -0400 |
commit | a2753581f6c5c05ea93978f8217a29115450ac58 (patch) | |
tree | 6a04ae18d5ebfa7808713af91d160716cd03af65 /fs/bcachefs/journal_io.c | |
parent | 1742237ba1db942b84a697509543fc5a9a25fcfa (diff) | |
download | lwn-a2753581f6c5c05ea93978f8217a29115450ac58.tar.gz lwn-a2753581f6c5c05ea93978f8217a29115450ac58.zip |
bcachefs: bch2_extent_drop_ptrs()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/journal_io.c')
-rw-r--r-- | fs/bcachefs/journal_io.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c index 9dd881c0410e..648c4ac58a2c 100644 --- a/fs/bcachefs/journal_io.c +++ b/fs/bcachefs/journal_io.c @@ -1067,14 +1067,19 @@ static int journal_write_alloc(struct journal *j, struct journal_buf *w, * entry - that's why we drop pointers to devices <= current free space, * i.e. whichever device was limiting the current journal entry size. */ - extent_for_each_ptr_backwards(e, ptr) { - ca = bch_dev_bkey_exists(c, ptr->dev); + bch2_extent_drop_ptrs(e, ptr, ({ + ca = bch_dev_bkey_exists(c, ptr->dev); - if (ca->mi.state != BCH_MEMBER_STATE_RW || - ca->journal.sectors_free <= sectors) - __bch2_extent_drop_ptr(e, ptr); - else - ca->journal.sectors_free -= sectors; + ca->mi.state != BCH_MEMBER_STATE_RW || + ca->journal.sectors_free <= sectors; + })); + + extent_for_each_ptr(e, ptr) { + ca = bch_dev_bkey_exists(c, ptr->dev); + + BUG_ON(ca->mi.state != BCH_MEMBER_STATE_RW || + ca->journal.sectors_free <= sectors); + ca->journal.sectors_free -= sectors; } replicas = bch2_extent_nr_ptrs(e.c); |