Lines Matching refs:frag

128 	struct ceph_inode_frag *frag;  in __get_or_create_frag()  local
134 frag = rb_entry(parent, struct ceph_inode_frag, node); in __get_or_create_frag()
135 c = ceph_frag_compare(f, frag->frag); in __get_or_create_frag()
141 return frag; in __get_or_create_frag()
144 frag = kmalloc(sizeof(*frag), GFP_NOFS); in __get_or_create_frag()
145 if (!frag) in __get_or_create_frag()
148 frag->frag = f; in __get_or_create_frag()
149 frag->split_by = 0; in __get_or_create_frag()
150 frag->mds = -1; in __get_or_create_frag()
151 frag->ndist = 0; in __get_or_create_frag()
153 rb_link_node(&frag->node, parent, p); in __get_or_create_frag()
154 rb_insert_color(&frag->node, &ci->i_fragtree); in __get_or_create_frag()
158 return frag; in __get_or_create_frag()
169 struct ceph_inode_frag *frag = in __ceph_find_frag() local
171 int c = ceph_frag_compare(f, frag->frag); in __ceph_find_frag()
177 return frag; in __ceph_find_frag()
191 struct ceph_inode_frag *frag; in __ceph_choose_frag() local
200 frag = __ceph_find_frag(ci, t); in __ceph_choose_frag()
201 if (!frag) in __ceph_choose_frag()
203 if (frag->split_by == 0) { in __ceph_choose_frag()
205 memcpy(pfrag, frag, sizeof(*pfrag)); in __ceph_choose_frag()
212 nway = 1 << frag->split_by; in __ceph_choose_frag()
214 frag->split_by, nway); in __ceph_choose_frag()
216 n = ceph_frag_make_child(t, frag->split_by, i); in __ceph_choose_frag()
248 struct ceph_inode_frag *frag; in ceph_fill_dirfrag() local
249 u32 id = le32_to_cpu(dirinfo->frag); in ceph_fill_dirfrag()
267 frag = __ceph_find_frag(ci, id); in ceph_fill_dirfrag()
268 if (!frag) in ceph_fill_dirfrag()
270 if (frag->split_by == 0) { in ceph_fill_dirfrag()
274 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_dirfrag()
275 kfree(frag); in ceph_fill_dirfrag()
280 frag->mds = -1; in ceph_fill_dirfrag()
281 frag->ndist = 0; in ceph_fill_dirfrag()
288 frag = __get_or_create_frag(ci, id); in ceph_fill_dirfrag()
289 if (IS_ERR(frag)) { in ceph_fill_dirfrag()
293 ceph_vinop(inode), le32_to_cpu(dirinfo->frag)); in ceph_fill_dirfrag()
298 frag->mds = mds; in ceph_fill_dirfrag()
299 frag->ndist = min_t(u32, ndist, CEPH_MAX_DIRFRAG_REP); in ceph_fill_dirfrag()
300 for (i = 0; i < frag->ndist; i++) in ceph_fill_dirfrag()
301 frag->dist[i] = le32_to_cpu(dirinfo->dist[i]); in ceph_fill_dirfrag()
303 ceph_vinop(inode), frag->frag, frag->ndist); in ceph_fill_dirfrag()
314 return ceph_frag_compare(le32_to_cpu(ls->frag), in frag_tree_split_cmp()
315 le32_to_cpu(rs->frag)); in frag_tree_split_cmp()
318 static bool is_frag_child(u32 f, struct ceph_inode_frag *frag) in is_frag_child() argument
320 if (!frag) in is_frag_child()
322 if (ceph_frag_bits(f) != ceph_frag_bits(frag->frag) + frag->split_by) in is_frag_child()
324 return ceph_frag_contains_value(frag->frag, ceph_frag_value(f)); in is_frag_child()
332 struct ceph_inode_frag *frag, *prev_frag = NULL; in ceph_fill_fragtree() local
344 id = le32_to_cpu(fragtree->splits[i].frag); in ceph_fill_fragtree()
349 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
350 if (frag->frag != ceph_frag_make(0, 0) || rb_next(rb_node)) in ceph_fill_fragtree()
354 id = le32_to_cpu(dirinfo->frag); in ceph_fill_fragtree()
369 id = le32_to_cpu(fragtree->splits[i].frag); in ceph_fill_fragtree()
377 frag = NULL; in ceph_fill_fragtree()
379 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
380 if (ceph_frag_compare(frag->frag, id) >= 0) { in ceph_fill_fragtree()
381 if (frag->frag != id) in ceph_fill_fragtree()
382 frag = NULL; in ceph_fill_fragtree()
389 if (frag->split_by > 0 || in ceph_fill_fragtree()
390 !is_frag_child(frag->frag, prev_frag)) { in ceph_fill_fragtree()
391 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_fragtree()
392 if (frag->split_by > 0) in ceph_fill_fragtree()
394 kfree(frag); in ceph_fill_fragtree()
396 frag = NULL; in ceph_fill_fragtree()
398 if (!frag) { in ceph_fill_fragtree()
399 frag = __get_or_create_frag(ci, id); in ceph_fill_fragtree()
400 if (IS_ERR(frag)) in ceph_fill_fragtree()
403 if (frag->split_by == 0) in ceph_fill_fragtree()
405 frag->split_by = split_by; in ceph_fill_fragtree()
406 dout(" frag %x split by %d\n", frag->frag, frag->split_by); in ceph_fill_fragtree()
407 prev_frag = frag; in ceph_fill_fragtree()
410 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
413 if (frag->split_by > 0 || in ceph_fill_fragtree()
414 !is_frag_child(frag->frag, prev_frag)) { in ceph_fill_fragtree()
415 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_fragtree()
416 if (frag->split_by > 0) in ceph_fill_fragtree()
418 kfree(frag); in ceph_fill_fragtree()
545 struct ceph_inode_frag *frag; in ceph_evict_inode() local
585 frag = rb_entry(n, struct ceph_inode_frag, node); in ceph_evict_inode()
587 kfree(frag); in ceph_evict_inode()
1601 u32 frag = le32_to_cpu(rhead->args.readdir.frag); in ceph_readdir_prepopulate() local
1623 le32_to_cpu(rinfo->dir_dir->frag) != frag) { in ceph_readdir_prepopulate()
1625 frag, le32_to_cpu(rinfo->dir_dir->frag)); in ceph_readdir_prepopulate()
1626 frag = le32_to_cpu(rinfo->dir_dir->frag); in ceph_readdir_prepopulate()
1640 if (ceph_frag_is_leftmost(frag) && in ceph_readdir_prepopulate()
1677 rde->offset = ceph_make_fpos(frag, fpos_offset++, false); in ceph_readdir_prepopulate()