From 962ad1a76669443126c6531352380f56d6e5d7d2 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 23 Jun 2022 18:26:01 -0400 Subject: bcachefs: Don't BUG_ON() inode link count underflow This switches that assertion to a bch2_trans_inconsistent() call, as it should be. Signed-off-by: Kent Overstreet --- fs/bcachefs/inode.h | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'fs/bcachefs/inode.h') diff --git a/fs/bcachefs/inode.h b/fs/bcachefs/inode.h index 9442600a7440..2ac2fc10513b 100644 --- a/fs/bcachefs/inode.h +++ b/fs/bcachefs/inode.h @@ -164,23 +164,6 @@ static inline unsigned nlink_bias(umode_t mode) return S_ISDIR(mode) ? 2 : 1; } -static inline void bch2_inode_nlink_inc(struct bch_inode_unpacked *bi) -{ - if (bi->bi_flags & BCH_INODE_UNLINKED) - bi->bi_flags &= ~BCH_INODE_UNLINKED; - else - bi->bi_nlink++; -} - -static inline void bch2_inode_nlink_dec(struct bch_inode_unpacked *bi) -{ - BUG_ON(bi->bi_flags & BCH_INODE_UNLINKED); - if (bi->bi_nlink) - bi->bi_nlink--; - else - bi->bi_flags |= BCH_INODE_UNLINKED; -} - static inline unsigned bch2_inode_nlink_get(struct bch_inode_unpacked *bi) { return bi->bi_flags & BCH_INODE_UNLINKED @@ -200,4 +183,7 @@ static inline void bch2_inode_nlink_set(struct bch_inode_unpacked *bi, } } +int bch2_inode_nlink_inc(struct bch_inode_unpacked *); +void bch2_inode_nlink_dec(struct btree_trans *, struct bch_inode_unpacked *); + #endif /* _BCACHEFS_INODE_H */ -- cgit v1.2.3