2 #include <linux/types.h>
10 #define BTRFS_FID_SIZE_NON_CONNECTABLE (offsetof(struct btrfs_fid, \
12 #define BTRFS_FID_SIZE_CONNECTABLE (offsetof(struct btrfs_fid, \
13 parent_root_objectid) / 4)
14 #define BTRFS_FID_SIZE_CONNECTABLE_ROOT (sizeof(struct btrfs_fid) / 4)
16 static int btrfs_encode_fh(
struct inode *
inode,
u32 *fh,
int *max_len,
43 parent_root_id = BTRFS_I(parent)->root->objectid;
85 if (btrfs_root_refs(&root->
root_item) == 0) {
102 if (check_generation && generation != inode->
i_generation) {
114 int fh_len,
int fh_type)
134 return btrfs_get_dentry(sb, objectid, root_objectid, generation, 1);
138 int fh_len,
int fh_type)
154 generation = fid->
gen;
156 return btrfs_get_dentry(sb, objectid, root_objectid, generation, 1);
178 root = root->
fs_info->tree_root;
180 key.objectid = btrfs_ino(dir);
190 if (path->
slots[0] == 0) {
196 leaf = path->
nodes[0];
198 btrfs_item_key_to_cpu(leaf, &found_key, path->
slots[0]);
199 if (found_key.objectid !=
key.objectid || found_key.type !=
key.type) {
207 key.objectid = btrfs_root_ref_dirid(leaf, ref);
209 key.objectid = found_key.offset;
214 return btrfs_get_dentry(root->
fs_info->sb,
key.objectid,
215 found_key.offset, 0, 0);
226 static int btrfs_get_name(
struct dentry *parent,
char *
name,
229 struct inode *inode = child->
d_inode;
230 struct inode *dir = parent->
d_inode;
236 unsigned long name_ptr;
248 ino = btrfs_ino(inode);
256 key.objectid = BTRFS_I(inode)->root->root_key.objectid;
259 root = root->
fs_info->tree_root;
262 key.offset = btrfs_ino(dir);
270 }
else if (ret > 0) {
278 leaf = path->
nodes[0];
283 name_ptr = (
unsigned long)(rref + 1);
284 name_len = btrfs_root_ref_name_len(leaf, rref);
288 name_ptr = (
unsigned long)(iref + 1);
289 name_len = btrfs_inode_ref_name_len(leaf, iref);
305 .encode_fh = btrfs_encode_fh,
306 .fh_to_dentry = btrfs_fh_to_dentry,
307 .fh_to_parent = btrfs_fh_to_parent,
308 .get_parent = btrfs_get_parent,
309 .get_name = btrfs_get_name,