Home | History | Annotate | Download | only in fsck

Lines Matching defs:dquot

35 /* 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 = 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;
326 dquot->dq_dqb.u.v2_mdqb.dqb_off,
332 (unsigned int)dquot->dq_id, strerror(errno));
337 if (!dquot->dq_dqb.u.v2_mdqb.dqb_off) {
338 dq_insert_tree(dquot->dq_h, dquot);
340 info->dqi_ops->mem2disk_dqblk(ddquot, dquot);
342 dquot->dq_dqb.u.v2_mdqb.dqb_off,
344 ret = h->write(&h->qh_qf, dquot->dq_dqb.u.v2_mdqb.dqb_off, ddquot,
351 (unsigned int)dquot->dq_id, strerror(errno));
356 /* Free dquot entry in data block */
357 static void free_dqentry(struct quota_handle *h, struct dquot *dquot,
367 if (dquot->dq_dqb.u.v2_mdqb.dqb_off >> QT_BLKSIZE_BITS != blk)
370 (unsigned int) (dquot->dq_dqb.u.v2_mdqb.dqb_off >>
382 memset(buf + (dquot->dq_dqb.u.v2_mdqb.dqb_off &
394 dquot->dq_dqb.u.v2_mdqb.dqb_off = 0;
398 /* Remove reference to dquot from tree */
399 static void remove_tree(struct quota_handle *h, struct dquot *dquot,
410 newblk = le32_to_cpu(ref[get_index(dquot->dq_id, depth)]);
412 free_dqentry(h, dquot, newblk);
415 remove_tree(h, dquot, &newblk, depth + 1);
421 ref[get_index(dquot->dq_id, depth)] = cpu_to_le32(0);
437 /* Delete dquot from tree */
438 void qtree_delete_dquot(struct dquot *dquot)
442 if (!dquot->dq_dqb.u.v2_mdqb.dqb_off) /* Even not allocated? */
444 remove_tree(dquot->dq_h, dquot, &tmp, 0);
449 struct dquot *dquot, unsigned int blk)
461 i < qtree_dqstr_in_blk(info) && !info->dqi_ops->is_id(ddquot, dquot);
467 dquot->dq_id);
475 struct dquot *dquot,
487 blk = le32_to_cpu(ref[get_index(dquot->dq_id, depth)]);
491 ret = find_tree_dqentry(h, dquot, blk, depth + 1);
493 ret = find_block_dqentry(h, dquot, blk);
501 struct dquot *dquot)
503 return find_tree_dqentry(h, dquot, QT_TREEOFF, 0);
507 * Read dquot from disk.
509 struct dquot *qtree_read_dquot(struct quota_handle *h, qid_t id)
515 struct dquot *dquot = get_empty_dquot();
517 if (!dquot)
520 quota_free_mem(&dquot);
524 dquot->dq_id = id;
525 dquot->dq_h = h;
526 dquot->dq_dqb.u.v2_mdqb.dqb_off = 0;
527 memset(&dquot->dq_dqb, 0, sizeof(struct util_dqblk));
529 offset = find_dqentry(h, dquot);
531 dquot->dq_dqb.u.v2_mdqb.dqb_off = offset;
538 dquot->dq_id, strerror(errno));
540 info->dqi_ops->disk2mem_dqblk(dquot, ddquot);
543 return dquot;
552 static int report_block(struct dquot *dquot, unsigned int blk, char *bitmap,
553 int (*process_dquot) (struct dquot *, void *),
557 &dquot->dq_h->qh_info.u.v2_mdqi.dqi_qtree;
567 read_blk(dquot->dq_h, blk, buf);
574 dquot->dq_dqb.u.v2_mdqb.dqb_off =
578 info->dqi_ops->disk2mem_dqblk(dquot, ddata);
579 if (process_dquot(dquot, data) < 0)
601 static int report_tree(struct dquot *dquot, unsigned int blk, int depth,
603 int (*process_dquot) (struct dquot *, void *),
613 read_blk(dquot->dq_h, blk, buf);
619 if (check_reference(dquot->dq_h, blk))
624 *entries += report_block(dquot, blk, bitmap,
627 if (report_tree(dquot, blk, depth + 1, bitmap, entries,
648 int (*process_dquot) (struct dquot *, void *),
653 struct dquot *dquot = get_empty_dquot();
658 if (!dquot)
661 dquot->dq_h = h;
664 if (report_tree(dquot, QT_TREEOFF, 0, bitmap, &entries, process_dquot,
675 if (dquot)
676 quota_free_mem(&dquot);