summaryrefslogtreecommitdiff
path: root/fs/bcachefs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-04-15 15:12:58 -0800
committerKent Overstreet <kent.overstreet@gmail.com>2016-08-28 19:15:18 -0800
commit8f67d13e98206b2eade799b2e3ef662a2cce3716 (patch)
treea4e6508356d4eba8d42c7fd9562d3eb5e7bf0b61 /fs/bcachefs
parentd9e5f5c16d11a819ae784ee6d25cd933f45b568d (diff)
foo
Diffstat (limited to 'fs/bcachefs')
-rw-r--r--fs/bcachefs/btree_cache.c2
-rw-r--r--fs/bcachefs/buckets_types.h15
-rw-r--r--fs/bcachefs/extents.c7
3 files changed, 23 insertions, 1 deletions
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index 569a72a111c0..8a572185eb11 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -408,7 +408,7 @@ int bch_btree_cache_alloc(struct cache_set *c)
c->btree_cache_shrink.count_objects = bch_mca_count;
c->btree_cache_shrink.scan_objects = bch_mca_scan;
- c->btree_cache_shrink.seeks = 4;
+ c->btree_cache_shrink.seeks = 8;
c->btree_cache_shrink.batch = btree_pages(c) * 2;
register_shrinker(&c->btree_cache_shrink);
diff --git a/fs/bcachefs/buckets_types.h b/fs/bcachefs/buckets_types.h
index 256f6fe7f272..a1914404531e 100644
--- a/fs/bcachefs/buckets_types.h
+++ b/fs/bcachefs/buckets_types.h
@@ -16,6 +16,21 @@ struct bucket_mark {
};
};
+struct bucket_mark64 {
+ union {
+ struct {
+ u64 counter;
+ };
+
+ struct {
+ unsigned owned_by_allocator:1;
+ unsigned cached_sectors:31;
+ unsigned is_metadata:1;
+ unsigned dirty_sectors:31;
+ };
+ };
+};
+
struct bucket {
union {
struct {
diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c
index eb25ca261f7f..d041f0cfbdc7 100644
--- a/fs/bcachefs/extents.c
+++ b/fs/bcachefs/extents.c
@@ -1229,6 +1229,7 @@ bch_insert_fixup_extent(struct btree_insert *trans,
u64 start_time = local_clock();
enum btree_insert_ret ret = BTREE_INSERT_OK;
struct bpos committed_pos = iter->pos;
+ unsigned orig_sectors = insert->k->k.size;
EBUG_ON(iter->level);
EBUG_ON(bkey_deleted(&insert->k->k) || !insert->k->k.size);
@@ -1397,6 +1398,12 @@ bch_insert_fixup_extent(struct btree_insert *trans,
stop:
extent_insert_committed(trans, insert, committed_pos, res, &stats);
+ BUG_ON((s64) (stats.sectors_dirty +
+ stats.sectors_meta +
+ stats.sectors_persistent_reserved +
+ stats.sectors_online_reserved) >
+ (orig_sectors - insert->k->k.size));
+
bch_cache_set_stats_apply(c, &stats, trans->disk_res,
gc_pos_btree_node(b));