bcachefs: Fix bch2_delete_dead_inodes()

- the fsck_err() check for the filesystem being clean was incorrect,
   causing us to always fail to delete unlinked inodes
 - if a snapshot had been taken, the unlinked inode needs to be
   propagated to snapshot leaves so the unlink can happen there - fixed.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet
2023-11-02 15:28:15 -04:00
parent 7cb2a7895d
commit 4bd156c4b4
2 changed files with 69 additions and 22 deletions

View File

@ -3,6 +3,7 @@
#define _BCACHEFS_INODE_H
#include "bkey.h"
#include "bkey_methods.h"
#include "opts.h"
enum bkey_invalid_flags;
@ -101,8 +102,16 @@ void bch2_inode_unpacked_to_text(struct printbuf *, struct bch_inode_unpacked *)
int bch2_inode_peek(struct btree_trans *, struct btree_iter *,
struct bch_inode_unpacked *, subvol_inum, unsigned);
int bch2_inode_write(struct btree_trans *, struct btree_iter *,
struct bch_inode_unpacked *);
int bch2_inode_write_flags(struct btree_trans *, struct btree_iter *,
struct bch_inode_unpacked *, enum btree_update_flags);
static inline int bch2_inode_write(struct btree_trans *trans,
struct btree_iter *iter,
struct bch_inode_unpacked *inode)
{
return bch2_inode_write_flags(trans, iter, inode, 0);
}
void bch2_inode_init_early(struct bch_fs *,
struct bch_inode_unpacked *);