Lines Matching refs:frag

132 	struct ceph_inode_frag *frag;  in __get_or_create_frag()  local
138 frag = rb_entry(parent, struct ceph_inode_frag, node); in __get_or_create_frag()
139 c = ceph_frag_compare(f, frag->frag); in __get_or_create_frag()
145 return frag; in __get_or_create_frag()
148 frag = kmalloc(sizeof(*frag), GFP_NOFS); in __get_or_create_frag()
149 if (!frag) in __get_or_create_frag()
152 frag->frag = f; in __get_or_create_frag()
153 frag->split_by = 0; in __get_or_create_frag()
154 frag->mds = -1; in __get_or_create_frag()
155 frag->ndist = 0; in __get_or_create_frag()
157 rb_link_node(&frag->node, parent, p); in __get_or_create_frag()
158 rb_insert_color(&frag->node, &ci->i_fragtree); in __get_or_create_frag()
162 return frag; in __get_or_create_frag()
173 struct ceph_inode_frag *frag = in __ceph_find_frag() local
175 int c = ceph_frag_compare(f, frag->frag); in __ceph_find_frag()
181 return frag; in __ceph_find_frag()
195 struct ceph_inode_frag *frag; in __ceph_choose_frag() local
204 frag = __ceph_find_frag(ci, t); in __ceph_choose_frag()
205 if (!frag) in __ceph_choose_frag()
207 if (frag->split_by == 0) { in __ceph_choose_frag()
209 memcpy(pfrag, frag, sizeof(*pfrag)); in __ceph_choose_frag()
216 nway = 1 << frag->split_by; in __ceph_choose_frag()
218 frag->split_by, nway); in __ceph_choose_frag()
220 n = ceph_frag_make_child(t, frag->split_by, i); in __ceph_choose_frag()
252 struct ceph_inode_frag *frag; in ceph_fill_dirfrag() local
253 u32 id = le32_to_cpu(dirinfo->frag); in ceph_fill_dirfrag()
271 frag = __ceph_find_frag(ci, id); in ceph_fill_dirfrag()
272 if (!frag) in ceph_fill_dirfrag()
274 if (frag->split_by == 0) { in ceph_fill_dirfrag()
278 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_dirfrag()
279 kfree(frag); in ceph_fill_dirfrag()
284 frag->mds = -1; in ceph_fill_dirfrag()
285 frag->ndist = 0; in ceph_fill_dirfrag()
292 frag = __get_or_create_frag(ci, id); in ceph_fill_dirfrag()
293 if (IS_ERR(frag)) { in ceph_fill_dirfrag()
297 ceph_vinop(inode), le32_to_cpu(dirinfo->frag)); in ceph_fill_dirfrag()
302 frag->mds = mds; in ceph_fill_dirfrag()
303 frag->ndist = min_t(u32, ndist, CEPH_MAX_DIRFRAG_REP); in ceph_fill_dirfrag()
304 for (i = 0; i < frag->ndist; i++) in ceph_fill_dirfrag()
305 frag->dist[i] = le32_to_cpu(dirinfo->dist[i]); in ceph_fill_dirfrag()
307 ceph_vinop(inode), frag->frag, frag->ndist); in ceph_fill_dirfrag()
318 return ceph_frag_compare(le32_to_cpu(ls->frag), in frag_tree_split_cmp()
319 le32_to_cpu(rs->frag)); in frag_tree_split_cmp()
322 static bool is_frag_child(u32 f, struct ceph_inode_frag *frag) in is_frag_child() argument
324 if (!frag) in is_frag_child()
326 if (ceph_frag_bits(f) != ceph_frag_bits(frag->frag) + frag->split_by) in is_frag_child()
328 return ceph_frag_contains_value(frag->frag, ceph_frag_value(f)); in is_frag_child()
336 struct ceph_inode_frag *frag, *prev_frag = NULL; in ceph_fill_fragtree() local
348 id = le32_to_cpu(fragtree->splits[i].frag); in ceph_fill_fragtree()
353 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
354 if (frag->frag != ceph_frag_make(0, 0) || rb_next(rb_node)) in ceph_fill_fragtree()
358 id = le32_to_cpu(dirinfo->frag); in ceph_fill_fragtree()
373 id = le32_to_cpu(fragtree->splits[i].frag); in ceph_fill_fragtree()
381 frag = NULL; in ceph_fill_fragtree()
383 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
384 if (ceph_frag_compare(frag->frag, id) >= 0) { in ceph_fill_fragtree()
385 if (frag->frag != id) in ceph_fill_fragtree()
386 frag = NULL; in ceph_fill_fragtree()
393 if (frag->split_by > 0 || in ceph_fill_fragtree()
394 !is_frag_child(frag->frag, prev_frag)) { in ceph_fill_fragtree()
395 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_fragtree()
396 if (frag->split_by > 0) in ceph_fill_fragtree()
398 kfree(frag); in ceph_fill_fragtree()
400 frag = NULL; in ceph_fill_fragtree()
402 if (!frag) { in ceph_fill_fragtree()
403 frag = __get_or_create_frag(ci, id); in ceph_fill_fragtree()
404 if (IS_ERR(frag)) in ceph_fill_fragtree()
407 if (frag->split_by == 0) in ceph_fill_fragtree()
409 frag->split_by = split_by; in ceph_fill_fragtree()
410 dout(" frag %x split by %d\n", frag->frag, frag->split_by); in ceph_fill_fragtree()
411 prev_frag = frag; in ceph_fill_fragtree()
414 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
417 if (frag->split_by > 0 || in ceph_fill_fragtree()
418 !is_frag_child(frag->frag, prev_frag)) { in ceph_fill_fragtree()
419 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_fragtree()
420 if (frag->split_by > 0) in ceph_fill_fragtree()
422 kfree(frag); in ceph_fill_fragtree()
547 struct ceph_inode_frag *frag; in ceph_evict_inode() local
587 frag = rb_entry(n, struct ceph_inode_frag, node); in ceph_evict_inode()
589 kfree(frag); in ceph_evict_inode()
1605 u32 frag = le32_to_cpu(rhead->args.readdir.frag); in ceph_readdir_prepopulate() local
1627 le32_to_cpu(rinfo->dir_dir->frag) != frag) { in ceph_readdir_prepopulate()
1629 frag, le32_to_cpu(rinfo->dir_dir->frag)); in ceph_readdir_prepopulate()
1630 frag = le32_to_cpu(rinfo->dir_dir->frag); in ceph_readdir_prepopulate()
1644 if (ceph_frag_is_leftmost(frag) && in ceph_readdir_prepopulate()
1681 rde->offset = ceph_make_fpos(frag, fpos_offset++, false); in ceph_readdir_prepopulate()