7 #include "quota_types.h"
9 #include <linux/seqlock.h>
10 #include <linux/stat.h>
12 struct bch_inode_info {
15 struct mutex ei_update_lock;
17 u64 ei_quota_reserved;
18 unsigned long ei_last_dirtied;
20 struct mutex ei_quota_lock;
21 struct bch_qid ei_qid;
23 struct bch_hash_info ei_str_hash;
25 /* copy of inode in btree: */
26 struct bch_inode_unpacked ei_inode;
29 #define to_bch_ei(_inode) \
30 container_of_or_null(_inode, struct bch_inode_info, v)
32 static inline struct bch_inode_info *file_bch_inode(struct file *file)
34 return to_bch_ei(file_inode(file));
37 static inline u8 mode_to_type(umode_t mode)
39 return (mode >> 12) & 15;
42 static inline unsigned nlink_bias(umode_t mode)
44 return S_ISDIR(mode) ? 2 : 1;
47 static inline u64 bch2_current_time(struct bch_fs *c)
49 return timespec_to_bch2_time(c, current_kernel_time64());
52 struct bch_inode_unpacked;
54 #ifndef NO_BCACHEFS_FS
56 /* returns 0 if we want to do the update, or error is passed up */
57 typedef int (*inode_set_fn)(struct bch_inode_info *,
58 struct bch_inode_unpacked *, void *);
60 void bch2_inode_update_after_write(struct bch_fs *,
61 struct bch_inode_info *,
62 struct bch_inode_unpacked *,
64 int __must_check bch2_write_inode_trans(struct btree_trans *,
65 struct bch_inode_info *,
66 struct bch_inode_unpacked *,
67 inode_set_fn, void *);
68 int __must_check bch2_write_inode(struct bch_fs *, struct bch_inode_info *,
69 inode_set_fn, void *, unsigned);
71 void bch2_vfs_exit(void);
72 int bch2_vfs_init(void);
76 static inline void bch2_vfs_exit(void) {}
77 static inline int bch2_vfs_init(void) { return 0; }
79 #endif /* NO_BCACHEFS_FS */
81 #endif /* _BCACHEFS_FS_H */