summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2017-12-24 16:42:47 -0500
committerKent Overstreet <kent.overstreet@gmail.com>2018-05-22 00:44:18 -0400
commitb444278c7ea416fa94c031cc20977824daa12a62 (patch)
tree942cff51d1952dd525c8dfc2f7567f5396930629
parent164fc4218cc02fb8d0a5ec069b9c5b13c632fc0d (diff)
bcachefs: fix check_mark_super() calls for data move path
-rw-r--r--fs/bcachefs/io.c24
-rw-r--r--fs/bcachefs/io.h7
-rw-r--r--fs/bcachefs/move.c8
3 files changed, 26 insertions, 13 deletions
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index c053fd16581f..23c9420ee95e 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -262,16 +262,17 @@ static void bch2_write_index(struct closure *cl)
if (test_bit(ptr->dev, op->failed.d))
bch2_extent_drop_ptr(e, ptr);
- ret = bch2_extent_nr_ptrs(e.c)
- ? bch2_check_mark_super(c, e.c, BCH_DATA_USER)
- : -EIO;
- if (ret) {
- keys->top = keys->keys;
- op->error = ret;
- op->flags |= BCH_WRITE_DONE;
+ if (!bch2_extent_nr_ptrs(e.c)) {
+ ret = -EIO;
goto err;
}
+ if (!(op->flags & BCH_WRITE_NOMARK_REPLICAS)) {
+ ret = bch2_check_mark_super(c, e.c, BCH_DATA_USER);
+ if (ret)
+ goto err;
+ }
+
dst = bkey_next(dst);
}
@@ -290,7 +291,7 @@ static void bch2_write_index(struct closure *cl)
op->error = ret;
}
}
-err:
+out:
bch2_open_bucket_put_refs(c, &op->open_buckets_nr, op->open_buckets);
if (!(op->flags & BCH_WRITE_DONE)) {
@@ -306,6 +307,12 @@ err:
} else {
continue_at_nobarrier(cl, bch2_write_done, NULL);
}
+ return;
+err:
+ keys->top = keys->keys;
+ op->error = ret;
+ op->flags |= BCH_WRITE_DONE;
+ goto out;
}
static void bch2_write_endio(struct bio *bio)
@@ -353,7 +360,6 @@ static void init_append_extent(struct bch_write_op *op,
bch2_extent_crc_append(e, crc);
bch2_alloc_sectors_append_ptrs(op->c, wp, e, crc.compressed_size);
- bkey_extent_set_cached(&e->k, (op->flags & BCH_WRITE_CACHED));
bch2_keylist_push(&op->insert_keys);
}
diff --git a/fs/bcachefs/io.h b/fs/bcachefs/io.h
index 0c145eb67317..71eee4f6896b 100644
--- a/fs/bcachefs/io.h
+++ b/fs/bcachefs/io.h
@@ -32,11 +32,12 @@ enum bch_write_flags {
BCH_WRITE_PAGES_OWNED = (1 << 5),
BCH_WRITE_ONLY_SPECIFIED_DEVS = (1 << 6),
BCH_WRITE_NOPUT_RESERVATION = (1 << 7),
+ BCH_WRITE_NOMARK_REPLICAS = (1 << 8),
/* Internal: */
- BCH_WRITE_JOURNAL_SEQ_PTR = (1 << 8),
- BCH_WRITE_DONE = (1 << 9),
- BCH_WRITE_LOOPED = (1 << 10),
+ BCH_WRITE_JOURNAL_SEQ_PTR = (1 << 9),
+ BCH_WRITE_DONE = (1 << 10),
+ BCH_WRITE_LOOPED = (1 << 11),
};
static inline u64 *op_journal_seq(struct bch_write_op *op)
diff --git a/fs/bcachefs/move.c b/fs/bcachefs/move.c
index 6267fc96635a..038d9fd630ff 100644
--- a/fs/bcachefs/move.c
+++ b/fs/bcachefs/move.c
@@ -116,6 +116,11 @@ static int bch2_migrate_index_update(struct bch_write_op *op)
bch2_extent_normalize(c, extent_i_to_s(insert).s);
bch2_extent_mark_replicas_cached(c, extent_i_to_s(insert));
+ ret = bch2_check_mark_super(c, extent_i_to_s_c(insert),
+ BCH_DATA_USER);
+ if (ret)
+ break;
+
ret = bch2_btree_insert_at(c, &op->res,
NULL, op_journal_seq(op),
BTREE_INSERT_ATOMIC|
@@ -178,7 +183,8 @@ void bch2_migrate_write_init(struct migrate_write *m,
m->op.flags |= BCH_WRITE_ONLY_SPECIFIED_DEVS|
BCH_WRITE_PAGES_STABLE|
BCH_WRITE_PAGES_OWNED|
- BCH_WRITE_DATA_ENCODED;
+ BCH_WRITE_DATA_ENCODED|
+ BCH_WRITE_NOMARK_REPLICAS;
m->op.wbio.bio.bi_iter.bi_size = m->op.crc.compressed_size << 9;
m->op.nr_replicas = 1;