diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-06-24 01:26:01 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:34 +0300 |
commit | 962ad1a76669443126c6531352380f56d6e5d7d2 (patch) | |
tree | f70e62b61772e2cc0a341d4c3c06e26898331a9a /fs/bcachefs/inode.h | |
parent | 7a47d0993be95bf68e2e04653f40d311e3c25bed (diff) | |
download | linux-962ad1a76669443126c6531352380f56d6e5d7d2.tar.xz |
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 <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/inode.h')
-rw-r--r-- | fs/bcachefs/inode.h | 20 |
1 files changed, 3 insertions, 17 deletions
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 */ |