1
2
3#ifndef BTRFS_INODE_ITEM_H
4#define BTRFS_INODE_ITEM_H
5
6#include <linux/types.h>
7
8struct btrfs_trans_handle;
9struct btrfs_root;
10struct btrfs_path;
11struct btrfs_key;
12struct btrfs_inode_extref;
13struct btrfs_inode;
14struct extent_buffer;
15
16
17
18
19
20#define BTRFS_NEED_TRUNCATE_BLOCK 1
21
22struct btrfs_truncate_control {
23
24
25
26
27 struct btrfs_inode *inode;
28
29
30 u64 new_size;
31
32
33 u64 extents_found;
34
35
36 u64 last_size;
37
38
39 u64 sub_bytes;
40
41
42 u64 ino;
43
44
45
46
47
48 u32 min_type;
49
50
51
52
53
54 bool skip_ref_updates;
55
56
57
58
59
60 bool clear_extent_range;
61};
62
63int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
64 struct btrfs_root *root,
65 struct btrfs_truncate_control *control);
66int btrfs_insert_inode_ref(struct btrfs_trans_handle *trans,
67 struct btrfs_root *root,
68 const char *name, int name_len,
69 u64 inode_objectid, u64 ref_objectid, u64 index);
70int btrfs_del_inode_ref(struct btrfs_trans_handle *trans,
71 struct btrfs_root *root,
72 const char *name, int name_len,
73 u64 inode_objectid, u64 ref_objectid, u64 *index);
74int btrfs_insert_empty_inode(struct btrfs_trans_handle *trans,
75 struct btrfs_root *root,
76 struct btrfs_path *path, u64 objectid);
77int btrfs_lookup_inode(struct btrfs_trans_handle *trans, struct btrfs_root
78 *root, struct btrfs_path *path,
79 struct btrfs_key *location, int mod);
80
81struct btrfs_inode_extref *btrfs_lookup_inode_extref(
82 struct btrfs_trans_handle *trans,
83 struct btrfs_root *root,
84 struct btrfs_path *path,
85 const char *name, int name_len,
86 u64 inode_objectid, u64 ref_objectid, int ins_len,
87 int cow);
88
89struct btrfs_inode_ref *btrfs_find_name_in_backref(struct extent_buffer *leaf,
90 int slot, const char *name,
91 int name_len);
92struct btrfs_inode_extref *btrfs_find_name_in_ext_backref(
93 struct extent_buffer *leaf, int slot, u64 ref_objectid,
94 const char *name, int name_len);
95
96#endif
97