6 #include <linux/seqlock.h>
7 #include <linux/stat.h>
9 struct bch_inode_info {
12 struct mutex ei_update_lock;
15 atomic_long_t ei_size_dirty_count;
18 * these are updated whenever we update the inode in the btree - for
24 atomic_long_t ei_sectors_dirty_count;
25 atomic64_t ei_sectors;
27 struct bch_hash_info ei_str_hash;
29 unsigned long ei_last_dirtied;
32 #define to_bch_ei(_inode) \
33 container_of_or_null(_inode, struct bch_inode_info, v)
35 static inline struct bch_inode_info *file_bch_inode(struct file *file)
37 return to_bch_ei(file_inode(file));
40 static inline u8 mode_to_type(umode_t mode)
42 return (mode >> 12) & 15;
45 static inline unsigned nlink_bias(umode_t mode)
47 return S_ISDIR(mode) ? 2 : 1;
50 struct bch_inode_unpacked;
52 #ifndef NO_BCACHEFS_FS
54 /* returns 0 if we want to do the update, or error is passed up */
55 typedef int (*inode_set_fn)(struct bch_inode_info *,
56 struct bch_inode_unpacked *, void *);
58 int __must_check __bch2_write_inode(struct bch_fs *, struct bch_inode_info *,
59 inode_set_fn, void *);
60 int __must_check bch2_write_inode(struct bch_fs *,
61 struct bch_inode_info *);
63 void bch2_vfs_exit(void);
64 int bch2_vfs_init(void);
68 static inline void bch2_vfs_exit(void) {}
69 static inline int bch2_vfs_init(void) { return 0; }
71 #endif /* NO_BCACHEFS_FS */
73 #endif /* _BCACHEFS_FS_H */