mirror of
https://github.com/versity/scoutfs.git
synced 2026-09-03 06:37:00 +00:00
Don't prematurely write dirty super
A previous refactoring messed up and had scoutfs_trans_write_func() always write the dirty super even when nothing was dirty and there was nothing for the sync attempt to do. This was very confusing and made it look like the segment and treap writes were being lost when in fact it was the super write that shouldn't have happened. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
+5
-12
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user