Lines Matching refs:dquot
68 static void ocfs2_global_disk2memdqb(struct dquot *dquot, void *dp) in ocfs2_global_disk2memdqb() argument
71 struct mem_dqblk *m = &dquot->dq_dqb; in ocfs2_global_disk2memdqb()
74 if (!test_bit(DQ_LASTSET_B + QIF_ILIMITS_B, &dquot->dq_flags)) { in ocfs2_global_disk2memdqb()
78 if (!test_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags)) in ocfs2_global_disk2memdqb()
80 if (!test_bit(DQ_LASTSET_B + QIF_BLIMITS_B, &dquot->dq_flags)) { in ocfs2_global_disk2memdqb()
84 if (!test_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags)) in ocfs2_global_disk2memdqb()
86 if (!test_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags)) in ocfs2_global_disk2memdqb()
88 if (!test_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags)) in ocfs2_global_disk2memdqb()
90 OCFS2_DQUOT(dquot)->dq_use_count = le32_to_cpu(d->dqb_use_count); in ocfs2_global_disk2memdqb()
93 static void ocfs2_global_mem2diskdqb(void *dp, struct dquot *dquot) in ocfs2_global_mem2diskdqb() argument
96 struct mem_dqblk *m = &dquot->dq_dqb; in ocfs2_global_mem2diskdqb()
98 d->dqb_id = cpu_to_le32(dquot->dq_id); in ocfs2_global_mem2diskdqb()
99 d->dqb_use_count = cpu_to_le32(OCFS2_DQUOT(dquot)->dq_use_count); in ocfs2_global_mem2diskdqb()
111 static int ocfs2_global_is_id(void *dp, struct dquot *dquot) in ocfs2_global_is_id() argument
115 sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv; in ocfs2_global_is_id()
119 return le32_to_cpu(d->dqb_id) == dquot->dq_id; in ocfs2_global_is_id()
476 int __ocfs2_sync_dquot(struct dquot *dquot, int freeing) in __ocfs2_sync_dquot() argument
479 struct super_block *sb = dquot->dq_sb; in __ocfs2_sync_dquot()
480 int type = dquot->dq_type; in __ocfs2_sync_dquot()
488 dquot->dq_off); in __ocfs2_sync_dquot()
502 spacechange = dquot->dq_dqb.dqb_curspace - in __ocfs2_sync_dquot()
503 OCFS2_DQUOT(dquot)->dq_origspace; in __ocfs2_sync_dquot()
504 inodechange = dquot->dq_dqb.dqb_curinodes - in __ocfs2_sync_dquot()
505 OCFS2_DQUOT(dquot)->dq_originodes; in __ocfs2_sync_dquot()
506 olditime = dquot->dq_dqb.dqb_itime; in __ocfs2_sync_dquot()
507 oldbtime = dquot->dq_dqb.dqb_btime; in __ocfs2_sync_dquot()
508 ocfs2_global_disk2memdqb(dquot, &dqblk); in __ocfs2_sync_dquot()
509 trace_ocfs2_sync_dquot(dquot->dq_id, dquot->dq_dqb.dqb_curspace, in __ocfs2_sync_dquot()
511 dquot->dq_dqb.dqb_curinodes, in __ocfs2_sync_dquot()
513 if (!test_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags)) in __ocfs2_sync_dquot()
514 dquot->dq_dqb.dqb_curspace += spacechange; in __ocfs2_sync_dquot()
515 if (!test_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags)) in __ocfs2_sync_dquot()
516 dquot->dq_dqb.dqb_curinodes += inodechange; in __ocfs2_sync_dquot()
518 if (dquot->dq_dqb.dqb_bsoftlimit && in __ocfs2_sync_dquot()
519 dquot->dq_dqb.dqb_curspace > dquot->dq_dqb.dqb_bsoftlimit) { in __ocfs2_sync_dquot()
520 if (!test_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags) && in __ocfs2_sync_dquot()
522 if (dquot->dq_dqb.dqb_btime > 0) in __ocfs2_sync_dquot()
523 dquot->dq_dqb.dqb_btime = in __ocfs2_sync_dquot()
524 min(dquot->dq_dqb.dqb_btime, oldbtime); in __ocfs2_sync_dquot()
526 dquot->dq_dqb.dqb_btime = oldbtime; in __ocfs2_sync_dquot()
529 dquot->dq_dqb.dqb_btime = 0; in __ocfs2_sync_dquot()
530 clear_bit(DQ_BLKS_B, &dquot->dq_flags); in __ocfs2_sync_dquot()
533 if (dquot->dq_dqb.dqb_isoftlimit && in __ocfs2_sync_dquot()
534 dquot->dq_dqb.dqb_curinodes > dquot->dq_dqb.dqb_isoftlimit) { in __ocfs2_sync_dquot()
535 if (!test_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags) && in __ocfs2_sync_dquot()
537 if (dquot->dq_dqb.dqb_itime > 0) in __ocfs2_sync_dquot()
538 dquot->dq_dqb.dqb_itime = in __ocfs2_sync_dquot()
539 min(dquot->dq_dqb.dqb_itime, olditime); in __ocfs2_sync_dquot()
541 dquot->dq_dqb.dqb_itime = olditime; in __ocfs2_sync_dquot()
544 dquot->dq_dqb.dqb_itime = 0; in __ocfs2_sync_dquot()
545 clear_bit(DQ_INODES_B, &dquot->dq_flags); in __ocfs2_sync_dquot()
548 __clear_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags); in __ocfs2_sync_dquot()
549 __clear_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags); in __ocfs2_sync_dquot()
550 __clear_bit(DQ_LASTSET_B + QIF_BLIMITS_B, &dquot->dq_flags); in __ocfs2_sync_dquot()
551 __clear_bit(DQ_LASTSET_B + QIF_ILIMITS_B, &dquot->dq_flags); in __ocfs2_sync_dquot()
552 __clear_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags); in __ocfs2_sync_dquot()
553 __clear_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags); in __ocfs2_sync_dquot()
554 OCFS2_DQUOT(dquot)->dq_origspace = dquot->dq_dqb.dqb_curspace; in __ocfs2_sync_dquot()
555 OCFS2_DQUOT(dquot)->dq_originodes = dquot->dq_dqb.dqb_curinodes; in __ocfs2_sync_dquot()
560 " (type=%d, id=%u)\n", dquot->dq_type, in __ocfs2_sync_dquot()
561 (unsigned)dquot->dq_id); in __ocfs2_sync_dquot()
565 OCFS2_DQUOT(dquot)->dq_use_count--; in __ocfs2_sync_dquot()
566 err = qtree_write_dquot(&info->dqi_gi, dquot); in __ocfs2_sync_dquot()
569 if (freeing && !OCFS2_DQUOT(dquot)->dq_use_count) { in __ocfs2_sync_dquot()
570 err = qtree_release_dquot(&info->dqi_gi, dquot); in __ocfs2_sync_dquot()
588 static int ocfs2_sync_dquot_helper(struct dquot *dquot, unsigned long type) in ocfs2_sync_dquot_helper() argument
591 struct super_block *sb = dquot->dq_sb; in ocfs2_sync_dquot_helper()
596 trace_ocfs2_sync_dquot_helper(dquot->dq_id, dquot->dq_type, in ocfs2_sync_dquot_helper()
598 if (type != dquot->dq_type) in ocfs2_sync_dquot_helper()
611 status = ocfs2_sync_dquot(dquot); in ocfs2_sync_dquot_helper()
615 status = ocfs2_local_write_dquot(dquot); in ocfs2_sync_dquot_helper()
642 static int ocfs2_write_dquot(struct dquot *dquot) in ocfs2_write_dquot() argument
645 struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb); in ocfs2_write_dquot()
648 trace_ocfs2_write_dquot(dquot->dq_id, dquot->dq_type); in ocfs2_write_dquot()
656 mutex_lock(&sb_dqopt(dquot->dq_sb)->dqio_mutex); in ocfs2_write_dquot()
657 status = ocfs2_local_write_dquot(dquot); in ocfs2_write_dquot()
658 mutex_unlock(&sb_dqopt(dquot->dq_sb)->dqio_mutex); in ocfs2_write_dquot()
678 static int ocfs2_release_dquot(struct dquot *dquot) in ocfs2_release_dquot() argument
682 sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv; in ocfs2_release_dquot()
683 struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb); in ocfs2_release_dquot()
686 trace_ocfs2_release_dquot(dquot->dq_id, dquot->dq_type); in ocfs2_release_dquot()
688 mutex_lock(&dquot->dq_lock); in ocfs2_release_dquot()
690 if (atomic_read(&dquot->dq_count) > 1) in ocfs2_release_dquot()
696 ocfs2_calc_qdel_credits(dquot->dq_sb, dquot->dq_type)); in ocfs2_release_dquot()
703 status = ocfs2_global_release_dquot(dquot); in ocfs2_release_dquot()
708 status = ocfs2_local_release_dquot(handle, dquot); in ocfs2_release_dquot()
715 clear_bit(DQ_ACTIVE_B, &dquot->dq_flags); in ocfs2_release_dquot()
721 mutex_unlock(&dquot->dq_lock); in ocfs2_release_dquot()
732 static int ocfs2_acquire_dquot(struct dquot *dquot) in ocfs2_acquire_dquot() argument
736 struct super_block *sb = dquot->dq_sb; in ocfs2_acquire_dquot()
738 int type = dquot->dq_type; in ocfs2_acquire_dquot()
744 trace_ocfs2_acquire_dquot(dquot->dq_id, type); in ocfs2_acquire_dquot()
745 mutex_lock(&dquot->dq_lock); in ocfs2_acquire_dquot()
753 if (!test_bit(DQ_READ_B, &dquot->dq_flags)) { in ocfs2_acquire_dquot()
757 status = qtree_read_dquot(&info->dqi_gi, dquot); in ocfs2_acquire_dquot()
762 set_bit(DQ_READ_B, &dquot->dq_flags); in ocfs2_acquire_dquot()
764 OCFS2_DQUOT(dquot)->dq_use_count++; in ocfs2_acquire_dquot()
765 OCFS2_DQUOT(dquot)->dq_origspace = dquot->dq_dqb.dqb_curspace; in ocfs2_acquire_dquot()
766 OCFS2_DQUOT(dquot)->dq_originodes = dquot->dq_dqb.dqb_curinodes; in ocfs2_acquire_dquot()
767 if (!dquot->dq_off) { /* No real quota entry? */ in ocfs2_acquire_dquot()
790 status = qtree_write_dquot(&info->dqi_gi, dquot); in ocfs2_acquire_dquot()
804 status = ocfs2_create_local_dquot(dquot); in ocfs2_acquire_dquot()
807 set_bit(DQ_ACTIVE_B, &dquot->dq_flags); in ocfs2_acquire_dquot()
809 mutex_unlock(&dquot->dq_lock); in ocfs2_acquire_dquot()
815 static int ocfs2_mark_dquot_dirty(struct dquot *dquot) in ocfs2_mark_dquot_dirty() argument
825 struct super_block *sb = dquot->dq_sb; in ocfs2_mark_dquot_dirty()
826 int type = dquot->dq_type; in ocfs2_mark_dquot_dirty()
831 trace_ocfs2_mark_dquot_dirty(dquot->dq_id, type); in ocfs2_mark_dquot_dirty()
836 if (dquot->dq_flags & mask) in ocfs2_mark_dquot_dirty()
842 status = ocfs2_write_dquot(dquot); in ocfs2_mark_dquot_dirty()
855 status = ocfs2_sync_dquot(dquot); in ocfs2_mark_dquot_dirty()
861 status = ocfs2_local_write_dquot(dquot); in ocfs2_mark_dquot_dirty()
899 static struct dquot *ocfs2_alloc_dquot(struct super_block *sb, int type) in ocfs2_alloc_dquot()
901 struct ocfs2_dquot *dquot = in ocfs2_alloc_dquot() local
904 if (!dquot) in ocfs2_alloc_dquot()
906 return &dquot->dq_dquot; in ocfs2_alloc_dquot()
909 static void ocfs2_destroy_dquot(struct dquot *dquot) in ocfs2_destroy_dquot() argument
911 kmem_cache_free(ocfs2_dquot_cachep, dquot); in ocfs2_destroy_dquot()