Lines Matching refs:blk
63 static void read_blk(struct quota_handle *h, unsigned int blk, dqbuf_t buf) in read_blk() argument
67 err = h->read(&h->qh_qf, blk << QT_BLKSIZE_BITS, buf, in read_blk()
70 log_err("Cannot read block %u: %s", blk, strerror(errno)); in read_blk()
76 static int write_blk(struct quota_handle *h, unsigned int blk, dqbuf_t buf) in write_blk() argument
80 err = h->write(&h->qh_qf, blk << QT_BLKSIZE_BITS, buf, in write_blk()
83 log_err("Cannot write block (%u): %s", blk, strerror(errno)); in write_blk()
95 int blk; in get_free_dqblk() local
101 blk = info->dqi_free_blk; in get_free_dqblk()
102 read_blk(h, blk, buf); in get_free_dqblk()
113 blk = info->dqi_blocks++; in get_free_dqblk()
117 return blk; in get_free_dqblk()
122 unsigned int blk) in put_free_dqblk() argument
130 info->dqi_free_blk = blk; in put_free_dqblk()
132 write_blk(h, blk, buf); in put_free_dqblk()
137 unsigned int blk) in remove_free_dqentry() argument
164 write_blk(h, blk, buf); /* No matter whether write succeeds in remove_free_dqentry()
170 unsigned int blk) in insert_free_dqentry() argument
181 write_blk(h, blk, buf); in insert_free_dqentry()
185 cpu_to_le32(blk); in insert_free_dqentry()
189 info->dqi_free_entry = blk; in insert_free_dqentry()
197 int blk, i; in find_free_dqentry() local
212 blk = info->dqi_free_entry; in find_free_dqentry()
213 read_blk(h, blk, buf); in find_free_dqentry()
215 blk = get_free_dqblk(h); in find_free_dqentry()
216 if (blk < 0) { in find_free_dqentry()
218 *err = blk; in find_free_dqentry()
222 info->dqi_free_entry = blk; in find_free_dqentry()
229 remove_free_dqentry(h, buf, blk); in find_free_dqentry()
243 write_blk(h, blk, buf); in find_free_dqentry()
245 (blk << QT_BLKSIZE_BITS) + sizeof(struct qt_disk_dqdbheader) + in find_free_dqentry()
248 return blk; in find_free_dqentry()
364 unsigned int blk) in free_dqentry() argument
373 if (dquot->dq_dqb.u.v2_mdqb.dqb_off >> QT_BLKSIZE_BITS != blk) in free_dqentry()
375 "than it should (%u).", blk, in free_dqentry()
379 read_blk(h, blk, buf); in free_dqentry()
385 remove_free_dqentry(h, buf, blk); in free_dqentry()
386 put_free_dqblk(h, buf, blk); in free_dqentry()
396 insert_free_dqentry(h, buf, blk); in free_dqentry()
398 write_blk(h, blk, buf); in free_dqentry()
406 unsigned int * blk, int depth) in remove_tree() argument
415 read_blk(h, *blk, buf); in remove_tree()
433 if (i == QT_BLKSIZE && *blk != QT_TREEOFF) { in remove_tree()
434 put_free_dqblk(h, buf, *blk); in remove_tree()
435 *blk = 0; in remove_tree()
437 write_blk(h, *blk, buf); in remove_tree()
455 struct dquot *dquot, unsigned int blk) in find_block_dqentry() argument
465 read_blk(h, blk, buf); in find_block_dqentry()
475 return (blk << QT_BLKSIZE_BITS) + sizeof(struct qt_disk_dqdbheader) + in find_block_dqentry()
482 unsigned int blk, int depth) in find_tree_dqentry() argument
491 read_blk(h, blk, buf); in find_tree_dqentry()
493 blk = le32_to_cpu(ref[get_index(dquot->dq_id, depth)]); in find_tree_dqentry()
494 if (!blk) /* No reference? */ in find_tree_dqentry()
497 ret = find_tree_dqentry(h, dquot, blk, depth + 1); in find_tree_dqentry()
499 ret = find_block_dqentry(h, dquot, blk); in find_tree_dqentry()
558 static int report_block(struct dquot *dquot, unsigned int blk, char *bitmap, in report_block() argument
572 set_bit(bitmap, blk); in report_block()
573 read_blk(dquot->dq_h, blk, buf); in report_block()
581 (blk << QT_BLKSIZE_BITS) + in report_block()
592 static int check_reference(struct quota_handle *h, unsigned int blk) in check_reference() argument
594 if (blk >= h->qh_info.u.v2_mdqi.dqi_qtree.dqi_blocks) { in check_reference()
598 blk, in check_reference()
607 static int report_tree(struct dquot *dquot, unsigned int blk, int depth, in report_tree() argument
619 read_blk(dquot->dq_h, blk, buf); in report_tree()
621 blk = le32_to_cpu(ref[i]); in report_tree()
622 if (blk == 0) in report_tree()
625 if (check_reference(dquot->dq_h, blk)) in report_tree()
629 if (!get_bit(bitmap, blk)) in report_tree()
630 *entries += report_block(dquot, blk, bitmap, in report_tree()
633 if (report_tree(dquot, blk, depth + 1, bitmap, entries, in report_tree()