summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-04-09 07:27:55 -0800
committerKent Overstreet <kent.overstreet@gmail.com>2016-08-28 19:15:18 -0800
commitc46f9987fdfdcac553ca298c6feb4c108ee9ded3 (patch)
tree71d35b7ed792c129849b13662277e4a633d3fbff
parent8f67d13e98206b2eade799b2e3ef662a2cce3716 (diff)
debug crap
-rw-r--r--fs/bcachefs/fs-io.c6
-rw-r--r--fs/bcachefs/fs-io.h1
-rw-r--r--fs/bcachefs/super.c2
3 files changed, 9 insertions, 0 deletions
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 1d08b43c355c..ef3ef3c568fb 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -227,6 +227,7 @@ static int bchfs_insert_extent(struct btree_iter *extent_iter,
BTREE_INSERT_NOFAIL|BTREE_INSERT_ATOMIC,
BTREE_INSERT_ENTRY(extent_iter, k));
}
+ BUG_ON(!ret && k->k.size);
} while (ret == -EINTR);
return ret;
@@ -1232,6 +1233,9 @@ static void bch_dio_write_done(struct dio_write *dio)
struct bio_vec *bv;
int i;
+ BUG_ON(dio->iop.op.written != dio->expected_written &&
+ !dio->iop.op.error);
+
dio->written += dio->iop.op.written << 9;
if (dio->iop.op.error)
@@ -1271,6 +1275,8 @@ static void bch_do_direct_IO_write(struct dio_write *dio)
return;
}
+ dio->expected_written = bio_sectors(bio);
+
dio->iop.ei = ei;
dio->iop.sectors_added = 0;
dio->iop.is_dio = true;
diff --git a/fs/bcachefs/fs-io.h b/fs/bcachefs/fs-io.h
index 3cf76b2f9d8f..bf055b95b7ae 100644
--- a/fs/bcachefs/fs-io.h
+++ b/fs/bcachefs/fs-io.h
@@ -66,6 +66,7 @@ struct dio_write {
struct kiocb *req;
struct cache_set *c;
long written;
+ long expected_written;
long error;
loff_t offset;
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 27d984c1d37a..6f76e8b185fd 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -759,6 +759,8 @@ bool bch_cache_set_read_only(struct cache_set *c)
if (test_and_set_bit(CACHE_SET_RO, &c->flags))
return false;
+ /* XXX: set fs read only flag */
+
trace_bcache_cache_set_read_only(c);
percpu_ref_get(&c->writes);