Home | History | Annotate | Download | only in support

Lines Matching refs:dquot

34 /* Is given dquot empty? */
193 /* Find space for dquot */
195 struct dquot *dquot, int *err)
244 dquot->dq_dqb.u.v2_mdqb.dqb_off =
252 static int do_insert_tree(struct quota_handle *h, struct dquot *dquot,
278 newblk = ext2fs_le32_to_cpu(ref[get_index(dquot->dq_id, depth)]);
285 ref[get_index(dquot->dq_id, depth)]);
286 newblk = find_free_dqentry(h, dquot, &ret);
288 ret = do_insert_tree(h, dquot, &newblk, depth + 1);
292 ref[get_index(dquot->dq_id, depth)] =
305 static void dq_insert_tree(struct quota_handle *h, struct dquot *dquot)
309 if (do_insert_tree(h, dquot, &tmp, 0) < 0)
311 (unsigned int) dquot->dq_id, strerror(errno));
314 /* Write dquot to file */
315 void qtree_write_dquot(struct dquot *dquot)
320 struct quota_handle *h = dquot->dq_h;
322 &dquot->dq_h->qh_info.u.v2_mdqi.dqi_qtree;
324 dquot->dq_dqb.u.v2_mdqb.dqb_off,
330 (unsigned int)dquot->dq_id, strerror(errno));
335 if (!dquot->dq_dqb.u.v2_mdqb.dqb_off)
336 dq_insert_tree(dquot->dq_h, dquot);
337 info->dqi_ops->mem2disk_dqblk(ddquot, dquot);
339 dquot->dq_dqb.u.v2_mdqb.dqb_off,
341 ret = h->e2fs_write(&h->qh_qf, dquot->dq_dqb.u.v2_mdqb.dqb_off, ddquot,
348 (unsigned int)dquot->dq_id, strerror(errno));
353 /* Free dquot entry in data block */
354 static void free_dqentry(struct quota_handle *h, struct dquot *dquot,
364 if (dquot->dq_dqb.u.v2_mdqb.dqb_off >> QT_BLKSIZE_BITS != blk)
367 (unsigned int) (dquot->dq_dqb.u.v2_mdqb.dqb_off >>
379 memset(buf + (dquot->dq_dqb.u.v2_mdqb.dqb_off &
391 dquot->dq_dqb.u.v2_mdqb.dqb_off = 0;
395 /* Remove reference to dquot from tree */
396 static void remove_tree(struct quota_handle *h, struct dquot *dquot,
407 newblk = ext2fs_le32_to_cpu(ref[get_index(dquot->dq_id, depth)]);
409 free_dqentry(h, dquot, newblk);
412 remove_tree(h, dquot, &newblk, depth + 1);
418 ref[get_index(dquot->dq_id, depth)] = ext2fs_cpu_to_le32(0);
434 /* Delete dquot from tree */
435 void qtree_delete_dquot(struct dquot *dquot)
439 if (!dquot->dq_dqb.u.v2_mdqb.dqb_off) /* Even not allocated? */
441 remove_tree(dquot->dq_h, dquot, &tmp, 0);
446 struct dquot *dquot, unsigned int blk)
458 i < qtree_dqstr_in_blk(info) && !info->dqi_ops->is_id(ddquot, dquot);
464 dquot->dq_id);
472 struct dquot *dquot,
484 blk = ext2fs_le32_to_cpu(ref[get_index(dquot->dq_id, depth)]);
488 ret = find_tree_dqentry(h, dquot, blk, depth + 1);
490 ret = find_block_dqentry(h, dquot, blk);
498 struct dquot *dquot)
500 return find_tree_dqentry(h, dquot, QT_TREEOFF, 0);
504 * Read dquot from disk.
506 struct dquot *qtree_read_dquot(struct quota_handle *h, qid_t id)
512 struct dquot *dquot = get_empty_dquot();
514 if (!dquot)
517 ext2fs_free_mem(&dquot);
521 dquot->dq_id = id;
522 dquot->dq_h = h;
523 dquot->dq_dqb.u.v2_mdqb.dqb_off = 0;
524 memset(&dquot->dq_dqb, 0, sizeof(struct util_dqblk));
526 offset = find_dqentry(h, dquot);
528 dquot->dq_dqb.u.v2_mdqb.dqb_off = offset;
535 dquot->dq_id, strerror(errno));
537 info->dqi_ops->disk2mem_dqblk(dquot, ddquot);
540 return dquot;
549 static int report_block(struct dquot *dquot, unsigned int blk, char *bitmap,
550 int (*process_dquot) (struct dquot *, void *),
554 &dquot->dq_h->qh_info.u.v2_mdqi.dqi_qtree;
564 read_blk(dquot->dq_h, blk, buf);
571 dquot->dq_dqb.u.v2_mdqb.dqb_off =
575 info->dqi_ops->disk2mem_dqblk(dquot, ddata);
576 if (process_dquot(dquot, data) < 0)
594 static int report_tree(struct dquot *dquot, unsigned int blk, int depth,
596 int (*process_dquot) (struct dquot *, void *),
606 read_blk(dquot->dq_h, blk, buf);
610 check_reference(dquot->dq_h, blk);
612 entries += report_block(dquot, blk, bitmap,
619 check_reference(dquot->dq_h, blk);
620 entries += report_tree(dquot, blk, depth + 1,
642 int (*process_dquot) (struct dquot *, void *),
648 struct dquot *dquot = get_empty_dquot();
650 if (!dquot)
653 dquot->dq_h = h;
655 ext2fs_free_mem(&dquot);
658 v2info->dqi_used_entries = report_tree(dquot, QT_TREEOFF, 0, bitmap,
662 ext2fs_free_mem(&dquot);