Lines Matching refs:frag
262 struct ceph_inode_frag *frag; in __get_or_create_frag() local
268 frag = rb_entry(parent, struct ceph_inode_frag, node); in __get_or_create_frag()
269 c = ceph_frag_compare(f, frag->frag); in __get_or_create_frag()
275 return frag; in __get_or_create_frag()
278 frag = kmalloc(sizeof(*frag), GFP_NOFS); in __get_or_create_frag()
279 if (!frag) in __get_or_create_frag()
282 frag->frag = f; in __get_or_create_frag()
283 frag->split_by = 0; in __get_or_create_frag()
284 frag->mds = -1; in __get_or_create_frag()
285 frag->ndist = 0; in __get_or_create_frag()
287 rb_link_node(&frag->node, parent, p); in __get_or_create_frag()
288 rb_insert_color(&frag->node, &ci->i_fragtree); in __get_or_create_frag()
291 return frag; in __get_or_create_frag()
302 struct ceph_inode_frag *frag = in __ceph_find_frag() local
304 int c = ceph_frag_compare(f, frag->frag); in __ceph_find_frag()
310 return frag; in __ceph_find_frag()
325 struct ceph_inode_frag *frag; in __ceph_choose_frag() local
334 frag = __ceph_find_frag(ci, t); in __ceph_choose_frag()
335 if (!frag) in __ceph_choose_frag()
337 if (frag->split_by == 0) { in __ceph_choose_frag()
339 memcpy(pfrag, frag, sizeof(*pfrag)); in __ceph_choose_frag()
346 nway = 1 << frag->split_by; in __ceph_choose_frag()
348 frag->split_by, nway); in __ceph_choose_frag()
350 n = ceph_frag_make_child(t, frag->split_by, i); in __ceph_choose_frag()
383 struct ceph_inode_frag *frag; in ceph_fill_dirfrag() local
384 u32 id = le32_to_cpu(dirinfo->frag); in ceph_fill_dirfrag()
402 frag = __ceph_find_frag(ci, id); in ceph_fill_dirfrag()
403 if (!frag) in ceph_fill_dirfrag()
405 if (frag->split_by == 0) { in ceph_fill_dirfrag()
409 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_dirfrag()
410 kfree(frag); in ceph_fill_dirfrag()
415 frag->mds = -1; in ceph_fill_dirfrag()
416 frag->ndist = 0; in ceph_fill_dirfrag()
423 frag = __get_or_create_frag(ci, id); in ceph_fill_dirfrag()
424 if (IS_ERR(frag)) { in ceph_fill_dirfrag()
429 le32_to_cpu(dirinfo->frag)); in ceph_fill_dirfrag()
434 frag->mds = mds; in ceph_fill_dirfrag()
435 frag->ndist = min_t(u32, ndist, CEPH_MAX_DIRFRAG_REP); in ceph_fill_dirfrag()
436 for (i = 0; i < frag->ndist; i++) in ceph_fill_dirfrag()
437 frag->dist[i] = le32_to_cpu(dirinfo->dist[i]); in ceph_fill_dirfrag()
439 ceph_vinop(inode), frag->frag, frag->ndist); in ceph_fill_dirfrag()
450 return ceph_frag_compare(le32_to_cpu(ls->frag), in frag_tree_split_cmp()
451 le32_to_cpu(rs->frag)); in frag_tree_split_cmp()
454 static bool is_frag_child(u32 f, struct ceph_inode_frag *frag) in is_frag_child() argument
456 if (!frag) in is_frag_child()
458 if (ceph_frag_bits(f) != ceph_frag_bits(frag->frag) + frag->split_by) in is_frag_child()
460 return ceph_frag_contains_value(frag->frag, ceph_frag_value(f)); in is_frag_child()
469 struct ceph_inode_frag *frag, *prev_frag = NULL; in ceph_fill_fragtree() local
481 id = le32_to_cpu(fragtree->splits[i].frag); in ceph_fill_fragtree()
486 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
487 if (frag->frag != ceph_frag_make(0, 0) || rb_next(rb_node)) in ceph_fill_fragtree()
491 id = le32_to_cpu(dirinfo->frag); in ceph_fill_fragtree()
506 id = le32_to_cpu(fragtree->splits[i].frag); in ceph_fill_fragtree()
514 frag = NULL; in ceph_fill_fragtree()
516 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
517 if (ceph_frag_compare(frag->frag, id) >= 0) { in ceph_fill_fragtree()
518 if (frag->frag != id) in ceph_fill_fragtree()
519 frag = NULL; in ceph_fill_fragtree()
526 if (frag->split_by > 0 || in ceph_fill_fragtree()
527 !is_frag_child(frag->frag, prev_frag)) { in ceph_fill_fragtree()
528 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_fragtree()
529 if (frag->split_by > 0) in ceph_fill_fragtree()
531 kfree(frag); in ceph_fill_fragtree()
533 frag = NULL; in ceph_fill_fragtree()
535 if (!frag) { in ceph_fill_fragtree()
536 frag = __get_or_create_frag(ci, id); in ceph_fill_fragtree()
537 if (IS_ERR(frag)) in ceph_fill_fragtree()
540 if (frag->split_by == 0) in ceph_fill_fragtree()
542 frag->split_by = split_by; in ceph_fill_fragtree()
543 doutc(cl, " frag %x split by %d\n", frag->frag, frag->split_by); in ceph_fill_fragtree()
544 prev_frag = frag; in ceph_fill_fragtree()
547 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
550 if (frag->split_by > 0 || in ceph_fill_fragtree()
551 !is_frag_child(frag->frag, prev_frag)) { in ceph_fill_fragtree()
552 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_fragtree()
553 if (frag->split_by > 0) in ceph_fill_fragtree()
555 kfree(frag); in ceph_fill_fragtree()
691 struct ceph_inode_frag *frag; in ceph_evict_inode() local
728 frag = rb_entry(n, struct ceph_inode_frag, node); in ceph_evict_inode()
730 kfree(frag); in ceph_evict_inode()
1907 u32 frag = le32_to_cpu(req->r_args.readdir.frag); in ceph_readdir_prepopulate() local
1929 le32_to_cpu(rinfo->dir_dir->frag) != frag) { in ceph_readdir_prepopulate()
1930 doutc(cl, "got new frag %x -> %x\n", frag, in ceph_readdir_prepopulate()
1931 le32_to_cpu(rinfo->dir_dir->frag)); in ceph_readdir_prepopulate()
1932 frag = le32_to_cpu(rinfo->dir_dir->frag); in ceph_readdir_prepopulate()
1945 if (ceph_frag_is_leftmost(frag) && in ceph_readdir_prepopulate()
1980 rde->offset = ceph_make_fpos(frag, fpos_offset++, false); in ceph_readdir_prepopulate()