diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-02-28 23:08:04 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:55 -0400 |
commit | e902095868819c23433c6eba6636e2f1122da126 (patch) | |
tree | 412521fc1d94ba75666517e35cdea7308c8b78d8 /fs/bcachefs/io.c | |
parent | 8f2bbcdd9bc8f9c0a2d4b6801d1dfeb20e28e954 (diff) | |
download | lwn-e902095868819c23433c6eba6636e2f1122da126.tar.gz lwn-e902095868819c23433c6eba6636e2f1122da126.zip |
bcachefs: bch2_write_queue()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/io.c')
-rw-r--r-- | fs/bcachefs/io.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c index ede2f3116935..dac0dad16f0a 100644 --- a/fs/bcachefs/io.c +++ b/fs/bcachefs/io.c @@ -849,6 +849,18 @@ static void bch2_write_index(struct closure *cl) queue_work(wq, &wp->index_update_work); } +static inline void bch2_write_queue(struct bch_write_op *op, struct write_point *wp) +{ + op->btree_update_ready = false; + op->wp = wp; + + spin_lock(&wp->writes_lock); + list_add_tail(&op->wp_list, &wp->writes); + if (wp->state == WRITE_POINT_stopped) + __wp_update_state(wp, WRITE_POINT_waiting_io); + spin_unlock(&wp->writes_lock); +} + void bch2_write_point_do_index_updates(struct work_struct *work) { struct write_point *wp = @@ -1707,15 +1719,6 @@ again: bch2_alloc_sectors_done_inlined(c, wp); err: if (ret <= 0) { - if (!(op->flags & BCH_WRITE_SYNC)) { - spin_lock(&wp->writes_lock); - op->wp = wp; - list_add_tail(&op->wp_list, &wp->writes); - if (wp->state == WRITE_POINT_stopped) - __wp_update_state(wp, WRITE_POINT_waiting_io); - spin_unlock(&wp->writes_lock); - } - op->flags |= BCH_WRITE_DONE; if (ret < 0) { @@ -1754,6 +1757,7 @@ err: goto again; bch2_write_done(&op->cl); } else { + bch2_write_queue(op, wp); continue_at(&op->cl, bch2_write_index, NULL); } out_nofs_restore: |