]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Initialize ec work structs early
authorKent Overstreet <kent.overstreet@gmail.com>
Sat, 9 Apr 2022 05:23:50 +0000 (01:23 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:31 +0000 (17:09 -0400)
We need to ensure that work structs in bch_fs always get initialized -
otherwise an error in filesystem initialization can pop a warning in the
workqueue code when we try to cancel a work struct that wasn't
initialized.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/ec.c
fs/bcachefs/ec.h
fs/bcachefs/super.c

index 7a524f604875f86c1799cf0c485cb5761935679e..ae33d3ea8ec1f3d92cf2dea68e1f89af4165d696 100644 (file)
@@ -1682,11 +1682,14 @@ void bch2_fs_ec_exit(struct bch_fs *c)
        bioset_exit(&c->ec_bioset);
 }
 
-int bch2_fs_ec_init(struct bch_fs *c)
+void bch2_fs_ec_init_early(struct bch_fs *c)
 {
        INIT_WORK(&c->ec_stripe_create_work, ec_stripe_create_work);
        INIT_WORK(&c->ec_stripe_delete_work, ec_stripe_delete_work);
+}
 
+int bch2_fs_ec_init(struct bch_fs *c)
+{
        return bioset_init(&c->ec_bioset, 1, offsetof(struct ec_bio, bio),
                           BIOSET_NEED_BVECS);
 }
index af7f8eee94b09d39406938b706ee1359b547968c..a4c13d61af109a89d6205752bf8e0e2b5a7bd565 100644 (file)
@@ -224,6 +224,7 @@ void bch2_stripes_heap_to_text(struct printbuf *, struct bch_fs *);
 void bch2_new_stripes_to_text(struct printbuf *, struct bch_fs *);
 
 void bch2_fs_ec_exit(struct bch_fs *);
+void bch2_fs_ec_init_early(struct bch_fs *);
 int bch2_fs_ec_init(struct bch_fs *);
 
 #endif /* _BCACHEFS_EC_H */
index 689c82f6cb5d31405639bcb7cd8233c7d02437fe..d2776efa9985ec90de9a6e57546e74bf3f4f7d07 100644 (file)
@@ -663,6 +663,7 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
        bch2_fs_allocator_foreground_init(c);
        bch2_fs_rebalance_init(c);
        bch2_fs_quota_init(c);
+       bch2_fs_ec_init_early(c);
 
        INIT_LIST_HEAD(&c->list);