Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bcachefs: journal->buf_lock

Add a new lock for synchronizing between journal IO path and btree write
buffer flush.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>

+9
+1
fs/bcachefs/journal.c
··· 1219 1219 static struct lock_class_key res_key; 1220 1220 unsigned i; 1221 1221 1222 + mutex_init(&j->buf_lock); 1222 1223 spin_lock_init(&j->lock); 1223 1224 spin_lock_init(&j->err_lock); 1224 1225 init_waitqueue_head(&j->wait);
+2
fs/bcachefs/journal_io.c
··· 1885 1885 if (ret) 1886 1886 goto err; 1887 1887 1888 + mutex_lock(&j->buf_lock); 1888 1889 journal_buf_realloc(j, w); 1889 1890 1890 1891 ret = bch2_journal_write_prep(j, w); 1892 + mutex_unlock(&j->buf_lock); 1891 1893 if (ret) 1892 1894 goto err; 1893 1895
+6
fs/bcachefs/journal_types.h
··· 182 182 darray_u64 early_journal_entries; 183 183 184 184 /* 185 + * Protects journal_buf->data, when accessing without a jorunal 186 + * reservation: for synchronization between the btree write buffer code 187 + * and the journal write path: 188 + */ 189 + struct mutex buf_lock; 190 + /* 185 191 * Two journal entries -- one is currently open for new entries, the 186 192 * other is possibly being written out. 187 193 */