Lines Matching refs:frag

254 	struct ceph_inode_frag *frag;  in __get_or_create_frag()  local
260 frag = rb_entry(parent, struct ceph_inode_frag, node); in __get_or_create_frag()
261 c = ceph_frag_compare(f, frag->frag); in __get_or_create_frag()
267 return frag; in __get_or_create_frag()
270 frag = kmalloc(sizeof(*frag), GFP_NOFS); in __get_or_create_frag()
271 if (!frag) in __get_or_create_frag()
274 frag->frag = f; in __get_or_create_frag()
275 frag->split_by = 0; in __get_or_create_frag()
276 frag->mds = -1; in __get_or_create_frag()
277 frag->ndist = 0; in __get_or_create_frag()
279 rb_link_node(&frag->node, parent, p); in __get_or_create_frag()
280 rb_insert_color(&frag->node, &ci->i_fragtree); in __get_or_create_frag()
284 return frag; in __get_or_create_frag()
295 struct ceph_inode_frag *frag = in __ceph_find_frag() local
297 int c = ceph_frag_compare(f, frag->frag); in __ceph_find_frag()
303 return frag; in __ceph_find_frag()
317 struct ceph_inode_frag *frag; in __ceph_choose_frag() local
326 frag = __ceph_find_frag(ci, t); in __ceph_choose_frag()
327 if (!frag) in __ceph_choose_frag()
329 if (frag->split_by == 0) { in __ceph_choose_frag()
331 memcpy(pfrag, frag, sizeof(*pfrag)); in __ceph_choose_frag()
338 nway = 1 << frag->split_by; in __ceph_choose_frag()
340 frag->split_by, nway); in __ceph_choose_frag()
342 n = ceph_frag_make_child(t, frag->split_by, i); in __ceph_choose_frag()
374 struct ceph_inode_frag *frag; in ceph_fill_dirfrag() local
375 u32 id = le32_to_cpu(dirinfo->frag); in ceph_fill_dirfrag()
393 frag = __ceph_find_frag(ci, id); in ceph_fill_dirfrag()
394 if (!frag) in ceph_fill_dirfrag()
396 if (frag->split_by == 0) { in ceph_fill_dirfrag()
400 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_dirfrag()
401 kfree(frag); in ceph_fill_dirfrag()
406 frag->mds = -1; in ceph_fill_dirfrag()
407 frag->ndist = 0; in ceph_fill_dirfrag()
414 frag = __get_or_create_frag(ci, id); in ceph_fill_dirfrag()
415 if (IS_ERR(frag)) { in ceph_fill_dirfrag()
419 ceph_vinop(inode), le32_to_cpu(dirinfo->frag)); in ceph_fill_dirfrag()
424 frag->mds = mds; in ceph_fill_dirfrag()
425 frag->ndist = min_t(u32, ndist, CEPH_MAX_DIRFRAG_REP); in ceph_fill_dirfrag()
426 for (i = 0; i < frag->ndist; i++) in ceph_fill_dirfrag()
427 frag->dist[i] = le32_to_cpu(dirinfo->dist[i]); in ceph_fill_dirfrag()
429 ceph_vinop(inode), frag->frag, frag->ndist); in ceph_fill_dirfrag()
440 return ceph_frag_compare(le32_to_cpu(ls->frag), in frag_tree_split_cmp()
441 le32_to_cpu(rs->frag)); in frag_tree_split_cmp()
444 static bool is_frag_child(u32 f, struct ceph_inode_frag *frag) in is_frag_child() argument
446 if (!frag) in is_frag_child()
448 if (ceph_frag_bits(f) != ceph_frag_bits(frag->frag) + frag->split_by) in is_frag_child()
450 return ceph_frag_contains_value(frag->frag, ceph_frag_value(f)); in is_frag_child()
458 struct ceph_inode_frag *frag, *prev_frag = NULL; in ceph_fill_fragtree() local
470 id = le32_to_cpu(fragtree->splits[i].frag); in ceph_fill_fragtree()
475 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
476 if (frag->frag != ceph_frag_make(0, 0) || rb_next(rb_node)) in ceph_fill_fragtree()
480 id = le32_to_cpu(dirinfo->frag); in ceph_fill_fragtree()
495 id = le32_to_cpu(fragtree->splits[i].frag); in ceph_fill_fragtree()
503 frag = NULL; in ceph_fill_fragtree()
505 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
506 if (ceph_frag_compare(frag->frag, id) >= 0) { in ceph_fill_fragtree()
507 if (frag->frag != id) in ceph_fill_fragtree()
508 frag = NULL; in ceph_fill_fragtree()
515 if (frag->split_by > 0 || in ceph_fill_fragtree()
516 !is_frag_child(frag->frag, prev_frag)) { in ceph_fill_fragtree()
517 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_fragtree()
518 if (frag->split_by > 0) in ceph_fill_fragtree()
520 kfree(frag); in ceph_fill_fragtree()
522 frag = NULL; in ceph_fill_fragtree()
524 if (!frag) { in ceph_fill_fragtree()
525 frag = __get_or_create_frag(ci, id); in ceph_fill_fragtree()
526 if (IS_ERR(frag)) in ceph_fill_fragtree()
529 if (frag->split_by == 0) in ceph_fill_fragtree()
531 frag->split_by = split_by; in ceph_fill_fragtree()
532 dout(" frag %x split by %d\n", frag->frag, frag->split_by); in ceph_fill_fragtree()
533 prev_frag = frag; in ceph_fill_fragtree()
536 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
539 if (frag->split_by > 0 || in ceph_fill_fragtree()
540 !is_frag_child(frag->frag, prev_frag)) { in ceph_fill_fragtree()
541 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_fragtree()
542 if (frag->split_by > 0) in ceph_fill_fragtree()
544 kfree(frag); in ceph_fill_fragtree()
678 struct ceph_inode_frag *frag; in ceph_evict_inode() local
714 frag = rb_entry(n, struct ceph_inode_frag, node); in ceph_evict_inode()
716 kfree(frag); in ceph_evict_inode()
1874 u32 frag = le32_to_cpu(req->r_args.readdir.frag); in ceph_readdir_prepopulate() local
1896 le32_to_cpu(rinfo->dir_dir->frag) != frag) { in ceph_readdir_prepopulate()
1898 frag, le32_to_cpu(rinfo->dir_dir->frag)); in ceph_readdir_prepopulate()
1899 frag = le32_to_cpu(rinfo->dir_dir->frag); in ceph_readdir_prepopulate()
1913 if (ceph_frag_is_leftmost(frag) && in ceph_readdir_prepopulate()
1948 rde->offset = ceph_make_fpos(frag, fpos_offset++, false); in ceph_readdir_prepopulate()