summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-03-22 21:22:51 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:58 -0400
commite9b9e475eaef1c50e89072e4efc3910ff25a0552 (patch)
tree5f9da48dc2dc598a4fa16a80c914b5177ab7c8c7
parentb1c945b3fd926ea121172eedc271f4b816b44387 (diff)
downloadlwn-e9b9e475eaef1c50e89072e4efc3910ff25a0552.tar.gz
lwn-e9b9e475eaef1c50e89072e4efc3910ff25a0552.zip
bcachefs: bch2_dev_freespace_init() Print out status every 10 seconds
It appears freespace init can still take awhile, and we've had a report or two of it getting stuck - let's have it print out where it's at every 10 seconds. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/alloc_background.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 23de3ecc6a1e..aea6caa791ea 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -1890,7 +1890,8 @@ void bch2_do_invalidates(struct bch_fs *c)
bch2_write_ref_put(c, BCH_WRITE_REF_invalidate);
}
-static int bch2_dev_freespace_init(struct bch_fs *c, struct bch_dev *ca)
+static int bch2_dev_freespace_init(struct bch_fs *c, struct bch_dev *ca,
+ unsigned long *last_updated)
{
struct btree_trans trans;
struct btree_iter iter;
@@ -1910,6 +1911,12 @@ static int bch2_dev_freespace_init(struct bch_fs *c, struct bch_dev *ca)
* freespace/need_discard/need_gc_gens btrees as needed:
*/
while (1) {
+ if (*last_updated + HZ * 10 < jiffies) {
+ bch_info(ca, "%s: currently at %llu/%llu",
+ __func__, iter.pos.offset, ca->mi.nbuckets);
+ *last_updated = jiffies;
+ }
+
bch2_trans_begin(&trans);
if (bkey_ge(iter.pos, end)) {
@@ -1989,6 +1996,7 @@ int bch2_fs_freespace_init(struct bch_fs *c)
unsigned i;
int ret = 0;
bool doing_init = false;
+ unsigned long last_updated = jiffies;
/*
* We can crash during the device add path, so we need to check this on
@@ -2004,7 +2012,7 @@ int bch2_fs_freespace_init(struct bch_fs *c)
doing_init = true;
}
- ret = bch2_dev_freespace_init(c, ca);
+ ret = bch2_dev_freespace_init(c, ca, &last_updated);
if (ret) {
percpu_ref_put(&ca->ref);
return ret;