Lines Matching refs:dqp

73 	xfs_dquot_t	*dqp)  in xfs_qm_dqdestroy()  argument
75 ASSERT(list_empty(&dqp->q_lru)); in xfs_qm_dqdestroy()
77 mutex_destroy(&dqp->q_qlock); in xfs_qm_dqdestroy()
79 XFS_STATS_DEC(dqp->q_mount, xs_qm_dquot); in xfs_qm_dqdestroy()
80 kmem_zone_free(xfs_qm_dqzone, dqp); in xfs_qm_dqdestroy()
273 xfs_dquot_set_prealloc_limits(struct xfs_dquot *dqp) in xfs_dquot_set_prealloc_limits() argument
277 dqp->q_prealloc_hi_wmark = be64_to_cpu(dqp->q_core.d_blk_hardlimit); in xfs_dquot_set_prealloc_limits()
278 dqp->q_prealloc_lo_wmark = be64_to_cpu(dqp->q_core.d_blk_softlimit); in xfs_dquot_set_prealloc_limits()
279 if (!dqp->q_prealloc_lo_wmark) { in xfs_dquot_set_prealloc_limits()
280 dqp->q_prealloc_lo_wmark = dqp->q_prealloc_hi_wmark; in xfs_dquot_set_prealloc_limits()
281 do_div(dqp->q_prealloc_lo_wmark, 100); in xfs_dquot_set_prealloc_limits()
282 dqp->q_prealloc_lo_wmark *= 95; in xfs_dquot_set_prealloc_limits()
285 space = dqp->q_prealloc_hi_wmark; in xfs_dquot_set_prealloc_limits()
288 dqp->q_low_space[XFS_QLOWSP_1_PCNT] = space; in xfs_dquot_set_prealloc_limits()
289 dqp->q_low_space[XFS_QLOWSP_3_PCNT] = space * 3; in xfs_dquot_set_prealloc_limits()
290 dqp->q_low_space[XFS_QLOWSP_5_PCNT] = space * 5; in xfs_dquot_set_prealloc_limits()
301 xfs_dquot_t *dqp, in xfs_qm_dqalloc() argument
315 trace_xfs_dqalloc(dqp); in xfs_qm_dqalloc()
326 if (!xfs_this_quota_on(dqp->q_mount, dqp->dq_flags)) { in xfs_qm_dqalloc()
347 dqp->q_blkno = XFS_FSB_TO_DADDR(mp, map.br_startblock); in xfs_qm_dqalloc()
351 dqp->q_blkno, in xfs_qm_dqalloc()
364 xfs_qm_init_dquot_blk(tp, mp, be32_to_cpu(dqp->q_core.d_id), in xfs_qm_dqalloc()
365 dqp->dq_flags & XFS_DQ_ALLTYPES, bp); in xfs_qm_dqalloc()
408 struct xfs_dquot *dqp, in xfs_qm_dqrepair() argument
421 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, dqp->q_blkno, in xfs_qm_dqrepair()
438 dqp->dq_flags & XFS_DQ_ALLTYPES, in xfs_qm_dqrepair()
458 xfs_dquot_t *dqp, in xfs_qm_dqtobp() argument
466 struct xfs_inode *quotip = xfs_dq_to_quota_inode(dqp); in xfs_qm_dqtobp()
467 struct xfs_mount *mp = dqp->q_mount; in xfs_qm_dqtobp()
468 xfs_dqid_t id = be32_to_cpu(dqp->q_core.d_id); in xfs_qm_dqtobp()
472 dqp->q_fileoffset = (xfs_fileoff_t)id / mp->m_quotainfo->qi_dqperchunk; in xfs_qm_dqtobp()
475 if (!xfs_this_quota_on(dqp->q_mount, dqp->dq_flags)) { in xfs_qm_dqtobp()
487 error = xfs_bmapi_read(quotip, dqp->q_fileoffset, in xfs_qm_dqtobp()
500 dqp->q_bufoffset = (id % mp->m_quotainfo->qi_dqperchunk) * in xfs_qm_dqtobp()
512 error = xfs_qm_dqalloc(tpp, mp, dqp, quotip, in xfs_qm_dqtobp()
513 dqp->q_fileoffset, &bp); in xfs_qm_dqtobp()
518 trace_xfs_dqtobp_read(dqp); in xfs_qm_dqtobp()
524 dqp->q_blkno = XFS_FSB_TO_DADDR(mp, map.br_startblock); in xfs_qm_dqtobp()
527 dqp->q_blkno, in xfs_qm_dqtobp()
535 error = xfs_qm_dqrepair(mp, tp, dqp, firstid, &bp); in xfs_qm_dqtobp()
546 *O_ddpp = bp->b_addr + dqp->q_bufoffset; in xfs_qm_dqtobp()
566 struct xfs_dquot *dqp; in xfs_qm_dqread() local
572 dqp = kmem_zone_zalloc(xfs_qm_dqzone, KM_SLEEP); in xfs_qm_dqread()
574 dqp->dq_flags = type; in xfs_qm_dqread()
575 dqp->q_core.d_id = cpu_to_be32(id); in xfs_qm_dqread()
576 dqp->q_mount = mp; in xfs_qm_dqread()
577 INIT_LIST_HEAD(&dqp->q_lru); in xfs_qm_dqread()
578 mutex_init(&dqp->q_qlock); in xfs_qm_dqread()
579 init_waitqueue_head(&dqp->q_pinwait); in xfs_qm_dqread()
586 init_completion(&dqp->q_flush); in xfs_qm_dqread()
587 complete(&dqp->q_flush); in xfs_qm_dqread()
598 lockdep_set_class(&dqp->q_qlock, &xfs_dquot_group_class); in xfs_qm_dqread()
601 lockdep_set_class(&dqp->q_qlock, &xfs_dquot_project_class); in xfs_qm_dqread()
610 trace_xfs_dqread(dqp); in xfs_qm_dqread()
624 error = xfs_qm_dqtobp(&tp, dqp, &ddqp, &bp, flags); in xfs_qm_dqread()
631 trace_xfs_dqread_fail(dqp); in xfs_qm_dqread()
636 memcpy(&dqp->q_core, ddqp, sizeof(xfs_disk_dquot_t)); in xfs_qm_dqread()
637 xfs_qm_dquot_logitem_init(dqp); in xfs_qm_dqread()
643 dqp->q_res_bcount = be64_to_cpu(ddqp->d_bcount); in xfs_qm_dqread()
644 dqp->q_res_icount = be64_to_cpu(ddqp->d_icount); in xfs_qm_dqread()
645 dqp->q_res_rtbcount = be64_to_cpu(ddqp->d_rtbcount); in xfs_qm_dqread()
648 xfs_dquot_set_prealloc_limits(dqp); in xfs_qm_dqread()
674 *O_dqpp = dqp; in xfs_qm_dqread()
681 xfs_qm_dqdestroy(dqp); in xfs_qm_dqread()
705 struct xfs_dquot *dqp; in xfs_qm_dqget() local
735 dqp = radix_tree_lookup(tree, id); in xfs_qm_dqget()
736 if (dqp) { in xfs_qm_dqget()
737 xfs_dqlock(dqp); in xfs_qm_dqget()
738 if (dqp->dq_flags & XFS_DQ_FREEING) { in xfs_qm_dqget()
739 xfs_dqunlock(dqp); in xfs_qm_dqget()
741 trace_xfs_dqget_freeing(dqp); in xfs_qm_dqget()
746 dqp->q_nrefs++; in xfs_qm_dqget()
749 trace_xfs_dqget_hit(dqp); in xfs_qm_dqget()
751 *O_dqpp = dqp; in xfs_qm_dqget()
767 error = xfs_qm_dqread(mp, id, type, flags, &dqp); in xfs_qm_dqget()
785 xfs_qm_dqdestroy(dqp); in xfs_qm_dqget()
786 dqp = dqp1; in xfs_qm_dqget()
787 xfs_dqlock(dqp); in xfs_qm_dqget()
792 xfs_qm_dqdestroy(dqp); in xfs_qm_dqget()
798 error = radix_tree_insert(tree, id, dqp); in xfs_qm_dqget()
807 trace_xfs_dqget_dup(dqp); in xfs_qm_dqget()
808 xfs_qm_dqdestroy(dqp); in xfs_qm_dqget()
816 xfs_dqlock(dqp); in xfs_qm_dqget()
817 dqp->q_nrefs = 1; in xfs_qm_dqget()
824 trace_xfs_dqget_miss(dqp); in xfs_qm_dqget()
825 *O_dqpp = dqp; in xfs_qm_dqget()
837 struct xfs_dquot *dqp) in xfs_qm_dqput() argument
839 ASSERT(dqp->q_nrefs > 0); in xfs_qm_dqput()
840 ASSERT(XFS_DQ_IS_LOCKED(dqp)); in xfs_qm_dqput()
842 trace_xfs_dqput(dqp); in xfs_qm_dqput()
844 if (--dqp->q_nrefs == 0) { in xfs_qm_dqput()
845 struct xfs_quotainfo *qi = dqp->q_mount->m_quotainfo; in xfs_qm_dqput()
846 trace_xfs_dqput_free(dqp); in xfs_qm_dqput()
848 if (list_lru_add(&qi->qi_lru, &dqp->q_lru)) in xfs_qm_dqput()
849 XFS_STATS_INC(dqp->q_mount, xs_qm_dquot_unused); in xfs_qm_dqput()
851 xfs_dqunlock(dqp); in xfs_qm_dqput()
860 xfs_dquot_t *dqp) in xfs_qm_dqrele() argument
862 if (!dqp) in xfs_qm_dqrele()
865 trace_xfs_dqrele(dqp); in xfs_qm_dqrele()
867 xfs_dqlock(dqp); in xfs_qm_dqrele()
874 xfs_qm_dqput(dqp); in xfs_qm_dqrele()
890 xfs_dquot_t *dqp = qip->qli_dquot; in xfs_qm_dqflush_done() local
915 xfs_dqfunlock(dqp); in xfs_qm_dqflush_done()
928 struct xfs_dquot *dqp, in xfs_qm_dqflush() argument
931 struct xfs_mount *mp = dqp->q_mount; in xfs_qm_dqflush()
936 ASSERT(XFS_DQ_IS_LOCKED(dqp)); in xfs_qm_dqflush()
937 ASSERT(!completion_done(&dqp->q_flush)); in xfs_qm_dqflush()
939 trace_xfs_dqflush(dqp); in xfs_qm_dqflush()
943 xfs_qm_dqunpin_wait(dqp); in xfs_qm_dqflush()
954 struct xfs_log_item *lip = &dqp->q_logitem.qli_item; in xfs_qm_dqflush()
955 dqp->dq_flags &= ~XFS_DQ_DIRTY; in xfs_qm_dqflush()
966 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno, in xfs_qm_dqflush()
975 ddqp = bp->b_addr + dqp->q_bufoffset; in xfs_qm_dqflush()
980 error = xfs_dqcheck(mp, &dqp->q_core, be32_to_cpu(ddqp->d_id), 0, in xfs_qm_dqflush()
984 xfs_dqfunlock(dqp); in xfs_qm_dqflush()
990 memcpy(ddqp, &dqp->q_core, sizeof(xfs_disk_dquot_t)); in xfs_qm_dqflush()
995 dqp->dq_flags &= ~XFS_DQ_DIRTY; in xfs_qm_dqflush()
997 xfs_trans_ail_copy_lsn(mp->m_ail, &dqp->q_logitem.qli_flush_lsn, in xfs_qm_dqflush()
998 &dqp->q_logitem.qli_item.li_lsn); in xfs_qm_dqflush()
1012 dqb->dd_lsn = cpu_to_be64(dqp->q_logitem.qli_item.li_lsn); in xfs_qm_dqflush()
1022 &dqp->q_logitem.qli_item); in xfs_qm_dqflush()
1029 trace_xfs_dqflush_force(dqp); in xfs_qm_dqflush()
1033 trace_xfs_dqflush_done(dqp); in xfs_qm_dqflush()
1038 xfs_dqfunlock(dqp); in xfs_qm_dqflush()