• Home
  • Raw
  • Download

Lines Matching refs:dqp

52 	struct xfs_dquot	*dqp)  in xfs_qm_dqdestroy()  argument
54 ASSERT(list_empty(&dqp->q_lru)); in xfs_qm_dqdestroy()
56 kmem_free(dqp->q_logitem.qli_item.li_lv_shadow); in xfs_qm_dqdestroy()
57 mutex_destroy(&dqp->q_qlock); in xfs_qm_dqdestroy()
59 XFS_STATS_DEC(dqp->q_mount, xs_qm_dquot); in xfs_qm_dqdestroy()
60 kmem_cache_free(xfs_qm_dqzone, dqp); in xfs_qm_dqdestroy()
265 xfs_dquot_set_prealloc_limits(struct xfs_dquot *dqp) in xfs_dquot_set_prealloc_limits() argument
269 dqp->q_prealloc_hi_wmark = dqp->q_blk.hardlimit; in xfs_dquot_set_prealloc_limits()
270 dqp->q_prealloc_lo_wmark = dqp->q_blk.softlimit; in xfs_dquot_set_prealloc_limits()
271 if (!dqp->q_prealloc_lo_wmark) { in xfs_dquot_set_prealloc_limits()
272 dqp->q_prealloc_lo_wmark = dqp->q_prealloc_hi_wmark; in xfs_dquot_set_prealloc_limits()
273 do_div(dqp->q_prealloc_lo_wmark, 100); in xfs_dquot_set_prealloc_limits()
274 dqp->q_prealloc_lo_wmark *= 95; in xfs_dquot_set_prealloc_limits()
277 space = dqp->q_prealloc_hi_wmark; in xfs_dquot_set_prealloc_limits()
280 dqp->q_low_space[XFS_QLOWSP_1_PCNT] = space; in xfs_dquot_set_prealloc_limits()
281 dqp->q_low_space[XFS_QLOWSP_3_PCNT] = space * 3; in xfs_dquot_set_prealloc_limits()
282 dqp->q_low_space[XFS_QLOWSP_5_PCNT] = space * 5; in xfs_dquot_set_prealloc_limits()
293 struct xfs_dquot *dqp, in xfs_dquot_disk_alloc() argument
300 xfs_dqtype_t qtype = xfs_dquot_type(dqp); in xfs_dquot_disk_alloc()
305 trace_xfs_dqalloc(dqp); in xfs_dquot_disk_alloc()
308 if (!xfs_this_quota_on(dqp->q_mount, qtype)) { in xfs_dquot_disk_alloc()
319 error = xfs_bmapi_write(tp, quotip, dqp->q_fileoffset, in xfs_dquot_disk_alloc()
332 dqp->q_blkno = XFS_FSB_TO_DADDR(mp, map.br_startblock); in xfs_dquot_disk_alloc()
335 error = xfs_trans_get_buf(tp, mp->m_ddev_targp, dqp->q_blkno, in xfs_dquot_disk_alloc()
345 xfs_qm_init_dquot_blk(tp, mp, dqp->q_id, qtype, bp); in xfs_dquot_disk_alloc()
387 struct xfs_dquot *dqp, in xfs_dquot_disk_read() argument
392 xfs_dqtype_t qtype = xfs_dquot_type(dqp); in xfs_dquot_disk_read()
411 error = xfs_bmapi_read(quotip, dqp->q_fileoffset, in xfs_dquot_disk_read()
423 trace_xfs_dqtobp_read(dqp); in xfs_dquot_disk_read()
429 dqp->q_blkno = XFS_FSB_TO_DADDR(mp, map.br_startblock); in xfs_dquot_disk_read()
431 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno, in xfs_dquot_disk_read()
453 struct xfs_dquot *dqp; in xfs_dquot_alloc() local
455 dqp = kmem_cache_zalloc(xfs_qm_dqzone, GFP_KERNEL | __GFP_NOFAIL); in xfs_dquot_alloc()
457 dqp->q_type = type; in xfs_dquot_alloc()
458 dqp->q_id = id; in xfs_dquot_alloc()
459 dqp->q_mount = mp; in xfs_dquot_alloc()
460 INIT_LIST_HEAD(&dqp->q_lru); in xfs_dquot_alloc()
461 mutex_init(&dqp->q_qlock); in xfs_dquot_alloc()
462 init_waitqueue_head(&dqp->q_pinwait); in xfs_dquot_alloc()
463 dqp->q_fileoffset = (xfs_fileoff_t)id / mp->m_quotainfo->qi_dqperchunk; in xfs_dquot_alloc()
467 dqp->q_bufoffset = (id % mp->m_quotainfo->qi_dqperchunk) * in xfs_dquot_alloc()
475 init_completion(&dqp->q_flush); in xfs_dquot_alloc()
476 complete(&dqp->q_flush); in xfs_dquot_alloc()
487 lockdep_set_class(&dqp->q_qlock, &xfs_dquot_group_class); in xfs_dquot_alloc()
490 lockdep_set_class(&dqp->q_qlock, &xfs_dquot_project_class); in xfs_dquot_alloc()
497 xfs_qm_dquot_logitem_init(dqp); in xfs_dquot_alloc()
500 return dqp; in xfs_dquot_alloc()
506 struct xfs_dquot *dqp, in xfs_dquot_check_type() argument
513 dqp_type = xfs_dquot_type(dqp); in xfs_dquot_check_type()
515 if (be32_to_cpu(ddqp->d_id) != dqp->q_id) in xfs_dquot_check_type()
523 if (xfs_sb_version_hascrc(&dqp->q_mount->m_sb) || in xfs_dquot_check_type()
524 dqp_type == XFS_DQTYPE_USER || dqp->q_id != 0) in xfs_dquot_check_type()
542 struct xfs_dquot *dqp, in xfs_dquot_from_disk() argument
545 struct xfs_disk_dquot *ddqp = bp->b_addr + dqp->q_bufoffset; in xfs_dquot_from_disk()
551 if (!xfs_dquot_check_type(dqp, ddqp)) { in xfs_dquot_from_disk()
554 __this_address, dqp->q_id); in xfs_dquot_from_disk()
560 dqp->q_type = ddqp->d_type; in xfs_dquot_from_disk()
561 dqp->q_blk.hardlimit = be64_to_cpu(ddqp->d_blk_hardlimit); in xfs_dquot_from_disk()
562 dqp->q_blk.softlimit = be64_to_cpu(ddqp->d_blk_softlimit); in xfs_dquot_from_disk()
563 dqp->q_ino.hardlimit = be64_to_cpu(ddqp->d_ino_hardlimit); in xfs_dquot_from_disk()
564 dqp->q_ino.softlimit = be64_to_cpu(ddqp->d_ino_softlimit); in xfs_dquot_from_disk()
565 dqp->q_rtb.hardlimit = be64_to_cpu(ddqp->d_rtb_hardlimit); in xfs_dquot_from_disk()
566 dqp->q_rtb.softlimit = be64_to_cpu(ddqp->d_rtb_softlimit); in xfs_dquot_from_disk()
568 dqp->q_blk.count = be64_to_cpu(ddqp->d_bcount); in xfs_dquot_from_disk()
569 dqp->q_ino.count = be64_to_cpu(ddqp->d_icount); in xfs_dquot_from_disk()
570 dqp->q_rtb.count = be64_to_cpu(ddqp->d_rtbcount); in xfs_dquot_from_disk()
572 dqp->q_blk.warnings = be16_to_cpu(ddqp->d_bwarns); in xfs_dquot_from_disk()
573 dqp->q_ino.warnings = be16_to_cpu(ddqp->d_iwarns); in xfs_dquot_from_disk()
574 dqp->q_rtb.warnings = be16_to_cpu(ddqp->d_rtbwarns); in xfs_dquot_from_disk()
576 dqp->q_blk.timer = xfs_dquot_from_disk_ts(ddqp, ddqp->d_btimer); in xfs_dquot_from_disk()
577 dqp->q_ino.timer = xfs_dquot_from_disk_ts(ddqp, ddqp->d_itimer); in xfs_dquot_from_disk()
578 dqp->q_rtb.timer = xfs_dquot_from_disk_ts(ddqp, ddqp->d_rtbtimer); in xfs_dquot_from_disk()
584 dqp->q_blk.reserved = dqp->q_blk.count; in xfs_dquot_from_disk()
585 dqp->q_ino.reserved = dqp->q_ino.count; in xfs_dquot_from_disk()
586 dqp->q_rtb.reserved = dqp->q_rtb.count; in xfs_dquot_from_disk()
589 xfs_dquot_set_prealloc_limits(dqp); in xfs_dquot_from_disk()
597 struct xfs_dquot *dqp) in xfs_dquot_to_disk() argument
601 ddqp->d_type = dqp->q_type; in xfs_dquot_to_disk()
602 ddqp->d_id = cpu_to_be32(dqp->q_id); in xfs_dquot_to_disk()
606 ddqp->d_blk_hardlimit = cpu_to_be64(dqp->q_blk.hardlimit); in xfs_dquot_to_disk()
607 ddqp->d_blk_softlimit = cpu_to_be64(dqp->q_blk.softlimit); in xfs_dquot_to_disk()
608 ddqp->d_ino_hardlimit = cpu_to_be64(dqp->q_ino.hardlimit); in xfs_dquot_to_disk()
609 ddqp->d_ino_softlimit = cpu_to_be64(dqp->q_ino.softlimit); in xfs_dquot_to_disk()
610 ddqp->d_rtb_hardlimit = cpu_to_be64(dqp->q_rtb.hardlimit); in xfs_dquot_to_disk()
611 ddqp->d_rtb_softlimit = cpu_to_be64(dqp->q_rtb.softlimit); in xfs_dquot_to_disk()
613 ddqp->d_bcount = cpu_to_be64(dqp->q_blk.count); in xfs_dquot_to_disk()
614 ddqp->d_icount = cpu_to_be64(dqp->q_ino.count); in xfs_dquot_to_disk()
615 ddqp->d_rtbcount = cpu_to_be64(dqp->q_rtb.count); in xfs_dquot_to_disk()
617 ddqp->d_bwarns = cpu_to_be16(dqp->q_blk.warnings); in xfs_dquot_to_disk()
618 ddqp->d_iwarns = cpu_to_be16(dqp->q_ino.warnings); in xfs_dquot_to_disk()
619 ddqp->d_rtbwarns = cpu_to_be16(dqp->q_rtb.warnings); in xfs_dquot_to_disk()
621 ddqp->d_btimer = xfs_dquot_to_disk_ts(dqp, dqp->q_blk.timer); in xfs_dquot_to_disk()
622 ddqp->d_itimer = xfs_dquot_to_disk_ts(dqp, dqp->q_ino.timer); in xfs_dquot_to_disk()
623 ddqp->d_rtbtimer = xfs_dquot_to_disk_ts(dqp, dqp->q_rtb.timer); in xfs_dquot_to_disk()
630 struct xfs_dquot *dqp, in xfs_qm_dqread_alloc() argument
641 error = xfs_dquot_disk_alloc(&tp, dqp, bpp); in xfs_qm_dqread_alloc()
676 struct xfs_dquot *dqp; in xfs_qm_dqread() local
680 dqp = xfs_dquot_alloc(mp, id, type); in xfs_qm_dqread()
681 trace_xfs_dqread(dqp); in xfs_qm_dqread()
684 error = xfs_dquot_disk_read(mp, dqp, &bp); in xfs_qm_dqread()
686 error = xfs_qm_dqread_alloc(mp, dqp, &bp); in xfs_qm_dqread()
697 error = xfs_dquot_from_disk(dqp, bp); in xfs_qm_dqread()
702 *dqpp = dqp; in xfs_qm_dqread()
706 trace_xfs_dqread_fail(dqp); in xfs_qm_dqread()
707 xfs_qm_dqdestroy(dqp); in xfs_qm_dqread()
776 struct xfs_dquot *dqp; in xfs_qm_dqget_cache_lookup() local
780 dqp = radix_tree_lookup(tree, id); in xfs_qm_dqget_cache_lookup()
781 if (!dqp) { in xfs_qm_dqget_cache_lookup()
787 xfs_dqlock(dqp); in xfs_qm_dqget_cache_lookup()
788 if (dqp->q_flags & XFS_DQFLAG_FREEING) { in xfs_qm_dqget_cache_lookup()
789 xfs_dqunlock(dqp); in xfs_qm_dqget_cache_lookup()
791 trace_xfs_dqget_freeing(dqp); in xfs_qm_dqget_cache_lookup()
796 dqp->q_nrefs++; in xfs_qm_dqget_cache_lookup()
799 trace_xfs_dqget_hit(dqp); in xfs_qm_dqget_cache_lookup()
801 return dqp; in xfs_qm_dqget_cache_lookup()
816 struct xfs_dquot *dqp) in xfs_qm_dqget_cache_insert() argument
821 error = radix_tree_insert(tree, id, dqp); in xfs_qm_dqget_cache_insert()
826 trace_xfs_dqget_dup(dqp); in xfs_qm_dqget_cache_insert()
831 xfs_dqlock(dqp); in xfs_qm_dqget_cache_insert()
832 dqp->q_nrefs = 1; in xfs_qm_dqget_cache_insert()
882 struct xfs_dquot *dqp; in xfs_qm_dqget() local
890 dqp = xfs_qm_dqget_cache_lookup(mp, qi, tree, id); in xfs_qm_dqget()
891 if (dqp) { in xfs_qm_dqget()
892 *O_dqpp = dqp; in xfs_qm_dqget()
896 error = xfs_qm_dqread(mp, id, type, can_alloc, &dqp); in xfs_qm_dqget()
900 error = xfs_qm_dqget_cache_insert(mp, qi, tree, id, dqp); in xfs_qm_dqget()
906 xfs_qm_dqdestroy(dqp); in xfs_qm_dqget()
911 trace_xfs_dqget_miss(dqp); in xfs_qm_dqget()
912 *O_dqpp = dqp; in xfs_qm_dqget()
971 struct xfs_dquot *dqp; in xfs_qm_dqget_inode() local
985 dqp = xfs_qm_dqget_cache_lookup(mp, qi, tree, id); in xfs_qm_dqget_inode()
986 if (dqp) { in xfs_qm_dqget_inode()
987 *O_dqpp = dqp; in xfs_qm_dqget_inode()
999 error = xfs_qm_dqread(mp, id, type, can_alloc, &dqp); in xfs_qm_dqget_inode()
1013 xfs_qm_dqdestroy(dqp); in xfs_qm_dqget_inode()
1014 dqp = dqp1; in xfs_qm_dqget_inode()
1015 xfs_dqlock(dqp); in xfs_qm_dqget_inode()
1020 xfs_qm_dqdestroy(dqp); in xfs_qm_dqget_inode()
1024 error = xfs_qm_dqget_cache_insert(mp, qi, tree, id, dqp); in xfs_qm_dqget_inode()
1030 xfs_qm_dqdestroy(dqp); in xfs_qm_dqget_inode()
1037 trace_xfs_dqget_miss(dqp); in xfs_qm_dqget_inode()
1038 *O_dqpp = dqp; in xfs_qm_dqget_inode()
1053 struct xfs_dquot *dqp; in xfs_qm_dqget_next() local
1058 error = xfs_qm_dqget(mp, id, type, false, &dqp); in xfs_qm_dqget_next()
1064 if (!XFS_IS_DQUOT_UNINITIALIZED(dqp)) { in xfs_qm_dqget_next()
1065 *dqpp = dqp; in xfs_qm_dqget_next()
1069 xfs_qm_dqput(dqp); in xfs_qm_dqget_next()
1083 struct xfs_dquot *dqp) in xfs_qm_dqput() argument
1085 ASSERT(dqp->q_nrefs > 0); in xfs_qm_dqput()
1086 ASSERT(XFS_DQ_IS_LOCKED(dqp)); in xfs_qm_dqput()
1088 trace_xfs_dqput(dqp); in xfs_qm_dqput()
1090 if (--dqp->q_nrefs == 0) { in xfs_qm_dqput()
1091 struct xfs_quotainfo *qi = dqp->q_mount->m_quotainfo; in xfs_qm_dqput()
1092 trace_xfs_dqput_free(dqp); in xfs_qm_dqput()
1094 if (list_lru_add(&qi->qi_lru, &dqp->q_lru)) in xfs_qm_dqput()
1095 XFS_STATS_INC(dqp->q_mount, xs_qm_dquot_unused); in xfs_qm_dqput()
1097 xfs_dqunlock(dqp); in xfs_qm_dqput()
1106 struct xfs_dquot *dqp) in xfs_qm_dqrele() argument
1108 if (!dqp) in xfs_qm_dqrele()
1111 trace_xfs_dqrele(dqp); in xfs_qm_dqrele()
1113 xfs_dqlock(dqp); in xfs_qm_dqrele()
1120 xfs_qm_dqput(dqp); in xfs_qm_dqrele()
1135 struct xfs_dquot *dqp = qip->qli_dquot; in xfs_qm_dqflush_done() local
1165 xfs_dqfunlock(dqp); in xfs_qm_dqflush_done()
1195 struct xfs_dquot *dqp) in xfs_qm_dqflush_check() argument
1197 xfs_dqtype_t type = xfs_dquot_type(dqp); in xfs_qm_dqflush_check()
1204 if (dqp->q_id == 0) in xfs_qm_dqflush_check()
1207 if (dqp->q_blk.softlimit && dqp->q_blk.count > dqp->q_blk.softlimit && in xfs_qm_dqflush_check()
1208 !dqp->q_blk.timer) in xfs_qm_dqflush_check()
1211 if (dqp->q_ino.softlimit && dqp->q_ino.count > dqp->q_ino.softlimit && in xfs_qm_dqflush_check()
1212 !dqp->q_ino.timer) in xfs_qm_dqflush_check()
1215 if (dqp->q_rtb.softlimit && dqp->q_rtb.count > dqp->q_rtb.softlimit && in xfs_qm_dqflush_check()
1216 !dqp->q_rtb.timer) in xfs_qm_dqflush_check()
1220 if (dqp->q_type & XFS_DQTYPE_BIGTIME) { in xfs_qm_dqflush_check()
1221 if (!xfs_sb_version_hasbigtime(&dqp->q_mount->m_sb)) in xfs_qm_dqflush_check()
1223 if (dqp->q_id == 0) in xfs_qm_dqflush_check()
1240 struct xfs_dquot *dqp, in xfs_qm_dqflush() argument
1243 struct xfs_mount *mp = dqp->q_mount; in xfs_qm_dqflush()
1244 struct xfs_log_item *lip = &dqp->q_logitem.qli_item; in xfs_qm_dqflush()
1250 ASSERT(XFS_DQ_IS_LOCKED(dqp)); in xfs_qm_dqflush()
1251 ASSERT(!completion_done(&dqp->q_flush)); in xfs_qm_dqflush()
1253 trace_xfs_dqflush(dqp); in xfs_qm_dqflush()
1257 xfs_qm_dqunpin_wait(dqp); in xfs_qm_dqflush()
1262 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno, in xfs_qm_dqflush()
1270 fa = xfs_qm_dqflush_check(dqp); in xfs_qm_dqflush()
1273 dqp->q_id, fa); in xfs_qm_dqflush()
1280 dqblk = bp->b_addr + dqp->q_bufoffset; in xfs_qm_dqflush()
1281 xfs_dquot_to_disk(&dqblk->dd_diskdq, dqp); in xfs_qm_dqflush()
1286 dqp->q_flags &= ~XFS_DQFLAG_DIRTY; in xfs_qm_dqflush()
1288 xfs_trans_ail_copy_lsn(mp->m_ail, &dqp->q_logitem.qli_flush_lsn, in xfs_qm_dqflush()
1289 &dqp->q_logitem.qli_item.li_lsn); in xfs_qm_dqflush()
1301 dqblk->dd_lsn = cpu_to_be64(dqp->q_logitem.qli_item.li_lsn); in xfs_qm_dqflush()
1311 list_add_tail(&dqp->q_logitem.qli_item.li_bio_list, &bp->b_li_list); in xfs_qm_dqflush()
1318 trace_xfs_dqflush_force(dqp); in xfs_qm_dqflush()
1322 trace_xfs_dqflush_done(dqp); in xfs_qm_dqflush()
1327 dqp->q_flags &= ~XFS_DQFLAG_DIRTY; in xfs_qm_dqflush()
1331 xfs_dqfunlock(dqp); in xfs_qm_dqflush()