Lines Matching defs:dqp

51 	struct xfs_dquot	*dqp)
53 struct xfs_mount *mp = dqp->q_mount;
55 switch (dqp->q_type) {
76 struct xfs_dquot *dqp)
78 ASSERT(list_empty(&dqp->q_lru));
80 kvfree(dqp->q_logitem.qli_item.li_lv_shadow);
81 mutex_destroy(&dqp->q_qlock);
83 XFS_STATS_DEC(dqp->q_mount, xs_qm_dquot);
84 kmem_cache_free(xfs_dquot_cache, dqp);
286 xfs_dquot_set_prealloc_limits(struct xfs_dquot *dqp)
290 dqp->q_prealloc_hi_wmark = dqp->q_blk.hardlimit;
291 dqp->q_prealloc_lo_wmark = dqp->q_blk.softlimit;
292 if (!dqp->q_prealloc_lo_wmark) {
293 dqp->q_prealloc_lo_wmark = dqp->q_prealloc_hi_wmark;
294 do_div(dqp->q_prealloc_lo_wmark, 100);
295 dqp->q_prealloc_lo_wmark *= 95;
298 space = dqp->q_prealloc_hi_wmark;
301 dqp->q_low_space[XFS_QLOWSP_1_PCNT] = space;
302 dqp->q_low_space[XFS_QLOWSP_3_PCNT] = space * 3;
303 dqp->q_low_space[XFS_QLOWSP_5_PCNT] = space * 5;
313 struct xfs_dquot *dqp,
318 struct xfs_mount *mp = dqp->q_mount;
320 xfs_dqtype_t qtype = xfs_dquot_type(dqp);
325 trace_xfs_dqalloc(dqp);
335 if (!xfs_this_quota_on(dqp->q_mount, qtype)) {
353 error = xfs_bmapi_write(tp, quotip, dqp->q_fileoffset,
367 dqp->q_blkno = XFS_FSB_TO_DADDR(mp, map.br_startblock);
370 error = xfs_trans_get_buf(tp, mp->m_ddev_targp, dqp->q_blkno,
380 xfs_qm_init_dquot_blk(tp, dqp->q_id, qtype, bp);
431 struct xfs_dquot *dqp,
436 xfs_dqtype_t qtype = xfs_dquot_type(dqp);
455 error = xfs_bmapi_read(quotip, dqp->q_fileoffset,
467 trace_xfs_dqtobp_read(dqp);
473 dqp->q_blkno = XFS_FSB_TO_DADDR(mp, map.br_startblock);
475 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno,
479 xfs_dquot_mark_sick(dqp);
499 struct xfs_dquot *dqp;
501 dqp = kmem_cache_zalloc(xfs_dquot_cache, GFP_KERNEL | __GFP_NOFAIL);
503 dqp->q_type = type;
504 dqp->q_id = id;
505 dqp->q_mount = mp;
506 INIT_LIST_HEAD(&dqp->q_lru);
507 mutex_init(&dqp->q_qlock);
508 init_waitqueue_head(&dqp->q_pinwait);
509 dqp->q_fileoffset = (xfs_fileoff_t)id / mp->m_quotainfo->qi_dqperchunk;
513 dqp->q_bufoffset = (id % mp->m_quotainfo->qi_dqperchunk) *
521 init_completion(&dqp->q_flush);
522 complete(&dqp->q_flush);
533 lockdep_set_class(&dqp->q_qlock, &xfs_dquot_group_class);
536 lockdep_set_class(&dqp->q_qlock, &xfs_dquot_project_class);
543 xfs_qm_dquot_logitem_init(dqp);
546 return dqp;
552 struct xfs_dquot *dqp,
559 dqp_type = xfs_dquot_type(dqp);
561 if (be32_to_cpu(ddqp->d_id) != dqp->q_id)
569 if (xfs_has_crc(dqp->q_mount) ||
570 dqp_type == XFS_DQTYPE_USER || dqp->q_id != 0)
588 struct xfs_dquot *dqp,
591 struct xfs_dqblk *dqb = xfs_buf_offset(bp, dqp->q_bufoffset);
598 if (!xfs_dquot_check_type(dqp, ddqp)) {
601 __this_address, dqp->q_id);
603 xfs_dquot_mark_sick(dqp);
608 dqp->q_type = ddqp->d_type;
609 dqp->q_blk.hardlimit = be64_to_cpu(ddqp->d_blk_hardlimit);
610 dqp->q_blk.softlimit = be64_to_cpu(ddqp->d_blk_softlimit);
611 dqp->q_ino.hardlimit = be64_to_cpu(ddqp->d_ino_hardlimit);
612 dqp->q_ino.softlimit = be64_to_cpu(ddqp->d_ino_softlimit);
613 dqp->q_rtb.hardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit);
614 dqp->q_rtb.softlimit = be64_to_cpu(ddqp->d_rtb_softlimit);
616 dqp->q_blk.count = be64_to_cpu(ddqp->d_bcount);
617 dqp->q_ino.count = be64_to_cpu(ddqp->d_icount);
618 dqp->q_rtb.count = be64_to_cpu(ddqp->d_rtbcount);
620 dqp->q_blk.timer = xfs_dquot_from_disk_ts(ddqp, ddqp->d_btimer);
621 dqp->q_ino.timer = xfs_dquot_from_disk_ts(ddqp, ddqp->d_itimer);
622 dqp->q_rtb.timer = xfs_dquot_from_disk_ts(ddqp, ddqp->d_rtbtimer);
628 dqp->q_blk.reserved = dqp->q_blk.count;
629 dqp->q_ino.reserved = dqp->q_ino.count;
630 dqp->q_rtb.reserved = dqp->q_rtb.count;
633 xfs_dquot_set_prealloc_limits(dqp);
641 struct xfs_dquot *dqp)
645 ddqp->d_type = dqp->q_type;
646 ddqp->d_id = cpu_to_be32(dqp->q_id);
650 ddqp->d_blk_hardlimit = cpu_to_be64(dqp->q_blk.hardlimit);
651 ddqp->d_blk_softlimit = cpu_to_be64(dqp->q_blk.softlimit);
652 ddqp->d_ino_hardlimit = cpu_to_be64(dqp->q_ino.hardlimit);
653 ddqp->d_ino_softlimit = cpu_to_be64(dqp->q_ino.softlimit);
654 ddqp->d_rtb_hardlimit = cpu_to_be64(dqp->q_rtb.hardlimit);
655 ddqp->d_rtb_softlimit = cpu_to_be64(dqp->q_rtb.softlimit);
657 ddqp->d_bcount = cpu_to_be64(dqp->q_blk.count);
658 ddqp->d_icount = cpu_to_be64(dqp->q_ino.count);
659 ddqp->d_rtbcount = cpu_to_be64(dqp->q_rtb.count);
665 ddqp->d_btimer = xfs_dquot_to_disk_ts(dqp, dqp->q_blk.timer);
666 ddqp->d_itimer = xfs_dquot_to_disk_ts(dqp, dqp->q_ino.timer);
667 ddqp->d_rtbtimer = xfs_dquot_to_disk_ts(dqp, dqp->q_rtb.timer);
683 struct xfs_dquot *dqp;
687 dqp = xfs_dquot_alloc(mp, id, type);
688 trace_xfs_dqread(dqp);
691 error = xfs_dquot_disk_read(mp, dqp, &bp);
693 error = xfs_dquot_disk_alloc(dqp, &bp);
704 error = xfs_dquot_from_disk(dqp, bp);
709 *dqpp = dqp;
713 trace_xfs_dqread_fail(dqp);
714 xfs_qm_dqdestroy(dqp);
781 struct xfs_dquot *dqp;
785 dqp = radix_tree_lookup(tree, id);
786 if (!dqp) {
792 xfs_dqlock(dqp);
793 if (dqp->q_flags & XFS_DQFLAG_FREEING) {
794 xfs_dqunlock(dqp);
796 trace_xfs_dqget_freeing(dqp);
801 dqp->q_nrefs++;
804 trace_xfs_dqget_hit(dqp);
806 return dqp;
827 struct xfs_dquot *dqp)
834 error = radix_tree_insert(tree, id, dqp);
837 trace_xfs_dqget_dup(dqp);
842 xfs_dqlock(dqp);
843 dqp->q_nrefs = 1;
891 struct xfs_dquot *dqp;
899 dqp = xfs_qm_dqget_cache_lookup(mp, qi, tree, id);
900 if (dqp) {
901 *O_dqpp = dqp;
905 error = xfs_qm_dqread(mp, id, type, can_alloc, &dqp);
909 error = xfs_qm_dqget_cache_insert(mp, qi, tree, id, dqp);
915 xfs_qm_dqdestroy(dqp);
920 trace_xfs_dqget_miss(dqp);
921 *O_dqpp = dqp;
980 struct xfs_dquot *dqp;
994 dqp = xfs_qm_dqget_cache_lookup(mp, qi, tree, id);
995 if (dqp) {
996 *O_dqpp = dqp;
1008 error = xfs_qm_dqread(mp, id, type, can_alloc, &dqp);
1022 xfs_qm_dqdestroy(dqp);
1023 dqp = dqp1;
1024 xfs_dqlock(dqp);
1029 xfs_qm_dqdestroy(dqp);
1033 error = xfs_qm_dqget_cache_insert(mp, qi, tree, id, dqp);
1039 xfs_qm_dqdestroy(dqp);
1046 trace_xfs_dqget_miss(dqp);
1047 *O_dqpp = dqp;
1062 struct xfs_dquot *dqp;
1067 error = xfs_qm_dqget(mp, id, type, false, &dqp);
1073 if (!XFS_IS_DQUOT_UNINITIALIZED(dqp)) {
1074 *dqpp = dqp;
1078 xfs_qm_dqput(dqp);
1092 struct xfs_dquot *dqp)
1094 ASSERT(dqp->q_nrefs > 0);
1095 ASSERT(XFS_DQ_IS_LOCKED(dqp));
1097 trace_xfs_dqput(dqp);
1099 if (--dqp->q_nrefs == 0) {
1100 struct xfs_quotainfo *qi = dqp->q_mount->m_quotainfo;
1101 trace_xfs_dqput_free(dqp);
1103 if (list_lru_add_obj(&qi->qi_lru, &dqp->q_lru))
1104 XFS_STATS_INC(dqp->q_mount, xs_qm_dquot_unused);
1106 xfs_dqunlock(dqp);
1115 struct xfs_dquot *dqp)
1117 if (!dqp)
1120 trace_xfs_dqrele(dqp);
1122 xfs_dqlock(dqp);
1129 xfs_qm_dqput(dqp);
1144 struct xfs_dquot *dqp = qip->qli_dquot;
1174 xfs_dqfunlock(dqp);
1204 struct xfs_dquot *dqp)
1206 xfs_dqtype_t type = xfs_dquot_type(dqp);
1213 if (dqp->q_id == 0)
1216 if (dqp->q_blk.softlimit && dqp->q_blk.count > dqp->q_blk.softlimit &&
1217 !dqp->q_blk.timer)
1220 if (dqp->q_ino.softlimit && dqp->q_ino.count > dqp->q_ino.softlimit &&
1221 !dqp->q_ino.timer)
1224 if (dqp->q_rtb.softlimit && dqp->q_rtb.count > dqp->q_rtb.softlimit &&
1225 !dqp->q_rtb.timer)
1229 if (dqp->q_type & XFS_DQTYPE_BIGTIME) {
1230 if (!xfs_has_bigtime(dqp->q_mount))
1232 if (dqp->q_id == 0)
1249 struct xfs_dquot *dqp,
1252 struct xfs_mount *mp = dqp->q_mount;
1253 struct xfs_log_item *lip = &dqp->q_logitem.qli_item;
1259 ASSERT(XFS_DQ_IS_LOCKED(dqp));
1260 ASSERT(!completion_done(&dqp->q_flush));
1262 trace_xfs_dqflush(dqp);
1266 xfs_qm_dqunpin_wait(dqp);
1271 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno,
1277 xfs_dquot_mark_sick(dqp);
1281 fa = xfs_qm_dqflush_check(dqp);
1284 dqp->q_id, fa);
1286 xfs_dquot_mark_sick(dqp);
1292 dqblk = xfs_buf_offset(bp, dqp->q_bufoffset);
1293 xfs_dquot_to_disk(&dqblk->dd_diskdq, dqp);
1298 dqp->q_flags &= ~XFS_DQFLAG_DIRTY;
1300 xfs_trans_ail_copy_lsn(mp->m_ail, &dqp->q_logitem.qli_flush_lsn,
1301 &dqp->q_logitem.qli_item.li_lsn);
1313 dqblk->dd_lsn = cpu_to_be64(dqp->q_logitem.qli_item.li_lsn);
1323 list_add_tail(&dqp->q_logitem.qli_item.li_bio_list, &bp->b_li_list);
1330 trace_xfs_dqflush_force(dqp);
1334 trace_xfs_dqflush_done(dqp);
1339 dqp->q_flags &= ~XFS_DQFLAG_DIRTY;
1343 xfs_dqfunlock(dqp);