Lines Matching refs:frag

120 	struct ceph_inode_frag *frag;  in __get_or_create_frag()  local
126 frag = rb_entry(parent, struct ceph_inode_frag, node); in __get_or_create_frag()
127 c = ceph_frag_compare(f, frag->frag); in __get_or_create_frag()
133 return frag; in __get_or_create_frag()
136 frag = kmalloc(sizeof(*frag), GFP_NOFS); in __get_or_create_frag()
137 if (!frag) in __get_or_create_frag()
140 frag->frag = f; in __get_or_create_frag()
141 frag->split_by = 0; in __get_or_create_frag()
142 frag->mds = -1; in __get_or_create_frag()
143 frag->ndist = 0; in __get_or_create_frag()
145 rb_link_node(&frag->node, parent, p); in __get_or_create_frag()
146 rb_insert_color(&frag->node, &ci->i_fragtree); in __get_or_create_frag()
150 return frag; in __get_or_create_frag()
161 struct ceph_inode_frag *frag = in __ceph_find_frag() local
163 int c = ceph_frag_compare(f, frag->frag); in __ceph_find_frag()
169 return frag; in __ceph_find_frag()
183 struct ceph_inode_frag *frag; in __ceph_choose_frag() local
192 frag = __ceph_find_frag(ci, t); in __ceph_choose_frag()
193 if (!frag) in __ceph_choose_frag()
195 if (frag->split_by == 0) { in __ceph_choose_frag()
197 memcpy(pfrag, frag, sizeof(*pfrag)); in __ceph_choose_frag()
204 nway = 1 << frag->split_by; in __ceph_choose_frag()
206 frag->split_by, nway); in __ceph_choose_frag()
208 n = ceph_frag_make_child(t, frag->split_by, i); in __ceph_choose_frag()
240 struct ceph_inode_frag *frag; in ceph_fill_dirfrag() local
241 u32 id = le32_to_cpu(dirinfo->frag); in ceph_fill_dirfrag()
259 frag = __ceph_find_frag(ci, id); in ceph_fill_dirfrag()
260 if (!frag) in ceph_fill_dirfrag()
262 if (frag->split_by == 0) { in ceph_fill_dirfrag()
266 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_dirfrag()
267 kfree(frag); in ceph_fill_dirfrag()
272 frag->mds = -1; in ceph_fill_dirfrag()
273 frag->ndist = 0; in ceph_fill_dirfrag()
280 frag = __get_or_create_frag(ci, id); in ceph_fill_dirfrag()
281 if (IS_ERR(frag)) { in ceph_fill_dirfrag()
285 ceph_vinop(inode), le32_to_cpu(dirinfo->frag)); in ceph_fill_dirfrag()
290 frag->mds = mds; in ceph_fill_dirfrag()
291 frag->ndist = min_t(u32, ndist, CEPH_MAX_DIRFRAG_REP); in ceph_fill_dirfrag()
292 for (i = 0; i < frag->ndist; i++) in ceph_fill_dirfrag()
293 frag->dist[i] = le32_to_cpu(dirinfo->dist[i]); in ceph_fill_dirfrag()
295 ceph_vinop(inode), frag->frag, frag->ndist); in ceph_fill_dirfrag()
306 return ceph_frag_compare(le32_to_cpu(ls->frag), in frag_tree_split_cmp()
307 le32_to_cpu(rs->frag)); in frag_tree_split_cmp()
310 static bool is_frag_child(u32 f, struct ceph_inode_frag *frag) in is_frag_child() argument
312 if (!frag) in is_frag_child()
314 if (ceph_frag_bits(f) != ceph_frag_bits(frag->frag) + frag->split_by) in is_frag_child()
316 return ceph_frag_contains_value(frag->frag, ceph_frag_value(f)); in is_frag_child()
324 struct ceph_inode_frag *frag, *prev_frag = NULL; in ceph_fill_fragtree() local
336 id = le32_to_cpu(fragtree->splits[i].frag); in ceph_fill_fragtree()
341 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
342 if (frag->frag != ceph_frag_make(0, 0) || rb_next(rb_node)) in ceph_fill_fragtree()
346 id = le32_to_cpu(dirinfo->frag); in ceph_fill_fragtree()
361 id = le32_to_cpu(fragtree->splits[i].frag); in ceph_fill_fragtree()
369 frag = NULL; in ceph_fill_fragtree()
371 frag = rb_entry(rb_node, struct ceph_inode_frag, node); in ceph_fill_fragtree()
372 if (ceph_frag_compare(frag->frag, id) >= 0) { in ceph_fill_fragtree()
373 if (frag->frag != id) in ceph_fill_fragtree()
374 frag = NULL; in ceph_fill_fragtree()
381 if (frag->split_by > 0 || in ceph_fill_fragtree()
382 !is_frag_child(frag->frag, prev_frag)) { in ceph_fill_fragtree()
383 rb_erase(&frag->node, &ci->i_fragtree); in ceph_fill_fragtree()
384 if (frag->split_by > 0) in ceph_fill_fragtree()
386 kfree(frag); in ceph_fill_fragtree()
388 frag = NULL; in ceph_fill_fragtree()
390 if (!frag) { in ceph_fill_fragtree()
391 frag = __get_or_create_frag(ci, id); in ceph_fill_fragtree()
392 if (IS_ERR(frag)) in ceph_fill_fragtree()
395 if (frag->split_by == 0) in ceph_fill_fragtree()
397 frag->split_by = split_by; in ceph_fill_fragtree()
398 dout(" frag %x split by %d\n", frag->frag, frag->split_by); in ceph_fill_fragtree()
399 prev_frag = frag; in ceph_fill_fragtree()
402 frag = rb_entry(rb_node, struct ceph_inode_frag, node); 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()
534 struct ceph_inode_frag *frag; in ceph_evict_inode() local
574 frag = rb_entry(n, struct ceph_inode_frag, node); in ceph_evict_inode()
576 kfree(frag); in ceph_evict_inode()
1568 u32 frag = le32_to_cpu(rhead->args.readdir.frag); in ceph_readdir_prepopulate() local
1590 le32_to_cpu(rinfo->dir_dir->frag) != frag) { in ceph_readdir_prepopulate()
1592 frag, le32_to_cpu(rinfo->dir_dir->frag)); in ceph_readdir_prepopulate()
1593 frag = le32_to_cpu(rinfo->dir_dir->frag); in ceph_readdir_prepopulate()
1607 if (ceph_frag_is_leftmost(frag) && in ceph_readdir_prepopulate()
1644 rde->offset = ceph_make_fpos(frag, fpos_offset++, false); in ceph_readdir_prepopulate()