···287287 bch2_btree_add_journal_pin(c, b, journal_seq);288288289289 if (unlikely(!btree_node_dirty(b))) {290290- EBUG_ON(test_bit(BCH_FS_CLEAN_SHUTDOWN, &c->flags));290290+ EBUG_ON(test_bit(BCH_FS_clean_shutdown, &c->flags));291291 set_btree_node_dirty_acct(c, b);292292 }293293···995995 int ret;996996997997 if (likely(!(flags & BCH_TRANS_COMMIT_lazy_rw)) ||998998- test_bit(BCH_FS_STARTED, &c->flags))998998+ test_bit(BCH_FS_started, &c->flags))999999 return -BCH_ERR_erofs_trans_commit;1000100010011001 ret = drop_locks_do(trans, bch2_fs_read_write_early(c));···10601060 return ret;10611061 }1062106210631063- if (unlikely(!test_bit(BCH_FS_MAY_GO_RW, &c->flags))) {10631063+ if (unlikely(!test_bit(BCH_FS_may_go_rw, &c->flags))) {10641064 ret = do_bch2_trans_commit_to_journal_replay(trans);10651065 goto out_reset;10661066 }···10861086 goto out;10871087 }1088108810891089- EBUG_ON(test_bit(BCH_FS_CLEAN_SHUTDOWN, &c->flags));10891089+ EBUG_ON(test_bit(BCH_FS_clean_shutdown, &c->flags));1090109010911091 trans->journal_u64s = trans->extra_journal_entries.nr;10921092 trans->journal_transaction_names = READ_ONCE(c->opts.journal_transaction_names);
+2-2
fs/bcachefs/btree_update_interior.c
···20802080 a->seq = b->data->keys.seq;20812081 INIT_WORK(&a->work, async_btree_node_rewrite_work);2082208220832083- if (unlikely(!test_bit(BCH_FS_MAY_GO_RW, &c->flags))) {20832083+ if (unlikely(!test_bit(BCH_FS_may_go_rw, &c->flags))) {20842084 mutex_lock(&c->pending_node_rewrites_lock);20852085 list_add(&a->list, &c->pending_node_rewrites);20862086 mutex_unlock(&c->pending_node_rewrites_lock);···20882088 }2089208920902090 if (!bch2_write_ref_tryget(c, BCH_WRITE_REF_node_rewrite)) {20912091- if (test_bit(BCH_FS_STARTED, &c->flags)) {20912091+ if (test_bit(BCH_FS_started, &c->flags)) {20922092 bch_err(c, "%s: error getting c->writes ref", __func__);20932093 kfree(a);20942094 return;
+4-4
fs/bcachefs/chardev.c
···418418 unsigned i;419419 int ret = 0;420420421421- if (!test_bit(BCH_FS_STARTED, &c->flags))421421+ if (!test_bit(BCH_FS_started, &c->flags))422422 return -EINVAL;423423424424 if (get_user(replica_entries_bytes, &user_arg->replica_entries_bytes))···492492 struct bch_dev *ca;493493 unsigned i;494494495495- if (!test_bit(BCH_FS_STARTED, &c->flags))495495+ if (!test_bit(BCH_FS_started, &c->flags))496496 return -EINVAL;497497498498 if (copy_from_user(&arg, user_arg, sizeof(arg)))···533533 struct bch_dev *ca;534534 int ret = 0;535535536536- if (!test_bit(BCH_FS_STARTED, &c->flags))536536+ if (!test_bit(BCH_FS_started, &c->flags))537537 return -EINVAL;538538539539 if (copy_from_user(&arg, user_arg, sizeof(arg)))···725725 BCH_IOCTL(disk_get_idx, struct bch_ioctl_disk_get_idx);726726 }727727728728- if (!test_bit(BCH_FS_STARTED, &c->flags))728728+ if (!test_bit(BCH_FS_started, &c->flags))729729 return -EINVAL;730730731731 switch (cmd) {
+1-1
fs/bcachefs/ec.c
···14151415 if (ret)14161416 return ERR_PTR(ret);1417141714181418- if (test_bit(BCH_FS_GOING_RO, &c->flags)) {14181418+ if (test_bit(BCH_FS_going_ro, &c->flags)) {14191419 h = ERR_PTR(-BCH_ERR_erofs_no_writes);14201420 goto found;14211421 }
+9-9
fs/bcachefs/error.c
···7788bool bch2_inconsistent_error(struct bch_fs *c)99{1010- set_bit(BCH_FS_ERROR, &c->flags);1010+ set_bit(BCH_FS_error, &c->flags);11111212 switch (c->opts.errors) {1313 case BCH_ON_ERROR_continue:···26262727void bch2_topology_error(struct bch_fs *c)2828{2929- set_bit(BCH_FS_TOPOLOGY_ERROR, &c->flags);3030- if (test_bit(BCH_FS_FSCK_DONE, &c->flags))2929+ set_bit(BCH_FS_topology_error, &c->flags);3030+ if (test_bit(BCH_FS_fsck_done, &c->flags))3131 bch2_inconsistent_error(c);3232}3333···114114{115115 struct fsck_err_state *s;116116117117- if (test_bit(BCH_FS_FSCK_DONE, &c->flags))117117+ if (test_bit(BCH_FS_fsck_done, &c->flags))118118 return NULL;119119120120 list_for_each_entry(s, &c->fsck_error_msgs, list)···196196 prt_printf(out, bch2_log_msg(c, ""));197197#endif198198199199- if (test_bit(BCH_FS_FSCK_DONE, &c->flags)) {199199+ if (test_bit(BCH_FS_fsck_done, &c->flags)) {200200 if (c->opts.errors != BCH_ON_ERROR_continue ||201201 !(flags & (FSCK_CAN_FIX|FSCK_CAN_IGNORE))) {202202 prt_str(out, ", shutting down");···256256 if (print)257257 bch2_print_string_as_lines(KERN_ERR, out->buf);258258259259- if (!test_bit(BCH_FS_FSCK_DONE, &c->flags) &&259259+ if (!test_bit(BCH_FS_fsck_done, &c->flags) &&260260 (ret != -BCH_ERR_fsck_fix &&261261 ret != -BCH_ERR_fsck_ignore))262262 bch_err(c, "Unable to continue, halting");···274274 bch2_inconsistent_error(c);275275276276 if (ret == -BCH_ERR_fsck_fix) {277277- set_bit(BCH_FS_ERRORS_FIXED, &c->flags);277277+ set_bit(BCH_FS_errors_fixed, &c->flags);278278 } else {279279- set_bit(BCH_FS_ERRORS_NOT_FIXED, &c->flags);280280- set_bit(BCH_FS_ERROR, &c->flags);279279+ set_bit(BCH_FS_errors_not_fixed, &c->flags);280280+ set_bit(BCH_FS_error, &c->flags);281281 }282282283283 return ret;
···267267268268 while (!(ret = PTR_ERR_OR_ZERO(b)) &&269269 b &&270270- !test_bit(BCH_FS_STOPPING, &c->flags))270270+ !test_bit(BCH_FS_stopping, &c->flags))271271 b = bch2_btree_iter_next_node(&iter);272272273273 if (bch2_err_matches(ret, BCH_ERR_transaction_restart))
+17-17
fs/bcachefs/recovery.c
···533533 move_gap(keys->d, keys->nr, keys->size, keys->gap, keys->nr);534534 keys->gap = keys->nr;535535536536- set_bit(BCH_FS_MAY_GO_RW, &c->flags);536536+ set_bit(BCH_FS_may_go_rw, &c->flags);537537 if (keys->nr)538538 return bch2_fs_read_write_early(c);539539 return 0;···961961962962 /* If we fixed errors, verify that fs is actually clean now: */963963 if (IS_ENABLED(CONFIG_BCACHEFS_DEBUG) &&964964- test_bit(BCH_FS_ERRORS_FIXED, &c->flags) &&965965- !test_bit(BCH_FS_ERRORS_NOT_FIXED, &c->flags) &&966966- !test_bit(BCH_FS_ERROR, &c->flags)) {964964+ test_bit(BCH_FS_errors_fixed, &c->flags) &&965965+ !test_bit(BCH_FS_errors_not_fixed, &c->flags) &&966966+ !test_bit(BCH_FS_error, &c->flags)) {967967 bch2_flush_fsck_errs(c);968968969969 bch_info(c, "Fixed errors, running fsck a second time to verify fs is clean");970970- clear_bit(BCH_FS_ERRORS_FIXED, &c->flags);970970+ clear_bit(BCH_FS_errors_fixed, &c->flags);971971972972 c->curr_recovery_pass = BCH_RECOVERY_PASS_check_alloc_info;973973···975975 if (ret)976976 goto err;977977978978- if (test_bit(BCH_FS_ERRORS_FIXED, &c->flags) ||979979- test_bit(BCH_FS_ERRORS_NOT_FIXED, &c->flags)) {978978+ if (test_bit(BCH_FS_errors_fixed, &c->flags) ||979979+ test_bit(BCH_FS_errors_not_fixed, &c->flags)) {980980 bch_err(c, "Second fsck run was not clean");981981- set_bit(BCH_FS_ERRORS_NOT_FIXED, &c->flags);981981+ set_bit(BCH_FS_errors_not_fixed, &c->flags);982982 }983983984984- set_bit(BCH_FS_ERRORS_FIXED, &c->flags);984984+ set_bit(BCH_FS_errors_fixed, &c->flags);985985 }986986987987 if (enabled_qtypes(c)) {···10001000 write_sb = true;10011001 }1002100210031003- if (!test_bit(BCH_FS_ERROR, &c->flags) &&10031003+ if (!test_bit(BCH_FS_error, &c->flags) &&10041004 !(c->disk_sb.sb->compat[0] & cpu_to_le64(1ULL << BCH_COMPAT_alloc_info))) {10051005 c->disk_sb.sb->compat[0] |= cpu_to_le64(1ULL << BCH_COMPAT_alloc_info);10061006 write_sb = true;10071007 }1008100810091009- if (!test_bit(BCH_FS_ERROR, &c->flags)) {10091009+ if (!test_bit(BCH_FS_error, &c->flags)) {10101010 struct bch_sb_field_ext *ext = bch2_sb_field_get(c->disk_sb.sb, ext);10111011 if (ext &&10121012 (!bch2_is_zero(ext->recovery_passes_required, sizeof(ext->recovery_passes_required)) ||···10181018 }1019101910201020 if (c->opts.fsck &&10211021- !test_bit(BCH_FS_ERROR, &c->flags) &&10221022- !test_bit(BCH_FS_ERRORS_NOT_FIXED, &c->flags)) {10211021+ !test_bit(BCH_FS_error, &c->flags) &&10221022+ !test_bit(BCH_FS_errors_not_fixed, &c->flags)) {10231023 SET_BCH_SB_HAS_ERRORS(c->disk_sb.sb, 0);10241024 SET_BCH_SB_HAS_TOPOLOGY_ERRORS(c->disk_sb.sb, 0);10251025 write_sb = true;···1053105310541054 ret = 0;10551055out:10561056- set_bit(BCH_FS_FSCK_DONE, &c->flags);10561056+ set_bit(BCH_FS_fsck_done, &c->flags);10571057 bch2_flush_fsck_errs(c);1058105810591059 if (!c->opts.keep_journal &&···10611061 bch2_journal_keys_put_initial(c);10621062 kfree(clean);1063106310641064- if (!ret && test_bit(BCH_FS_NEED_DELETE_DEAD_SNAPSHOTS, &c->flags)) {10641064+ if (!ret && test_bit(BCH_FS_need_delete_dead_snapshots, &c->flags)) {10651065 bch2_fs_read_write_early(c);10661066 bch2_delete_dead_snapshots_async(c);10671067 }···11001100 mutex_unlock(&c->sb_lock);1101110111021102 c->curr_recovery_pass = ARRAY_SIZE(recovery_pass_fns);11031103- set_bit(BCH_FS_MAY_GO_RW, &c->flags);11041104- set_bit(BCH_FS_FSCK_DONE, &c->flags);11031103+ set_bit(BCH_FS_may_go_rw, &c->flags);11041104+ set_bit(BCH_FS_fsck_done, &c->flags);1105110511061106 for (i = 0; i < BTREE_ID_NR; i++)11071107 bch2_btree_root_alloc(c, i);
+4-4
fs/bcachefs/snapshot.c
···318318 __set_is_ancestor_bitmap(c, id);319319320320 if (BCH_SNAPSHOT_DELETED(s.v)) {321321- set_bit(BCH_FS_NEED_DELETE_DEAD_SNAPSHOTS, &c->flags);321321+ set_bit(BCH_FS_need_delete_dead_snapshots, &c->flags);322322 if (c->curr_recovery_pass > BCH_RECOVERY_PASS_delete_dead_snapshots)323323 bch2_delete_dead_snapshots_async(c);324324 }···13761376 u32 *i, id;13771377 int ret = 0;1378137813791379- if (!test_and_clear_bit(BCH_FS_NEED_DELETE_DEAD_SNAPSHOTS, &c->flags))13791379+ if (!test_and_clear_bit(BCH_FS_need_delete_dead_snapshots, &c->flags))13801380 return 0;1381138113821382- if (!test_bit(BCH_FS_STARTED, &c->flags)) {13821382+ if (!test_bit(BCH_FS_started, &c->flags)) {13831383 ret = bch2_fs_read_write_early(c);13841384 if (ret) {13851385 bch_err_msg(c, ret, "deleting dead snapshots: error going rw");···16801680 if (BCH_SNAPSHOT_DELETED(snap.v) ||16811681 bch2_snapshot_equiv(c, k.k->p.offset) != k.k->p.offset ||16821682 (ret = bch2_snapshot_needs_delete(trans, k)) > 0) {16831683- set_bit(BCH_FS_NEED_DELETE_DEAD_SNAPSHOTS, &c->flags);16831683+ set_bit(BCH_FS_need_delete_dead_snapshots, &c->flags);16841684 return 0;16851685 }16861686
+2-2
fs/bcachefs/super-io.c
···950950951951 le64_add_cpu(&c->disk_sb.sb->seq, 1);952952953953- if (test_bit(BCH_FS_ERROR, &c->flags))953953+ if (test_bit(BCH_FS_error, &c->flags))954954 SET_BCH_SB_HAS_ERRORS(c->disk_sb.sb, 1);955955- if (test_bit(BCH_FS_TOPOLOGY_ERROR, &c->flags))955955+ if (test_bit(BCH_FS_topology_error, &c->flags))956956 SET_BCH_SB_HAS_TOPOLOGY_ERRORS(c->disk_sb.sb, 1);957957958958 SET_BCH_SB_BIG_ENDIAN(c->disk_sb.sb, CPU_BIG_ENDIAN);
+35-28
fs/bcachefs/super.c
···7979MODULE_SOFTDEP("pre: poly1305");8080MODULE_SOFTDEP("pre: xxhash");81818282+const char * const bch2_fs_flag_strs[] = {8383+#define x(n) #n,8484+ BCH_FS_FLAGS()8585+#undef x8686+ NULL8787+};8888+8289#define KTYPE(type) \8390static const struct attribute_group type ## _group = { \8491 .attrs = type ## _files \···253246 journal_cur_seq(&c->journal));254247255248 if (test_bit(JOURNAL_REPLAY_DONE, &c->journal.flags) &&256256- !test_bit(BCH_FS_EMERGENCY_RO, &c->flags))257257- set_bit(BCH_FS_CLEAN_SHUTDOWN, &c->flags);249249+ !test_bit(BCH_FS_emergency_ro, &c->flags))250250+ set_bit(BCH_FS_clean_shutdown, &c->flags);258251 bch2_fs_journal_stop(&c->journal);259252260253 /*···269262{270263 struct bch_fs *c = container_of(writes, struct bch_fs, writes);271264272272- set_bit(BCH_FS_WRITE_DISABLE_COMPLETE, &c->flags);265265+ set_bit(BCH_FS_write_disable_complete, &c->flags);273266 wake_up(&bch2_read_only_wait);274267}275268#endif276269277270void bch2_fs_read_only(struct bch_fs *c)278271{279279- if (!test_bit(BCH_FS_RW, &c->flags)) {272272+ if (!test_bit(BCH_FS_rw, &c->flags)) {280273 bch2_journal_reclaim_stop(&c->journal);281274 return;282275 }283276284284- BUG_ON(test_bit(BCH_FS_WRITE_DISABLE_COMPLETE, &c->flags));277277+ BUG_ON(test_bit(BCH_FS_write_disable_complete, &c->flags));285278286279 bch_verbose(c, "going read-only");287280···289282 * Block new foreground-end write operations from starting - any new290283 * writes will return -EROFS:291284 */292292- set_bit(BCH_FS_GOING_RO, &c->flags);285285+ set_bit(BCH_FS_going_ro, &c->flags);293286#ifndef BCH_WRITE_REF_DEBUG294287 percpu_ref_kill(&c->writes);295288#else···309302 * that going RO is complete:310303 */311304 wait_event(bch2_read_only_wait,312312- test_bit(BCH_FS_WRITE_DISABLE_COMPLETE, &c->flags) ||313313- test_bit(BCH_FS_EMERGENCY_RO, &c->flags));305305+ test_bit(BCH_FS_write_disable_complete, &c->flags) ||306306+ test_bit(BCH_FS_emergency_ro, &c->flags));314307315315- bool writes_disabled = test_bit(BCH_FS_WRITE_DISABLE_COMPLETE, &c->flags);308308+ bool writes_disabled = test_bit(BCH_FS_write_disable_complete, &c->flags);316309 if (writes_disabled)317310 bch_verbose(c, "finished waiting for writes to stop");318311319312 __bch2_fs_read_only(c);320313321314 wait_event(bch2_read_only_wait,322322- test_bit(BCH_FS_WRITE_DISABLE_COMPLETE, &c->flags));315315+ test_bit(BCH_FS_write_disable_complete, &c->flags));323316324317 if (!writes_disabled)325318 bch_verbose(c, "finished waiting for writes to stop");326319327327- clear_bit(BCH_FS_WRITE_DISABLE_COMPLETE, &c->flags);328328- clear_bit(BCH_FS_GOING_RO, &c->flags);329329- clear_bit(BCH_FS_RW, &c->flags);320320+ clear_bit(BCH_FS_write_disable_complete, &c->flags);321321+ clear_bit(BCH_FS_going_ro, &c->flags);322322+ clear_bit(BCH_FS_rw, &c->flags);330323331324 if (!bch2_journal_error(&c->journal) &&332332- !test_bit(BCH_FS_ERROR, &c->flags) &&333333- !test_bit(BCH_FS_EMERGENCY_RO, &c->flags) &&334334- test_bit(BCH_FS_STARTED, &c->flags) &&335335- test_bit(BCH_FS_CLEAN_SHUTDOWN, &c->flags) &&325325+ !test_bit(BCH_FS_error, &c->flags) &&326326+ !test_bit(BCH_FS_emergency_ro, &c->flags) &&327327+ test_bit(BCH_FS_started, &c->flags) &&328328+ test_bit(BCH_FS_clean_shutdown, &c->flags) &&336329 !c->opts.norecovery) {337330 BUG_ON(c->journal.last_empty_seq != journal_cur_seq(&c->journal));338331 BUG_ON(atomic_read(&c->btree_cache.dirty));···363356364357bool bch2_fs_emergency_read_only(struct bch_fs *c)365358{366366- bool ret = !test_and_set_bit(BCH_FS_EMERGENCY_RO, &c->flags);359359+ bool ret = !test_and_set_bit(BCH_FS_emergency_ro, &c->flags);367360368361 bch2_journal_halt(&c->journal);369362 bch2_fs_read_only_async(c);···404397 unsigned i;405398 int ret;406399407407- if (test_bit(BCH_FS_INITIAL_GC_UNFIXED, &c->flags)) {400400+ if (test_bit(BCH_FS_initial_gc_unfixed, &c->flags)) {408401 bch_err(c, "cannot go rw, unfixed btree errors");409402 return -BCH_ERR_erofs_unfixed_errors;410403 }411404412412- if (test_bit(BCH_FS_RW, &c->flags))405405+ if (test_bit(BCH_FS_rw, &c->flags))413406 return 0;414407415408 if (c->opts.norecovery)···432425 if (ret)433426 goto err;434427435435- clear_bit(BCH_FS_CLEAN_SHUTDOWN, &c->flags);428428+ clear_bit(BCH_FS_clean_shutdown, &c->flags);436429437430 /*438431 * First journal write must be a flush write: after a clean shutdown we···446439 bch2_dev_allocator_add(c, ca);447440 bch2_recalc_capacity(c);448441449449- set_bit(BCH_FS_RW, &c->flags);450450- set_bit(BCH_FS_WAS_RW, &c->flags);442442+ set_bit(BCH_FS_rw, &c->flags);443443+ set_bit(BCH_FS_was_rw, &c->flags);451444452445#ifndef BCH_WRITE_REF_DEBUG453446 percpu_ref_reinit(&c->writes);···480473 bch2_do_pending_node_rewrites(c);481474 return 0;482475err:483483- if (test_bit(BCH_FS_RW, &c->flags))476476+ if (test_bit(BCH_FS_rw, &c->flags))484477 bch2_fs_read_only(c);485478 else486479 __bch2_fs_read_only(c);···580573581574 bch_verbose(c, "shutting down");582575583583- set_bit(BCH_FS_STOPPING, &c->flags);576576+ set_bit(BCH_FS_stopping, &c->flags);584577585578 cancel_work_sync(&c->journal_seq_blacklist_gc_work);586579···973966974967 down_write(&c->state_lock);975968976976- BUG_ON(test_bit(BCH_FS_STARTED, &c->flags));969969+ BUG_ON(test_bit(BCH_FS_started, &c->flags));977970978971 mutex_lock(&c->sb_lock);979972···10081001 goto err;10091002 }1010100310111011- set_bit(BCH_FS_STARTED, &c->flags);10041004+ set_bit(BCH_FS_started, &c->flags);1012100510131006 if (c->opts.read_only || c->opts.nochanges) {10141007 bch2_fs_read_only(c);10151008 } else {10161016- ret = !test_bit(BCH_FS_RW, &c->flags)10091009+ ret = !test_bit(BCH_FS_rw, &c->flags)10171010 ? bch2_fs_read_write(c)10181011 : bch2_fs_read_write_late(c);10191012 if (ret)