Lines Matching defs:dquot

34 /* Is given dquot empty? */
192 /* Find space for dquot */
194 struct dquot *dquot, int *err)
243 dquot->dq_dqb.u.v2_mdqb.dqb_off =
251 static int do_insert_tree(struct quota_handle *h, struct dquot *dquot,
277 newblk = le32_to_cpu(ref[get_index(dquot->dq_id, depth)]);
284 ref[get_index(dquot->dq_id, depth)]);
285 newblk = find_free_dqentry(h, dquot, &ret);
287 ret = do_insert_tree(h, dquot, &newblk, depth + 1);
291 ref[get_index(dquot->dq_id, depth)] =
306 static int dq_insert_tree(struct quota_handle *h, struct dquot *dquot)
311 err = do_insert_tree(h, dquot, &tmp, 0);
314 (unsigned int) dquot->dq_id, strerror(errno));
318 /* Write dquot to file */
319 int qtree_write_dquot(struct dquot *dquot)
324 struct quota_handle *h = dquot->dq_h;
326 &dquot->dq_h->qh_info.u.v2_mdqi.dqi_qtree;
329 dquot->dq_dqb.u.v2_mdqb.dqb_off,
334 (unsigned int)dquot->dq_id, strerror(errno));
339 if (!dquot->dq_dqb.u.v2_mdqb.dqb_off) {
340 if (dq_insert_tree(dquot->dq_h, dquot)) {
345 info->dqi_ops->mem2disk_dqblk(ddquot, dquot);
347 dquot->dq_dqb.u.v2_mdqb.dqb_off,
349 ret = h->write(&h->qh_qf, dquot->dq_dqb.u.v2_mdqb.dqb_off, ddquot,
354 (unsigned int)dquot->dq_id, strerror(errno));
362 /* Free dquot entry in data block */
363 static void free_dqentry(struct quota_handle *h, struct dquot *dquot,
373 if (dquot->dq_dqb.u.v2_mdqb.dqb_off >> QT_BLKSIZE_BITS != blk)
376 (unsigned int) (dquot->dq_dqb.u.v2_mdqb.dqb_off >>
388 memset(buf + (dquot->dq_dqb.u.v2_mdqb.dqb_off &
400 dquot->dq_dqb.u.v2_mdqb.dqb_off = 0;
404 /* Remove reference to dquot from tree */
405 static void remove_tree(struct quota_handle *h, struct dquot *dquot,
416 newblk = le32_to_cpu(ref[get_index(dquot->dq_id, depth)]);
418 free_dqentry(h, dquot, newblk);
421 remove_tree(h, dquot, &newblk, depth + 1);
427 ref[get_index(dquot->dq_id, depth)] = cpu_to_le32(0);
443 /* Delete dquot from tree */
444 void qtree_delete_dquot(struct dquot *dquot)
448 if (!dquot->dq_dqb.u.v2_mdqb.dqb_off) /* Even not allocated? */
450 remove_tree(dquot->dq_h, dquot, &tmp, 0);
455 struct dquot *dquot, unsigned int blk)
467 i < qtree_dqstr_in_blk(info) && !info->dqi_ops->is_id(ddquot, dquot);
473 dquot->dq_id);
481 struct dquot *dquot,
493 blk = le32_to_cpu(ref[get_index(dquot->dq_id, depth)]);
497 ret = find_tree_dqentry(h, dquot, blk, depth + 1);
499 ret = find_block_dqentry(h, dquot, blk);
507 struct dquot *dquot)
509 return find_tree_dqentry(h, dquot, QT_TREEOFF, 0);
513 * Read dquot from disk.
515 struct dquot *qtree_read_dquot(struct quota_handle *h, qid_t id)
521 struct dquot *dquot = get_empty_dquot();
523 if (!dquot)
526 quota_free_mem(&dquot);
530 dquot->dq_id = id;
531 dquot->dq_h = h;
532 dquot->dq_dqb.u.v2_mdqb.dqb_off = 0;
533 memset(&dquot->dq_dqb, 0, sizeof(struct util_dqblk));
535 offset = find_dqentry(h, dquot);
537 dquot->dq_dqb.u.v2_mdqb.dqb_off = offset;
544 dquot->dq_id, strerror(errno));
546 info->dqi_ops->disk2mem_dqblk(dquot, ddquot);
549 return dquot;
558 static int report_block(struct dquot *dquot, unsigned int blk, char *bitmap,
559 int (*process_dquot) (struct dquot *, void *),
563 &dquot->dq_h->qh_info.u.v2_mdqi.dqi_qtree;
573 read_blk(dquot->dq_h, blk, buf);
580 dquot->dq_dqb.u.v2_mdqb.dqb_off =
584 info->dqi_ops->disk2mem_dqblk(dquot, ddata);
585 if (process_dquot(dquot, data) < 0)
605 static int report_tree(struct dquot *dquot, unsigned int blk, int depth,
607 int (*process_dquot) (struct dquot *, void *),
617 read_blk(dquot->dq_h, blk, buf);
623 if (check_reference(dquot->dq_h, blk))
628 int num_entry = report_block(dquot, blk, bitmap,
635 if (report_tree(dquot, blk, depth + 1, bitmap, entries,
656 int (*process_dquot) (struct dquot *, void *),
661 struct dquot *dquot = get_empty_dquot();
666 if (!dquot)
669 dquot->dq_h = h;
672 if (report_tree(dquot, QT_TREEOFF, 0, bitmap, &entries, process_dquot,
683 if (dquot)
684 quota_free_mem(&dquot);