Lines Matching full:dquot
33 /* Is given dquot empty? */
189 /* Find space for dquot */
190 static uint find_free_dqentry(struct quota_handle *h, struct dquot *dquot,
240 dquot->dq_dqb.u.v2_mdqb.dqb_off =
248 static int do_insert_tree(struct quota_handle *h, struct dquot *dquot,
274 newblk = ext2fs_le32_to_cpu(ref[get_index(dquot->dq_id, depth)]);
281 ref[get_index(dquot->dq_id, depth)]);
282 newblk = find_free_dqentry(h, dquot, &ret);
284 ret = do_insert_tree(h, dquot, &newblk, depth + 1);
288 ref[get_index(dquot->dq_id, depth)] =
301 static void dq_insert_tree(struct quota_handle *h, struct dquot *dquot)
305 if (do_insert_tree(h, dquot, &tmp, 0) < 0)
307 (uint) dquot->dq_id, strerror(errno));
310 /* Write dquot to file */
311 void qtree_write_dquot(struct dquot *dquot)
315 struct quota_handle *h = dquot->dq_h;
317 &dquot->dq_h->qh_info.u.v2_mdqi.dqi_qtree;
319 dquot->dq_dqb.u.v2_mdqb.dqb_off,
325 (uint)dquot->dq_id, strerror(errno));
329 if (!dquot->dq_dqb.u.v2_mdqb.dqb_off)
330 dq_insert_tree(dquot->dq_h, dquot);
331 info->dqi_ops->mem2disk_dqblk(ddquot, dquot);
333 dquot->dq_dqb.u.v2_mdqb.dqb_off,
335 ret = h->e2fs_write(&h->qh_qf, dquot->dq_dqb.u.v2_mdqb.dqb_off, ddquot,
342 (uint)dquot->dq_id, strerror(errno));
347 /* Free dquot entry in data block */
348 static void free_dqentry(struct quota_handle *h, struct dquot *dquot, uint blk)
357 if (dquot->dq_dqb.u.v2_mdqb.dqb_off >> QT_BLKSIZE_BITS != blk)
360 (uint) (dquot->dq_dqb.u.v2_mdqb.dqb_off >>
372 memset(buf + (dquot->dq_dqb.u.v2_mdqb.dqb_off &
384 dquot->dq_dqb.u.v2_mdqb.dqb_off = 0;
388 /* Remove reference to dquot from tree */
389 static void remove_tree(struct quota_handle *h, struct dquot *dquot,
400 newblk = ext2fs_le32_to_cpu(ref[get_index(dquot->dq_id, depth)]);
402 free_dqentry(h, dquot, newblk);
405 remove_tree(h, dquot, &newblk, depth + 1);
411 ref[get_index(dquot->dq_id, depth)] = ext2fs_cpu_to_le32(0);
427 /* Delete dquot from tree */
428 void qtree_delete_dquot(struct dquot *dquot)
432 if (!dquot->dq_dqb.u.v2_mdqb.dqb_off) /* Even not allocated? */
434 remove_tree(dquot->dq_h, dquot, &tmp, 0);
439 struct dquot *dquot, uint blk)
451 i < qtree_dqstr_in_blk(info) && !info->dqi_ops->is_id(ddquot, dquot);
457 dquot->dq_id);
465 struct dquot *dquot,
477 blk = ext2fs_le32_to_cpu(ref[get_index(dquot->dq_id, depth)]);
481 ret = find_tree_dqentry(h, dquot, blk, depth + 1);
483 ret = find_block_dqentry(h, dquot, blk);
491 struct dquot *dquot)
493 return find_tree_dqentry(h, dquot, QT_TREEOFF, 0);
497 * Read dquot from disk.
499 struct dquot *qtree_read_dquot(struct quota_handle *h, qid_t id)
505 struct dquot *dquot = get_empty_dquot();
507 if (!dquot)
510 ext2fs_free_mem(&dquot);
514 dquot->dq_id = id;
515 dquot->dq_h = h;
516 dquot->dq_dqb.u.v2_mdqb.dqb_off = 0;
517 memset(&dquot->dq_dqb, 0, sizeof(struct util_dqblk));
519 offset = find_dqentry(h, dquot);
521 dquot->dq_dqb.u.v2_mdqb.dqb_off = offset;
528 dquot->dq_id, strerror(errno));
530 info->dqi_ops->disk2mem_dqblk(dquot, ddquot);
533 return dquot;
542 static int report_block(struct dquot *dquot, uint blk, char *bitmap,
543 int (*process_dquot) (struct dquot *, void *),
547 &dquot->dq_h->qh_info.u.v2_mdqi.dqi_qtree;
557 read_blk(dquot->dq_h, blk, buf);
564 dquot->dq_dqb.u.v2_mdqb.dqb_off =
568 info->dqi_ops->disk2mem_dqblk(dquot, ddata);
569 if (process_dquot(dquot, data) < 0)
587 static int report_tree(struct dquot *dquot, uint blk, int depth, char *bitmap,
588 int (*process_dquot) (struct dquot *, void *),
598 read_blk(dquot->dq_h, blk, buf);
602 check_reference(dquot->dq_h, blk);
604 entries += report_block(dquot, blk, bitmap,
611 check_reference(dquot->dq_h, blk);
612 entries += report_tree(dquot, blk, depth + 1,
633 int (*process_dquot) (struct dquot *, void *),
639 struct dquot *dquot = get_empty_dquot();
641 if (!dquot)
644 dquot->dq_h = h;
646 dquot);
649 v2info->dqi_used_entries = report_tree(dquot, QT_TREEOFF, 0, bitmap,
653 ext2fs_free_mem(&dquot);