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 = ext2fs_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()
305 static void dq_insert_tree(struct quota_handle *h, struct dquot *dquot) in dq_insert_tree() argument
309 if (do_insert_tree(h, dquot, &tmp, 0) < 0) in dq_insert_tree()
311 (unsigned int) dquot->dq_id, strerror(errno)); in dq_insert_tree()
315 void qtree_write_dquot(struct dquot *dquot) in qtree_write_dquot() argument
320 struct quota_handle *h = dquot->dq_h; in qtree_write_dquot()
322 &dquot->dq_h->qh_info.u.v2_mdqi.dqi_qtree; in qtree_write_dquot()
324 dquot->dq_dqb.u.v2_mdqb.dqb_off, in qtree_write_dquot()
330 (unsigned int)dquot->dq_id, strerror(errno)); in qtree_write_dquot()
335 if (!dquot->dq_dqb.u.v2_mdqb.dqb_off) in qtree_write_dquot()
336 dq_insert_tree(dquot->dq_h, dquot); in qtree_write_dquot()
337 info->dqi_ops->mem2disk_dqblk(ddquot, dquot); in qtree_write_dquot()
339 dquot->dq_dqb.u.v2_mdqb.dqb_off, in qtree_write_dquot()
341 ret = h->e2fs_write(&h->qh_qf, dquot->dq_dqb.u.v2_mdqb.dqb_off, ddquot, in qtree_write_dquot()
348 (unsigned int)dquot->dq_id, strerror(errno)); in qtree_write_dquot()
354 static void free_dqentry(struct quota_handle *h, struct dquot *dquot, in free_dqentry() argument
364 if (dquot->dq_dqb.u.v2_mdqb.dqb_off >> QT_BLKSIZE_BITS != blk) in free_dqentry()
367 (unsigned int) (dquot->dq_dqb.u.v2_mdqb.dqb_off >> in free_dqentry()
379 memset(buf + (dquot->dq_dqb.u.v2_mdqb.dqb_off & in free_dqentry()
391 dquot->dq_dqb.u.v2_mdqb.dqb_off = 0; in free_dqentry()
396 static void remove_tree(struct quota_handle *h, struct dquot *dquot, in remove_tree() argument
407 newblk = ext2fs_le32_to_cpu(ref[get_index(dquot->dq_id, depth)]); in remove_tree()
409 free_dqentry(h, dquot, newblk); in remove_tree()
412 remove_tree(h, dquot, &newblk, depth + 1); in remove_tree()
418 ref[get_index(dquot->dq_id, depth)] = ext2fs_cpu_to_le32(0); in remove_tree()
435 void qtree_delete_dquot(struct dquot *dquot) in qtree_delete_dquot() argument
439 if (!dquot->dq_dqb.u.v2_mdqb.dqb_off) /* Even not allocated? */ in qtree_delete_dquot()
441 remove_tree(dquot->dq_h, dquot, &tmp, 0); in qtree_delete_dquot()
446 struct dquot *dquot, unsigned int blk) in find_block_dqentry() argument
458 i < qtree_dqstr_in_blk(info) && !info->dqi_ops->is_id(ddquot, dquot); in find_block_dqentry()
464 dquot->dq_id); in find_block_dqentry()
472 struct dquot *dquot, in find_tree_dqentry() argument
484 blk = ext2fs_le32_to_cpu(ref[get_index(dquot->dq_id, depth)]); in find_tree_dqentry()
488 ret = find_tree_dqentry(h, dquot, blk, depth + 1); in find_tree_dqentry()
490 ret = find_block_dqentry(h, dquot, blk); in find_tree_dqentry()
498 struct dquot *dquot) in find_dqentry() argument
500 return find_tree_dqentry(h, dquot, QT_TREEOFF, 0); in find_dqentry()
506 struct dquot *qtree_read_dquot(struct quota_handle *h, qid_t id) in qtree_read_dquot()
512 struct dquot *dquot = get_empty_dquot(); in qtree_read_dquot() local
514 if (!dquot) in qtree_read_dquot()
517 ext2fs_free_mem(&dquot); in qtree_read_dquot()
521 dquot->dq_id = id; in qtree_read_dquot()
522 dquot->dq_h = h; in qtree_read_dquot()
523 dquot->dq_dqb.u.v2_mdqb.dqb_off = 0; in qtree_read_dquot()
524 memset(&dquot->dq_dqb, 0, sizeof(struct util_dqblk)); in qtree_read_dquot()
526 offset = find_dqentry(h, dquot); in qtree_read_dquot()
528 dquot->dq_dqb.u.v2_mdqb.dqb_off = offset; in qtree_read_dquot()
535 dquot->dq_id, strerror(errno)); in qtree_read_dquot()
537 info->dqi_ops->disk2mem_dqblk(dquot, ddquot); in qtree_read_dquot()
540 return dquot; in qtree_read_dquot()
549 static int report_block(struct dquot *dquot, unsigned int blk, char *bitmap, in report_block() argument
550 int (*process_dquot) (struct dquot *, void *), in report_block()
554 &dquot->dq_h->qh_info.u.v2_mdqi.dqi_qtree; in report_block()
564 read_blk(dquot->dq_h, blk, buf); in report_block()
571 dquot->dq_dqb.u.v2_mdqb.dqb_off = in report_block()
575 info->dqi_ops->disk2mem_dqblk(dquot, ddata); in report_block()
576 if (process_dquot(dquot, data) < 0) in report_block()
594 static int report_tree(struct dquot *dquot, unsigned int blk, int depth, in report_tree() argument
596 int (*process_dquot) (struct dquot *, void *), in report_tree()
606 read_blk(dquot->dq_h, blk, buf); in report_tree()
610 check_reference(dquot->dq_h, blk); in report_tree()
612 entries += report_block(dquot, blk, bitmap, in report_tree()
619 check_reference(dquot->dq_h, blk); in report_tree()
620 entries += report_tree(dquot, blk, depth + 1, in report_tree()
642 int (*process_dquot) (struct dquot *, void *), in qtree_scan_dquots()
648 struct dquot *dquot = get_empty_dquot(); in qtree_scan_dquots() local
650 if (!dquot) in qtree_scan_dquots()
653 dquot->dq_h = h; in qtree_scan_dquots()
655 ext2fs_free_mem(&dquot); in qtree_scan_dquots()
658 v2info->dqi_used_entries = report_tree(dquot, QT_TREEOFF, 0, bitmap, in qtree_scan_dquots()
662 ext2fs_free_mem(&dquot); in qtree_scan_dquots()