Lines Matching refs:frag
144 struct ceph_inode_frag *frag; in __get_or_create_frag() local
150 frag = rb_entry(parent, struct ceph_inode_frag, node); in __get_or_create_frag()
151 c = ceph_frag_compare(f, frag->frag); in __get_or_create_frag()
157 return frag; in __get_or_create_frag()
160 frag = kmalloc(sizeof(*frag), GFP_NOFS); in __get_or_create_frag()
161 if (!frag) in __get_or_create_frag()
164 frag->frag = f; in __get_or_create_frag()
165 frag->split_by = 0; in __get_or_create_frag()
166 frag->mds = -1; in __get_or_create_frag()
167 frag->ndist = 0; in __get_or_create_frag()
169 rb_link_node(&frag->node, parent, p); in __get_or_create_frag()
170 rb_insert_color(&frag->node, &ci->i_fragtree); in __get_or_create_frag()
174 return frag; in __get_or_create_frag()
185 struct ceph_inode_frag *frag = in __ceph_find_frag() local
187 int c = ceph_frag_compare(f, frag->frag); in __ceph_find_frag()
193 return frag; in __ceph_find_frag()
207 struct ceph_inode_frag *frag; in __ceph_choose_frag() local
216 frag = __ceph_find_frag(ci, t); in __ceph_choose_frag()
217 if (!frag) in __ceph_choose_frag()
219 if (frag->split_by == 0) { in __ceph_choose_frag()
221 memcpy(pfrag, frag, sizeof(*pfrag)); in __ceph_choose_frag()
228 nway = 1 << frag->split_by; in __ceph_choose_frag()
230 frag->split_by, nway); in __ceph_choose_frag()
232 n = ceph_frag_make_child(t, frag->split_by, i); in __ceph_choose_frag()
264 struct ceph_inode_frag *frag; in ceph_fill_dirfrag() local
265 u32 id = le32_to_cpu(dirinfo->frag); in ceph_fill_dirfrag()
283 frag = __ceph_find_frag(ci, id); in ceph_fill_dirfrag()
284 if (!frag) in ceph_fill_dirfrag()
286 if (frag->split_by == 0) { in ceph_fill_dirfrag()
290 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_dirfrag()
291 kfree(frag); in ceph_fill_dirfrag()
296 frag->mds = -1; in ceph_fill_dirfrag()
297 frag->ndist = 0; in ceph_fill_dirfrag()
304 frag = __get_or_create_frag(ci, id); in ceph_fill_dirfrag()
305 if (IS_ERR(frag)) { in ceph_fill_dirfrag()
309 ceph_vinop(inode), le32_to_cpu(dirinfo->frag)); in ceph_fill_dirfrag()
314 frag->mds = mds; in ceph_fill_dirfrag()
315 frag->ndist = min_t(u32, ndist, CEPH_MAX_DIRFRAG_REP); in ceph_fill_dirfrag()
316 for (i = 0; i < frag->ndist; i++) in ceph_fill_dirfrag()
317 frag->dist[i] = le32_to_cpu(dirinfo->dist[i]); in ceph_fill_dirfrag()
319 ceph_vinop(inode), frag->frag, frag->ndist); in ceph_fill_dirfrag()
330 return ceph_frag_compare(le32_to_cpu(ls->frag), in frag_tree_split_cmp()
331 le32_to_cpu(rs->frag)); in frag_tree_split_cmp()
334 static bool is_frag_child(u32 f, struct ceph_inode_frag *frag) in is_frag_child() argument
336 if (!frag) in is_frag_child()
338 if (ceph_frag_bits(f) != ceph_frag_bits(frag->frag) + frag->split_by) in is_frag_child()
340 return ceph_frag_contains_value(frag->frag, ceph_frag_value(f)); in is_frag_child()
348 struct ceph_inode_frag *frag, *prev_frag = NULL; in ceph_fill_fragtree() local
360 id = le32_to_cpu(fragtree->splits[i].frag); in ceph_fill_fragtree()
365 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
366 if (frag->frag != ceph_frag_make(0, 0) || rb_next(rb_node)) in ceph_fill_fragtree()
370 id = le32_to_cpu(dirinfo->frag); in ceph_fill_fragtree()
385 id = le32_to_cpu(fragtree->splits[i].frag); in ceph_fill_fragtree()
393 frag = NULL; in ceph_fill_fragtree()
395 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
396 if (ceph_frag_compare(frag->frag, id) >= 0) { in ceph_fill_fragtree()
397 if (frag->frag != id) in ceph_fill_fragtree()
398 frag = NULL; in ceph_fill_fragtree()
405 if (frag->split_by > 0 || in ceph_fill_fragtree()
406 !is_frag_child(frag->frag, prev_frag)) { in ceph_fill_fragtree()
407 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_fragtree()
408 if (frag->split_by > 0) in ceph_fill_fragtree()
410 kfree(frag); in ceph_fill_fragtree()
412 frag = NULL; in ceph_fill_fragtree()
414 if (!frag) { in ceph_fill_fragtree()
415 frag = __get_or_create_frag(ci, id); in ceph_fill_fragtree()
416 if (IS_ERR(frag)) in ceph_fill_fragtree()
419 if (frag->split_by == 0) in ceph_fill_fragtree()
421 frag->split_by = split_by; in ceph_fill_fragtree()
422 dout(" frag %x split by %d\n", frag->frag, frag->split_by); in ceph_fill_fragtree()
423 prev_frag = frag; in ceph_fill_fragtree()
426 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
429 if (frag->split_by > 0 || in ceph_fill_fragtree()
430 !is_frag_child(frag->frag, prev_frag)) { in ceph_fill_fragtree()
431 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_fragtree()
432 if (frag->split_by > 0) in ceph_fill_fragtree()
434 kfree(frag); in ceph_fill_fragtree()
559 struct ceph_inode_frag *frag; in ceph_evict_inode() local
592 frag = rb_entry(n, struct ceph_inode_frag, node); in ceph_evict_inode()
594 kfree(frag); in ceph_evict_inode()
1624 u32 frag = le32_to_cpu(req->r_args.readdir.frag); in ceph_readdir_prepopulate() local
1646 le32_to_cpu(rinfo->dir_dir->frag) != frag) { in ceph_readdir_prepopulate()
1648 frag, le32_to_cpu(rinfo->dir_dir->frag)); in ceph_readdir_prepopulate()
1649 frag = le32_to_cpu(rinfo->dir_dir->frag); in ceph_readdir_prepopulate()
1663 if (ceph_frag_is_leftmost(frag) && in ceph_readdir_prepopulate()
1700 rde->offset = ceph_make_fpos(frag, fpos_offset++, false); in ceph_readdir_prepopulate()