Lines Matching defs:dqp

51 	struct xfs_dquot	*dqp)
53 struct xfs_mount *mp = dqp->q_mount;
55 switch (dqp->q_type) {
78 struct xfs_dquot *dqp)
80 struct xfs_dq_logitem *qlip = &dqp->q_logitem;
101 struct xfs_dquot *dqp)
103 ASSERT(list_empty(&dqp->q_lru));
104 ASSERT(dqp->q_logitem.qli_item.li_buf == NULL);
106 kvfree(dqp->q_logitem.qli_item.li_lv_shadow);
107 mutex_destroy(&dqp->q_qlock);
109 XFS_STATS_DEC(dqp->q_mount, xs_qm_dquot);
110 kmem_cache_free(xfs_dquot_cache, dqp);
331 xfs_dquot_set_prealloc_limits(struct xfs_dquot *dqp)
333 xfs_dquot_set_prealloc(&dqp->q_blk_prealloc, &dqp->q_blk);
334 xfs_dquot_set_prealloc(&dqp->q_rtb_prealloc, &dqp->q_rtb);
344 struct xfs_dquot *dqp,
349 struct xfs_mount *mp = dqp->q_mount;
351 xfs_dqtype_t qtype = xfs_dquot_type(dqp);
356 trace_xfs_dqalloc(dqp);
366 if (!xfs_this_quota_on(dqp->q_mount, qtype)) {
381 error = xfs_bmapi_write(tp, quotip, dqp->q_fileoffset,
394 dqp->q_blkno = XFS_FSB_TO_DADDR(mp, map.br_startblock);
397 error = xfs_trans_get_buf(tp, mp->m_ddev_targp, dqp->q_blkno,
407 xfs_qm_init_dquot_blk(tp, dqp->q_id, qtype, bp);
458 struct xfs_dquot *dqp,
463 xfs_dqtype_t qtype = xfs_dquot_type(dqp);
482 error = xfs_bmapi_read(quotip, dqp->q_fileoffset,
494 trace_xfs_dqtobp_read(dqp);
500 dqp->q_blkno = XFS_FSB_TO_DADDR(mp, map.br_startblock);
502 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno,
506 xfs_dquot_mark_sick(dqp);
526 struct xfs_dquot *dqp;
528 dqp = kmem_cache_zalloc(xfs_dquot_cache, GFP_KERNEL | __GFP_NOFAIL);
530 dqp->q_type = type;
531 dqp->q_id = id;
532 dqp->q_mount = mp;
533 INIT_LIST_HEAD(&dqp->q_lru);
534 mutex_init(&dqp->q_qlock);
535 init_waitqueue_head(&dqp->q_pinwait);
536 dqp->q_fileoffset = (xfs_fileoff_t)id / mp->m_quotainfo->qi_dqperchunk;
540 dqp->q_bufoffset = (id % mp->m_quotainfo->qi_dqperchunk) *
548 init_completion(&dqp->q_flush);
549 complete(&dqp->q_flush);
560 lockdep_set_class(&dqp->q_qlock, &xfs_dquot_group_class);
563 lockdep_set_class(&dqp->q_qlock, &xfs_dquot_project_class);
570 xfs_qm_dquot_logitem_init(dqp);
573 return dqp;
579 struct xfs_dquot *dqp,
586 dqp_type = xfs_dquot_type(dqp);
588 if (be32_to_cpu(ddqp->d_id) != dqp->q_id)
596 if (xfs_has_crc(dqp->q_mount) ||
597 dqp_type == XFS_DQTYPE_USER || dqp->q_id != 0)
615 struct xfs_dquot *dqp,
618 struct xfs_dqblk *dqb = xfs_buf_offset(bp, dqp->q_bufoffset);
625 if (!xfs_dquot_check_type(dqp, ddqp)) {
628 __this_address, dqp->q_id);
630 xfs_dquot_mark_sick(dqp);
635 dqp->q_type = ddqp->d_type;
636 dqp->q_blk.hardlimit = be64_to_cpu(ddqp->d_blk_hardlimit);
637 dqp->q_blk.softlimit = be64_to_cpu(ddqp->d_blk_softlimit);
638 dqp->q_ino.hardlimit = be64_to_cpu(ddqp->d_ino_hardlimit);
639 dqp->q_ino.softlimit = be64_to_cpu(ddqp->d_ino_softlimit);
640 dqp->q_rtb.hardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit);
641 dqp->q_rtb.softlimit = be64_to_cpu(ddqp->d_rtb_softlimit);
643 dqp->q_blk.count = be64_to_cpu(ddqp->d_bcount);
644 dqp->q_ino.count = be64_to_cpu(ddqp->d_icount);
645 dqp->q_rtb.count = be64_to_cpu(ddqp->d_rtbcount);
647 dqp->q_blk.timer = xfs_dquot_from_disk_ts(ddqp, ddqp->d_btimer);
648 dqp->q_ino.timer = xfs_dquot_from_disk_ts(ddqp, ddqp->d_itimer);
649 dqp->q_rtb.timer = xfs_dquot_from_disk_ts(ddqp, ddqp->d_rtbtimer);
655 dqp->q_blk.reserved = dqp->q_blk.count;
656 dqp->q_ino.reserved = dqp->q_ino.count;
657 dqp->q_rtb.reserved = dqp->q_rtb.count;
660 xfs_dquot_set_prealloc_limits(dqp);
668 struct xfs_dquot *dqp)
672 ddqp->d_type = dqp->q_type;
673 ddqp->d_id = cpu_to_be32(dqp->q_id);
677 ddqp->d_blk_hardlimit = cpu_to_be64(dqp->q_blk.hardlimit);
678 ddqp->d_blk_softlimit = cpu_to_be64(dqp->q_blk.softlimit);
679 ddqp->d_ino_hardlimit = cpu_to_be64(dqp->q_ino.hardlimit);
680 ddqp->d_ino_softlimit = cpu_to_be64(dqp->q_ino.softlimit);
681 ddqp->d_rtb_hardlimit = cpu_to_be64(dqp->q_rtb.hardlimit);
682 ddqp->d_rtb_softlimit = cpu_to_be64(dqp->q_rtb.softlimit);
684 ddqp->d_bcount = cpu_to_be64(dqp->q_blk.count);
685 ddqp->d_icount = cpu_to_be64(dqp->q_ino.count);
686 ddqp->d_rtbcount = cpu_to_be64(dqp->q_rtb.count);
692 ddqp->d_btimer = xfs_dquot_to_disk_ts(dqp, dqp->q_blk.timer);
693 ddqp->d_itimer = xfs_dquot_to_disk_ts(dqp, dqp->q_ino.timer);
694 ddqp->d_rtbtimer = xfs_dquot_to_disk_ts(dqp, dqp->q_rtb.timer);
710 struct xfs_dquot *dqp;
714 dqp = xfs_dquot_alloc(mp, id, type);
715 trace_xfs_dqread(dqp);
718 error = xfs_dquot_disk_read(mp, dqp, &bp);
720 error = xfs_dquot_disk_alloc(dqp, &bp);
731 error = xfs_dquot_from_disk(dqp, bp);
736 *dqpp = dqp;
740 trace_xfs_dqread_fail(dqp);
741 xfs_qm_dqdestroy(dqp);
808 struct xfs_dquot *dqp;
812 dqp = radix_tree_lookup(tree, id);
813 if (!dqp) {
819 xfs_dqlock(dqp);
820 if (dqp->q_flags & XFS_DQFLAG_FREEING) {
821 xfs_dqunlock(dqp);
823 trace_xfs_dqget_freeing(dqp);
828 dqp->q_nrefs++;
831 trace_xfs_dqget_hit(dqp);
833 return dqp;
854 struct xfs_dquot *dqp)
861 error = radix_tree_insert(tree, id, dqp);
864 trace_xfs_dqget_dup(dqp);
869 xfs_dqlock(dqp);
870 dqp->q_nrefs = 1;
918 struct xfs_dquot *dqp;
926 dqp = xfs_qm_dqget_cache_lookup(mp, qi, tree, id);
927 if (dqp) {
928 *O_dqpp = dqp;
932 error = xfs_qm_dqread(mp, id, type, can_alloc, &dqp);
936 error = xfs_qm_dqget_cache_insert(mp, qi, tree, id, dqp);
942 xfs_qm_dqdestroy(dqp);
947 trace_xfs_dqget_miss(dqp);
948 *O_dqpp = dqp;
1007 struct xfs_dquot *dqp;
1022 dqp = xfs_qm_dqget_cache_lookup(mp, qi, tree, id);
1023 if (dqp) {
1024 *O_dqpp = dqp;
1036 error = xfs_qm_dqread(mp, id, type, can_alloc, &dqp);
1050 xfs_qm_dqdestroy(dqp);
1051 dqp = dqp1;
1052 xfs_dqlock(dqp);
1057 xfs_qm_dqdestroy(dqp);
1061 error = xfs_qm_dqget_cache_insert(mp, qi, tree, id, dqp);
1067 xfs_qm_dqdestroy(dqp);
1074 trace_xfs_dqget_miss(dqp);
1075 *O_dqpp = dqp;
1090 struct xfs_dquot *dqp;
1095 error = xfs_qm_dqget(mp, id, type, false, &dqp);
1101 if (!XFS_IS_DQUOT_UNINITIALIZED(dqp)) {
1102 *dqpp = dqp;
1106 xfs_qm_dqput(dqp);
1120 struct xfs_dquot *dqp)
1122 ASSERT(dqp->q_nrefs > 0);
1123 ASSERT(XFS_DQ_IS_LOCKED(dqp));
1125 trace_xfs_dqput(dqp);
1127 if (--dqp->q_nrefs == 0) {
1128 struct xfs_quotainfo *qi = dqp->q_mount->m_quotainfo;
1129 trace_xfs_dqput_free(dqp);
1131 if (list_lru_add_obj(&qi->qi_lru, &dqp->q_lru))
1132 XFS_STATS_INC(dqp->q_mount, xs_qm_dquot_unused);
1134 xfs_dqunlock(dqp);
1143 struct xfs_dquot *dqp)
1145 if (!dqp)
1148 trace_xfs_dqrele(dqp);
1150 xfs_dqlock(dqp);
1157 xfs_qm_dqput(dqp);
1173 struct xfs_dquot *dqp = qlip->qli_dquot;
1217 xfs_dqfunlock(dqp);
1235 struct xfs_dquot *dqp)
1237 xfs_dqtype_t type = xfs_dquot_type(dqp);
1244 if (dqp->q_id == 0)
1247 if (dqp->q_blk.softlimit && dqp->q_blk.count > dqp->q_blk.softlimit &&
1248 !dqp->q_blk.timer)
1251 if (dqp->q_ino.softlimit && dqp->q_ino.count > dqp->q_ino.softlimit &&
1252 !dqp->q_ino.timer)
1255 if (dqp->q_rtb.softlimit && dqp->q_rtb.count > dqp->q_rtb.softlimit &&
1256 !dqp->q_rtb.timer)
1260 if (dqp->q_type & XFS_DQTYPE_BIGTIME) {
1261 if (!xfs_has_bigtime(dqp->q_mount))
1263 if (dqp->q_id == 0)
1279 struct xfs_dquot *dqp,
1282 struct xfs_mount *mp = dqp->q_mount;
1286 error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, dqp->q_blkno,
1290 xfs_dquot_mark_sick(dqp);
1298 dqp->q_flags &= ~XFS_DQFLAG_DIRTY;
1299 xfs_trans_ail_delete(&dqp->q_logitem.qli_item, 0);
1312 struct xfs_dquot *dqp)
1314 struct xfs_dq_logitem *qlip = &dqp->q_logitem;
1323 error = xfs_dquot_read_buf(tp, dqp, &bp);
1354 struct xfs_dquot *dqp,
1357 struct xfs_buf *bp = dqp->q_logitem.qli_item.li_buf;
1365 ASSERT(xfs_is_shutdown(dqp->q_mount));
1389 struct xfs_dquot *dqp,
1392 struct xfs_mount *mp = dqp->q_mount;
1393 struct xfs_dq_logitem *qlip = &dqp->q_logitem;
1399 ASSERT(XFS_DQ_IS_LOCKED(dqp));
1400 ASSERT(!completion_done(&dqp->q_flush));
1401 ASSERT(atomic_read(&dqp->q_pincount) == 0);
1403 trace_xfs_dqflush(dqp);
1404 fa = xfs_qm_dqflush_check(dqp);
1407 dqp->q_id, fa);
1408 xfs_dquot_mark_sick(dqp);
1414 dqblk = xfs_buf_offset(bp, dqp->q_bufoffset);
1415 xfs_dquot_to_disk(&dqblk->dd_diskdq, dqp);
1420 dqp->q_flags &= ~XFS_DQFLAG_DIRTY;
1459 trace_xfs_dqflush_force(dqp);
1463 trace_xfs_dqflush_done(dqp);
1467 dqp->q_flags &= ~XFS_DQFLAG_DIRTY;
1470 xfs_dqfunlock(dqp);