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()
78 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
574 dqp = kmem_zone_zalloc(xfs_qm_dqzone, KM_SLEEP); in xfs_qm_dqread()
576 dqp->dq_flags = type; in xfs_qm_dqread()
577 dqp->q_core.d_id = cpu_to_be32(id); in xfs_qm_dqread()
578 dqp->q_mount = mp; in xfs_qm_dqread()
579 INIT_LIST_HEAD(&dqp->q_lru); in xfs_qm_dqread()
580 mutex_init(&dqp->q_qlock); in xfs_qm_dqread()
581 init_waitqueue_head(&dqp->q_pinwait); in xfs_qm_dqread()
588 init_completion(&dqp->q_flush); in xfs_qm_dqread()
589 complete(&dqp->q_flush); in xfs_qm_dqread()
600 lockdep_set_class(&dqp->q_qlock, &xfs_dquot_group_class); in xfs_qm_dqread()
603 lockdep_set_class(&dqp->q_qlock, &xfs_dquot_project_class); in xfs_qm_dqread()
612 trace_xfs_dqread(dqp); in xfs_qm_dqread()
627 error = xfs_qm_dqtobp(&tp, dqp, &ddqp, &bp, flags); in xfs_qm_dqread()
634 trace_xfs_dqread_fail(dqp); in xfs_qm_dqread()
640 memcpy(&dqp->q_core, ddqp, sizeof(xfs_disk_dquot_t)); in xfs_qm_dqread()
641 xfs_qm_dquot_logitem_init(dqp); in xfs_qm_dqread()
647 dqp->q_res_bcount = be64_to_cpu(ddqp->d_bcount); in xfs_qm_dqread()
648 dqp->q_res_icount = be64_to_cpu(ddqp->d_icount); in xfs_qm_dqread()
649 dqp->q_res_rtbcount = be64_to_cpu(ddqp->d_rtbcount); in xfs_qm_dqread()
652 xfs_dquot_set_prealloc_limits(dqp); in xfs_qm_dqread()
678 *O_dqpp = dqp; in xfs_qm_dqread()
685 xfs_qm_dqdestroy(dqp); in xfs_qm_dqread()
709 struct xfs_dquot *dqp; in xfs_qm_dqget() local
739 dqp = radix_tree_lookup(tree, id); in xfs_qm_dqget()
740 if (dqp) { in xfs_qm_dqget()
741 xfs_dqlock(dqp); in xfs_qm_dqget()
742 if (dqp->dq_flags & XFS_DQ_FREEING) { in xfs_qm_dqget()
743 xfs_dqunlock(dqp); in xfs_qm_dqget()
745 trace_xfs_dqget_freeing(dqp); in xfs_qm_dqget()
750 dqp->q_nrefs++; in xfs_qm_dqget()
753 trace_xfs_dqget_hit(dqp); in xfs_qm_dqget()
755 *O_dqpp = dqp; in xfs_qm_dqget()
771 error = xfs_qm_dqread(mp, id, type, flags, &dqp); in xfs_qm_dqget()
789 xfs_qm_dqdestroy(dqp); in xfs_qm_dqget()
790 dqp = dqp1; in xfs_qm_dqget()
791 xfs_dqlock(dqp); in xfs_qm_dqget()
796 xfs_qm_dqdestroy(dqp); in xfs_qm_dqget()
802 error = radix_tree_insert(tree, id, dqp); in xfs_qm_dqget()
811 trace_xfs_dqget_dup(dqp); in xfs_qm_dqget()
812 xfs_qm_dqdestroy(dqp); in xfs_qm_dqget()
820 xfs_dqlock(dqp); in xfs_qm_dqget()
821 dqp->q_nrefs = 1; in xfs_qm_dqget()
828 trace_xfs_dqget_miss(dqp); in xfs_qm_dqget()
829 *O_dqpp = dqp; in xfs_qm_dqget()
841 struct xfs_dquot *dqp) in xfs_qm_dqput() argument
843 ASSERT(dqp->q_nrefs > 0); in xfs_qm_dqput()
844 ASSERT(XFS_DQ_IS_LOCKED(dqp)); in xfs_qm_dqput()
846 trace_xfs_dqput(dqp); in xfs_qm_dqput()
848 if (--dqp->q_nrefs == 0) { in xfs_qm_dqput()
849 struct xfs_quotainfo *qi = dqp->q_mount->m_quotainfo; in xfs_qm_dqput()
850 trace_xfs_dqput_free(dqp); in xfs_qm_dqput()
852 if (list_lru_add(&qi->qi_lru, &dqp->q_lru)) in xfs_qm_dqput()
855 xfs_dqunlock(dqp); in xfs_qm_dqput()
864 xfs_dquot_t *dqp) in xfs_qm_dqrele() argument
866 if (!dqp) in xfs_qm_dqrele()
869 trace_xfs_dqrele(dqp); in xfs_qm_dqrele()
871 xfs_dqlock(dqp); in xfs_qm_dqrele()
878 xfs_qm_dqput(dqp); in xfs_qm_dqrele()
894 xfs_dquot_t *dqp = qip->qli_dquot; in xfs_qm_dqflush_done() local
919 xfs_dqfunlock(dqp); in xfs_qm_dqflush_done()
932 struct xfs_dquot *dqp, in xfs_qm_dqflush() argument
935 struct xfs_mount *mp = dqp->q_mount; in xfs_qm_dqflush()
940 ASSERT(XFS_DQ_IS_LOCKED(dqp)); in xfs_qm_dqflush()
941 ASSERT(!completion_done(&dqp->q_flush)); in xfs_qm_dqflush()
943 trace_xfs_dqflush(dqp); in xfs_qm_dqflush()
947 xfs_qm_dqunpin_wait(dqp); in xfs_qm_dqflush()
958 struct xfs_log_item *lip = &dqp->q_logitem.qli_item; in xfs_qm_dqflush()
959 dqp->dq_flags &= ~XFS_DQ_DIRTY; in xfs_qm_dqflush()
974 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno, in xfs_qm_dqflush()
983 ddqp = bp->b_addr + dqp->q_bufoffset; in xfs_qm_dqflush()
988 error = xfs_dqcheck(mp, &dqp->q_core, be32_to_cpu(ddqp->d_id), 0, in xfs_qm_dqflush()
992 xfs_dqfunlock(dqp); in xfs_qm_dqflush()
998 memcpy(ddqp, &dqp->q_core, sizeof(xfs_disk_dquot_t)); in xfs_qm_dqflush()
1003 dqp->dq_flags &= ~XFS_DQ_DIRTY; in xfs_qm_dqflush()
1005 xfs_trans_ail_copy_lsn(mp->m_ail, &dqp->q_logitem.qli_flush_lsn, in xfs_qm_dqflush()
1006 &dqp->q_logitem.qli_item.li_lsn); in xfs_qm_dqflush()
1020 dqb->dd_lsn = cpu_to_be64(dqp->q_logitem.qli_item.li_lsn); in xfs_qm_dqflush()
1030 &dqp->q_logitem.qli_item); in xfs_qm_dqflush()
1037 trace_xfs_dqflush_force(dqp); in xfs_qm_dqflush()
1041 trace_xfs_dqflush_done(dqp); in xfs_qm_dqflush()
1046 xfs_dqfunlock(dqp); in xfs_qm_dqflush()