Commit | Line | Data |
---|---|---|
26c2c454 JB |
1 | /* SPDX-License-Identifier: GPL-2.0 */ |
2 | ||
3 | #ifndef BTRFS_INODE_ITEM_H | |
4 | #define BTRFS_INODE_ITEM_H | |
5 | ||
6 | #include <linux/types.h> | |
7 | ||
8 | struct btrfs_trans_handle; | |
9 | struct btrfs_root; | |
10 | struct btrfs_path; | |
11 | struct btrfs_key; | |
12 | struct btrfs_inode_extref; | |
54f03ab1 | 13 | struct btrfs_inode; |
26c2c454 JB |
14 | struct extent_buffer; |
15 | ||
54f03ab1 JB |
16 | /* |
17 | * Return this if we need to call truncate_block for the last bit of the | |
18 | * truncate. | |
19 | */ | |
20 | #define BTRFS_NEED_TRUNCATE_BLOCK 1 | |
21 | ||
d9ac19c3 JB |
22 | struct btrfs_truncate_control { |
23 | /* IN: the size we're truncating to. */ | |
24 | u64 new_size; | |
25 | ||
26 | /* OUT: the number of extents truncated. */ | |
27 | u64 extents_found; | |
28 | ||
c2ddb612 JB |
29 | /* OUT: the last size we truncated this inode to. */ |
30 | u64 last_size; | |
31 | ||
462b728e JB |
32 | /* OUT: the number of bytes to sub from this inode. */ |
33 | u64 sub_bytes; | |
34 | ||
d9ac19c3 JB |
35 | /* |
36 | * IN: minimum key type to remove. All key types with this type are | |
37 | * removed only if their offset >= new_size. | |
38 | */ | |
39 | u32 min_type; | |
40 | }; | |
41 | ||
54f03ab1 JB |
42 | int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, |
43 | struct btrfs_root *root, | |
d9ac19c3 JB |
44 | struct btrfs_inode *inode, |
45 | struct btrfs_truncate_control *control); | |
26c2c454 JB |
46 | int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans, |
47 | struct btrfs_root *root, | |
48 | const char *name, int name_len, | |
49 | u64 inode_objectid, u64 ref_objectid, u64 index); | |
50 | int btrfs_del_inode_ref(struct btrfs_trans_handle *trans, | |
51 | struct btrfs_root *root, | |
52 | const char *name, int name_len, | |
53 | u64 inode_objectid, u64 ref_objectid, u64 *index); | |
54 | int btrfs_insert_empty_inode(struct btrfs_trans_handle *trans, | |
55 | struct btrfs_root *root, | |
56 | struct btrfs_path *path, u64 objectid); | |
57 | int btrfs_lookup_inode(struct btrfs_trans_handle *trans, struct btrfs_root | |
58 | *root, struct btrfs_path *path, | |
59 | struct btrfs_key *location, int mod); | |
60 | ||
61 | struct btrfs_inode_extref *btrfs_lookup_inode_extref( | |
62 | struct btrfs_trans_handle *trans, | |
63 | struct btrfs_root *root, | |
64 | struct btrfs_path *path, | |
65 | const char *name, int name_len, | |
66 | u64 inode_objectid, u64 ref_objectid, int ins_len, | |
67 | int cow); | |
68 | ||
69 | struct btrfs_inode_ref *btrfs_find_name_in_backref(struct extent_buffer *leaf, | |
70 | int slot, const char *name, | |
71 | int name_len); | |
72 | struct btrfs_inode_extref *btrfs_find_name_in_ext_backref( | |
73 | struct extent_buffer *leaf, int slot, u64 ref_objectid, | |
74 | const char *name, int name_len); | |
75 | ||
76 | #endif |