Lines Matching refs:dquot
195 struct dquot *dquot, int *err) in find_free_dqentry() argument
244 dquot->dq_dqb.u.v2_mdqb.dqb_off = in find_free_dqentry()
252 static int do_insert_tree(struct quota_handle *h, struct dquot *dquot, in do_insert_tree() argument
278 newblk = le32_to_cpu(ref[get_index(dquot->dq_id, depth)]); in do_insert_tree()
285 ref[get_index(dquot->dq_id, depth)]); in do_insert_tree()
286 newblk = find_free_dqentry(h, dquot, &ret); in do_insert_tree()
288 ret = do_insert_tree(h, dquot, &newblk, depth + 1); in do_insert_tree()
292 ref[get_index(dquot->dq_id, depth)] = in do_insert_tree()
307 static int dq_insert_tree(struct quota_handle *h, struct dquot *dquot) in dq_insert_tree() argument
312 err = do_insert_tree(h, dquot, &tmp, 0); in dq_insert_tree()
315 (unsigned int) dquot->dq_id, strerror(errno)); in dq_insert_tree()
320 int qtree_write_dquot(struct dquot *dquot) in qtree_write_dquot() argument
325 struct quota_handle *h = dquot->dq_h; in qtree_write_dquot()
327 &dquot->dq_h->qh_info.u.v2_mdqi.dqi_qtree; in qtree_write_dquot()
330 dquot->dq_dqb.u.v2_mdqb.dqb_off, in qtree_write_dquot()
335 (unsigned int)dquot->dq_id, strerror(errno)); in qtree_write_dquot()
340 if (!dquot->dq_dqb.u.v2_mdqb.dqb_off) { in qtree_write_dquot()
341 if (dq_insert_tree(dquot->dq_h, dquot)) { in qtree_write_dquot()
346 info->dqi_ops->mem2disk_dqblk(ddquot, dquot); in qtree_write_dquot()
348 dquot->dq_dqb.u.v2_mdqb.dqb_off, in qtree_write_dquot()
350 ret = h->write(&h->qh_qf, dquot->dq_dqb.u.v2_mdqb.dqb_off, ddquot, in qtree_write_dquot()
355 (unsigned int)dquot->dq_id, strerror(errno)); in qtree_write_dquot()
364 static void free_dqentry(struct quota_handle *h, struct dquot *dquot, in free_dqentry() argument
374 if (dquot->dq_dqb.u.v2_mdqb.dqb_off >> QT_BLKSIZE_BITS != blk) in free_dqentry()
377 (unsigned int) (dquot->dq_dqb.u.v2_mdqb.dqb_off >> in free_dqentry()
389 memset(buf + (dquot->dq_dqb.u.v2_mdqb.dqb_off & in free_dqentry()
401 dquot->dq_dqb.u.v2_mdqb.dqb_off = 0; in free_dqentry()
406 static void remove_tree(struct quota_handle *h, struct dquot *dquot, in remove_tree() argument
417 newblk = le32_to_cpu(ref[get_index(dquot->dq_id, depth)]); in remove_tree()
419 free_dqentry(h, dquot, newblk); in remove_tree()
422 remove_tree(h, dquot, &newblk, depth + 1); in remove_tree()
428 ref[get_index(dquot->dq_id, depth)] = cpu_to_le32(0); in remove_tree()
445 void qtree_delete_dquot(struct dquot *dquot) in qtree_delete_dquot() argument
449 if (!dquot->dq_dqb.u.v2_mdqb.dqb_off) /* Even not allocated? */ in qtree_delete_dquot()
451 remove_tree(dquot->dq_h, dquot, &tmp, 0); in qtree_delete_dquot()
456 struct dquot *dquot, unsigned int blk) in find_block_dqentry() argument
468 i < qtree_dqstr_in_blk(info) && !info->dqi_ops->is_id(ddquot, dquot); in find_block_dqentry()
474 dquot->dq_id); in find_block_dqentry()
482 struct dquot *dquot, in find_tree_dqentry() argument
494 blk = le32_to_cpu(ref[get_index(dquot->dq_id, depth)]); in find_tree_dqentry()
498 ret = find_tree_dqentry(h, dquot, blk, depth + 1); in find_tree_dqentry()
500 ret = find_block_dqentry(h, dquot, blk); in find_tree_dqentry()
508 struct dquot *dquot) in find_dqentry() argument
510 return find_tree_dqentry(h, dquot, QT_TREEOFF, 0); in find_dqentry()
516 struct dquot *qtree_read_dquot(struct quota_handle *h, qid_t id) in qtree_read_dquot()
522 struct dquot *dquot = get_empty_dquot(); in qtree_read_dquot() local
524 if (!dquot) in qtree_read_dquot()
527 quota_free_mem(&dquot); in qtree_read_dquot()
531 dquot->dq_id = id; in qtree_read_dquot()
532 dquot->dq_h = h; in qtree_read_dquot()
533 dquot->dq_dqb.u.v2_mdqb.dqb_off = 0; in qtree_read_dquot()
534 memset(&dquot->dq_dqb, 0, sizeof(struct util_dqblk)); in qtree_read_dquot()
536 offset = find_dqentry(h, dquot); in qtree_read_dquot()
538 dquot->dq_dqb.u.v2_mdqb.dqb_off = offset; in qtree_read_dquot()
545 dquot->dq_id, strerror(errno)); in qtree_read_dquot()
547 info->dqi_ops->disk2mem_dqblk(dquot, ddquot); in qtree_read_dquot()
550 return dquot; in qtree_read_dquot()
559 static int report_block(struct dquot *dquot, unsigned int blk, char *bitmap, in report_block() argument
560 int (*process_dquot) (struct dquot *, void *), in report_block()
564 &dquot->dq_h->qh_info.u.v2_mdqi.dqi_qtree; in report_block()
574 read_blk(dquot->dq_h, blk, buf); in report_block()
581 dquot->dq_dqb.u.v2_mdqb.dqb_off = in report_block()
585 info->dqi_ops->disk2mem_dqblk(dquot, ddata); in report_block()
586 if (process_dquot(dquot, data) < 0) in report_block()
608 static int report_tree(struct dquot *dquot, unsigned int blk, int depth, in report_tree() argument
610 int (*process_dquot) (struct dquot *, void *), in report_tree()
620 read_blk(dquot->dq_h, blk, buf); in report_tree()
626 if (check_reference(dquot->dq_h, blk)) in report_tree()
631 *entries += report_block(dquot, blk, bitmap, in report_tree()
634 if (report_tree(dquot, blk, depth + 1, bitmap, entries, in report_tree()
655 int (*process_dquot) (struct dquot *, void *), in qtree_scan_dquots()
660 struct dquot *dquot = get_empty_dquot(); in qtree_scan_dquots() local
665 if (!dquot) in qtree_scan_dquots()
668 dquot->dq_h = h; in qtree_scan_dquots()
671 if (report_tree(dquot, QT_TREEOFF, 0, bitmap, &entries, process_dquot, in qtree_scan_dquots()
682 if (dquot) in qtree_scan_dquots()
683 quota_free_mem(&dquot); in qtree_scan_dquots()