diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-02-26 15:58:36 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2020-02-26 15:58:36 -0500 |
commit | 604f4a823da74b51d83254139da533dfcdbe8b26 (patch) | |
tree | dff9a202bd6bd6ba131a720315089af9ed236f7a | |
parent | ae3f0bcc63622f0338b04b35aaf494c57104f73d (diff) |
bcachefs: Issue discards when needed to allocate journal write
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r-- | fs/bcachefs/journal_io.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c index db722a8ae4ea..0974805c8923 100644 --- a/fs/bcachefs/journal_io.c +++ b/fs/bcachefs/journal_io.c @@ -1043,9 +1043,16 @@ void bch2_journal_write(struct closure *cl) bytes = vstruct_bytes(jset); memset((void *) jset + bytes, 0, (sectors << 9) - bytes); +retry_alloc: spin_lock(&j->lock); ret = journal_write_alloc(j, w, sectors); + if (ret && j->can_discard) { + spin_unlock(&j->lock); + bch2_journal_do_discards(j); + goto retry_alloc; + } + /* * write is allocated, no longer need to account for it in * bch2_journal_space_available(): |