Lines Matching refs:dquot
218 struct dquot *dquot, int *err) in find_free_dqentry() argument
247 mark_info_dirty(dquot->dq_sb, dquot->dq_type); in find_free_dqentry()
253 quota_error(dquot->dq_sb, "Can't remove block (%u) " in find_free_dqentry()
268 quota_error(dquot->dq_sb, "Data block full but it shouldn't"); in find_free_dqentry()
275 quota_error(dquot->dq_sb, "Can't write quota data block %u", in find_free_dqentry()
279 dquot->dq_off = (blk << info->dqi_blocksize_bits) + in find_free_dqentry()
290 static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, in do_insert_tree() argument
310 quota_error(dquot->dq_sb, "Can't read tree quota " in do_insert_tree()
316 newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]); in do_insert_tree()
322 quota_error(dquot->dq_sb, "Inserting already present " in do_insert_tree()
325 dquot->dq_id, depth)])); in do_insert_tree()
330 newblk = find_free_dqentry(info, dquot, &ret); in do_insert_tree()
332 ret = do_insert_tree(info, dquot, &newblk, depth+1); in do_insert_tree()
335 ref[get_index(info, dquot->dq_id, depth)] = in do_insert_tree()
348 struct dquot *dquot) in dq_insert_tree() argument
351 return do_insert_tree(info, dquot, &tmp, 0); in dq_insert_tree()
358 int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) in qtree_write_dquot() argument
360 int type = dquot->dq_type; in qtree_write_dquot()
361 struct super_block *sb = dquot->dq_sb; in qtree_write_dquot()
369 if (!dquot->dq_off) { in qtree_write_dquot()
370 ret = dq_insert_tree(info, dquot); in qtree_write_dquot()
379 info->dqi_ops->mem2disk_dqblk(ddquot, dquot); in qtree_write_dquot()
382 dquot->dq_off); in qtree_write_dquot()
398 static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot, in free_dqentry() argument
407 if (dquot->dq_off >> info->dqi_blocksize_bits != blk) { in free_dqentry()
408 quota_error(dquot->dq_sb, "Quota structure has offset to " in free_dqentry()
410 (uint)(dquot->dq_off >> info->dqi_blocksize_bits)); in free_dqentry()
415 quota_error(dquot->dq_sb, "Can't read quota data block %u", in free_dqentry()
426 quota_error(dquot->dq_sb, "Can't move quota data block " in free_dqentry()
432 (dquot->dq_off & ((1 << info->dqi_blocksize_bits) - 1)), in free_dqentry()
439 quota_error(dquot->dq_sb, "Can't insert quota " in free_dqentry()
446 quota_error(dquot->dq_sb, "Can't write quota " in free_dqentry()
452 dquot->dq_off = 0; /* Quota is now unattached */ in free_dqentry()
459 static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot, in remove_tree() argument
471 quota_error(dquot->dq_sb, "Can't read quota data block %u", in remove_tree()
475 newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]); in remove_tree()
477 ret = free_dqentry(info, dquot, newblk); in remove_tree()
480 ret = remove_tree(info, dquot, &newblk, depth+1); in remove_tree()
484 ref[get_index(info, dquot->dq_id, depth)] = cpu_to_le32(0); in remove_tree()
496 quota_error(dquot->dq_sb, in remove_tree()
507 int qtree_delete_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) in qtree_delete_dquot() argument
511 if (!dquot->dq_off) /* Even not allocated? */ in qtree_delete_dquot()
513 return remove_tree(info, dquot, &tmp, 0); in qtree_delete_dquot()
519 struct dquot *dquot, uint blk) in find_block_dqentry() argument
530 quota_error(dquot->dq_sb, "Can't read quota tree " in find_block_dqentry()
536 if (info->dqi_ops->is_id(ddquot, dquot)) in find_block_dqentry()
541 quota_error(dquot->dq_sb, "Quota for id %u referenced " in find_block_dqentry()
542 "but not present", dquot->dq_id); in find_block_dqentry()
556 struct dquot *dquot, uint blk, int depth) in find_tree_dqentry() argument
566 quota_error(dquot->dq_sb, "Can't read quota tree block %u", in find_tree_dqentry()
571 blk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]); in find_tree_dqentry()
575 ret = find_tree_dqentry(info, dquot, blk, depth+1); in find_tree_dqentry()
577 ret = find_block_dqentry(info, dquot, blk); in find_tree_dqentry()
585 struct dquot *dquot) in find_dqentry() argument
587 return find_tree_dqentry(info, dquot, QT_TREEOFF, 0); in find_dqentry()
590 int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) in qtree_read_dquot() argument
592 int type = dquot->dq_type; in qtree_read_dquot()
593 struct super_block *sb = dquot->dq_sb; in qtree_read_dquot()
600 if (!sb_dqopt(dquot->dq_sb)->files[type]) { in qtree_read_dquot()
606 if (!dquot->dq_off) { in qtree_read_dquot()
607 offset = find_dqentry(info, dquot); in qtree_read_dquot()
611 "for id %u", dquot->dq_id); in qtree_read_dquot()
612 dquot->dq_off = 0; in qtree_read_dquot()
613 set_bit(DQ_FAKE_B, &dquot->dq_flags); in qtree_read_dquot()
614 memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk)); in qtree_read_dquot()
618 dquot->dq_off = offset; in qtree_read_dquot()
624 dquot->dq_off); in qtree_read_dquot()
629 dquot->dq_id); in qtree_read_dquot()
630 set_bit(DQ_FAKE_B, &dquot->dq_flags); in qtree_read_dquot()
631 memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk)); in qtree_read_dquot()
636 info->dqi_ops->disk2mem_dqblk(dquot, ddquot); in qtree_read_dquot()
637 if (!dquot->dq_dqb.dqb_bhardlimit && in qtree_read_dquot()
638 !dquot->dq_dqb.dqb_bsoftlimit && in qtree_read_dquot()
639 !dquot->dq_dqb.dqb_ihardlimit && in qtree_read_dquot()
640 !dquot->dq_dqb.dqb_isoftlimit) in qtree_read_dquot()
641 set_bit(DQ_FAKE_B, &dquot->dq_flags); in qtree_read_dquot()
652 int qtree_release_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) in qtree_release_dquot() argument
654 if (test_bit(DQ_FAKE_B, &dquot->dq_flags) && in qtree_release_dquot()
655 !(dquot->dq_dqb.dqb_curinodes | dquot->dq_dqb.dqb_curspace)) in qtree_release_dquot()
656 return qtree_delete_dquot(info, dquot); in qtree_release_dquot()