diff --git a/kmod/src/trans.c b/kmod/src/trans.c index 6ea4b5f8..5987646c 100644 --- a/kmod/src/trans.c +++ b/kmod/src/trans.c @@ -84,7 +84,6 @@ void scoutfs_trans_write_func(struct work_struct *work) struct scoutfs_segment *seg; bool advance = false; int ret = 0; - int err; scoutfs_bio_init_comp(&comp); sbi->trans_task = current; @@ -101,7 +100,6 @@ void scoutfs_trans_write_func(struct work_struct *work) * XXX this needs serious work to handle errors. */ while (scoutfs_item_dirty_bytes(sb)) { - advance = true; seg = NULL; ret = scoutfs_seg_alloc(sb, &seg) ?: scoutfs_item_dirty_seg(sb, seg) ?: @@ -115,26 +113,21 @@ void scoutfs_trans_write_func(struct work_struct *work) } if (scoutfs_manifest_has_dirty(sb) || scoutfs_alloc_has_dirty(sb)) { - advance = true; ret = scoutfs_manifest_dirty_ring(sb) ?: scoutfs_alloc_dirty_ring(sb) ?: - scoutfs_treap_submit_write(sb, &comp); + scoutfs_treap_submit_write(sb, &comp) ?: + scoutfs_bio_wait_comp(sb, &comp) ?: + scoutfs_write_dirty_super(sb); if (ret) goto out; + + advance = true; } out: - err = scoutfs_bio_wait_comp(sb, &comp) ?: - scoutfs_write_dirty_super(sb); - if (err && !ret) - ret = err; - /* XXX this all needs serious work for dealing with errors */ WARN_ON_ONCE(ret); - if (advance && ret) - advance = false; - spin_lock(&sbi->trans_write_lock); if (advance) scoutfs_advance_dirty_super(sb);