Lines Matching refs:mp
36 STATIC int xfs_qm_init_quotainos(struct xfs_mount *mp);
37 STATIC int xfs_qm_init_quotainfo(struct xfs_mount *mp);
52 struct xfs_mount *mp, in xfs_qm_dquot_walk() argument
57 struct xfs_quotainfo *qi = mp->m_quotainfo; in xfs_qm_dquot_walk()
190 struct xfs_mount *mp) in xfs_qm_dqpurge_all() argument
192 xfs_qm_dquot_walk(mp, XFS_DQTYPE_USER, xfs_qm_dqpurge, NULL); in xfs_qm_dqpurge_all()
193 xfs_qm_dquot_walk(mp, XFS_DQTYPE_GROUP, xfs_qm_dqpurge, NULL); in xfs_qm_dqpurge_all()
194 xfs_qm_dquot_walk(mp, XFS_DQTYPE_PROJ, xfs_qm_dqpurge, NULL); in xfs_qm_dqpurge_all()
202 struct xfs_mount *mp) in xfs_qm_unmount() argument
204 if (mp->m_quotainfo) { in xfs_qm_unmount()
205 xfs_qm_dqpurge_all(mp); in xfs_qm_unmount()
206 xfs_qm_destroy_quotainfo(mp); in xfs_qm_unmount()
215 xfs_mount_t *mp) in xfs_qm_unmount_quotas() argument
221 ASSERT(mp->m_rootip); in xfs_qm_unmount_quotas()
222 xfs_qm_dqdetach(mp->m_rootip); in xfs_qm_unmount_quotas()
223 if (mp->m_rbmip) in xfs_qm_unmount_quotas()
224 xfs_qm_dqdetach(mp->m_rbmip); in xfs_qm_unmount_quotas()
225 if (mp->m_rsumip) in xfs_qm_unmount_quotas()
226 xfs_qm_dqdetach(mp->m_rsumip); in xfs_qm_unmount_quotas()
231 if (mp->m_quotainfo) { in xfs_qm_unmount_quotas()
232 if (mp->m_quotainfo->qi_uquotaip) { in xfs_qm_unmount_quotas()
233 xfs_irele(mp->m_quotainfo->qi_uquotaip); in xfs_qm_unmount_quotas()
234 mp->m_quotainfo->qi_uquotaip = NULL; in xfs_qm_unmount_quotas()
236 if (mp->m_quotainfo->qi_gquotaip) { in xfs_qm_unmount_quotas()
237 xfs_irele(mp->m_quotainfo->qi_gquotaip); in xfs_qm_unmount_quotas()
238 mp->m_quotainfo->qi_gquotaip = NULL; in xfs_qm_unmount_quotas()
240 if (mp->m_quotainfo->qi_pquotaip) { in xfs_qm_unmount_quotas()
241 xfs_irele(mp->m_quotainfo->qi_pquotaip); in xfs_qm_unmount_quotas()
242 mp->m_quotainfo->qi_pquotaip = NULL; in xfs_qm_unmount_quotas()
296 struct xfs_mount *mp = ip->i_mount; in xfs_qm_need_dqattach() local
298 if (!XFS_IS_QUOTA_ON(mp)) in xfs_qm_need_dqattach()
300 if (!XFS_NOT_DQATTACHED(mp, ip)) in xfs_qm_need_dqattach()
302 if (xfs_is_quota_inode(&mp->m_sb, ip->i_ino)) in xfs_qm_need_dqattach()
319 xfs_mount_t *mp = ip->i_mount; in xfs_qm_dqattach_locked() local
327 if (XFS_IS_UQUOTA_ON(mp) && !ip->i_udquot) { in xfs_qm_dqattach_locked()
335 if (XFS_IS_GQUOTA_ON(mp) && !ip->i_gdquot) { in xfs_qm_dqattach_locked()
343 if (XFS_IS_PQUOTA_ON(mp) && !ip->i_pdquot) { in xfs_qm_dqattach_locked()
550 struct xfs_mount *mp, in xfs_qm_set_defquota() argument
558 error = xfs_qm_dqget_uncached(mp, 0, type, &dqp); in xfs_qm_set_defquota()
580 struct xfs_mount *mp, in xfs_qm_init_timelimits() argument
583 struct xfs_quotainfo *qinf = mp->m_quotainfo; in xfs_qm_init_timelimits()
601 error = xfs_qm_dqget_uncached(mp, 0, type, &dqp); in xfs_qm_init_timelimits()
626 struct xfs_mount *mp) in xfs_qm_init_quotainfo() argument
631 ASSERT(XFS_IS_QUOTA_ON(mp)); in xfs_qm_init_quotainfo()
633 qinf = mp->m_quotainfo = kmem_zalloc(sizeof(struct xfs_quotainfo), 0); in xfs_qm_init_quotainfo()
643 error = xfs_qm_init_quotainos(mp); in xfs_qm_init_quotainfo()
656 qinf->qi_dqchunklen = XFS_FSB_TO_BB(mp, XFS_DQUOT_CLUSTER_SIZE_FSB); in xfs_qm_init_quotainfo()
658 if (xfs_has_bigtime(mp)) { in xfs_qm_init_quotainfo()
667 trace_xfs_quota_expiry_range(mp, qinf->qi_expiry_min, in xfs_qm_init_quotainfo()
670 mp->m_qflags |= (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_CHKD); in xfs_qm_init_quotainfo()
672 xfs_qm_init_timelimits(mp, XFS_DQTYPE_USER); in xfs_qm_init_quotainfo()
673 xfs_qm_init_timelimits(mp, XFS_DQTYPE_GROUP); in xfs_qm_init_quotainfo()
674 xfs_qm_init_timelimits(mp, XFS_DQTYPE_PROJ); in xfs_qm_init_quotainfo()
676 if (XFS_IS_UQUOTA_ON(mp)) in xfs_qm_init_quotainfo()
677 xfs_qm_set_defquota(mp, XFS_DQTYPE_USER, qinf); in xfs_qm_init_quotainfo()
678 if (XFS_IS_GQUOTA_ON(mp)) in xfs_qm_init_quotainfo()
679 xfs_qm_set_defquota(mp, XFS_DQTYPE_GROUP, qinf); in xfs_qm_init_quotainfo()
680 if (XFS_IS_PQUOTA_ON(mp)) in xfs_qm_init_quotainfo()
681 xfs_qm_set_defquota(mp, XFS_DQTYPE_PROJ, qinf); in xfs_qm_init_quotainfo()
689 mp->m_super->s_id); in xfs_qm_init_quotainfo()
703 mp->m_quotainfo = NULL; in xfs_qm_init_quotainfo()
714 struct xfs_mount *mp) in xfs_qm_destroy_quotainfo() argument
718 qi = mp->m_quotainfo; in xfs_qm_destroy_quotainfo()
727 mp->m_quotainfo = NULL; in xfs_qm_destroy_quotainfo()
736 struct xfs_mount *mp, in xfs_qm_qino_alloc() argument
752 if (!xfs_has_pquotino(mp) && in xfs_qm_qino_alloc()
757 (mp->m_sb.sb_gquotino != NULLFSINO)) { in xfs_qm_qino_alloc()
758 ino = mp->m_sb.sb_gquotino; in xfs_qm_qino_alloc()
759 if (XFS_IS_CORRUPT(mp, in xfs_qm_qino_alloc()
760 mp->m_sb.sb_pquotino != NULLFSINO)) in xfs_qm_qino_alloc()
763 (mp->m_sb.sb_pquotino != NULLFSINO)) { in xfs_qm_qino_alloc()
764 ino = mp->m_sb.sb_pquotino; in xfs_qm_qino_alloc()
765 if (XFS_IS_CORRUPT(mp, in xfs_qm_qino_alloc()
766 mp->m_sb.sb_gquotino != NULLFSINO)) in xfs_qm_qino_alloc()
770 error = xfs_iget(mp, NULL, ino, 0, 0, ipp); in xfs_qm_qino_alloc()
773 mp->m_sb.sb_gquotino = NULLFSINO; in xfs_qm_qino_alloc()
774 mp->m_sb.sb_pquotino = NULLFSINO; in xfs_qm_qino_alloc()
779 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_create, in xfs_qm_qino_alloc()
780 need_alloc ? XFS_QM_QINOCREATE_SPACE_RES(mp) : 0, in xfs_qm_qino_alloc()
803 spin_lock(&mp->m_sb_lock); in xfs_qm_qino_alloc()
805 ASSERT(!xfs_has_quota(mp)); in xfs_qm_qino_alloc()
807 xfs_add_quota(mp); in xfs_qm_qino_alloc()
808 mp->m_sb.sb_uquotino = NULLFSINO; in xfs_qm_qino_alloc()
809 mp->m_sb.sb_gquotino = NULLFSINO; in xfs_qm_qino_alloc()
810 mp->m_sb.sb_pquotino = NULLFSINO; in xfs_qm_qino_alloc()
813 mp->m_sb.sb_qflags = mp->m_qflags & XFS_ALL_QUOTA_ACCT; in xfs_qm_qino_alloc()
816 mp->m_sb.sb_uquotino = (*ipp)->i_ino; in xfs_qm_qino_alloc()
818 mp->m_sb.sb_gquotino = (*ipp)->i_ino; in xfs_qm_qino_alloc()
820 mp->m_sb.sb_pquotino = (*ipp)->i_ino; in xfs_qm_qino_alloc()
821 spin_unlock(&mp->m_sb_lock); in xfs_qm_qino_alloc()
826 ASSERT(xfs_is_shutdown(mp)); in xfs_qm_qino_alloc()
827 xfs_alert(mp, "%s failed (error %d)!", __func__, error); in xfs_qm_qino_alloc()
837 struct xfs_mount *mp, in xfs_qm_reset_dqcounts() argument
852 j = (int)XFS_FSB_TO_B(mp, XFS_DQUOT_CLUSTER_SIZE_FSB) / in xfs_qm_reset_dqcounts()
854 ASSERT(mp->m_quotainfo->qi_dqperchunk == j); in xfs_qm_reset_dqcounts()
857 for (j = 0; j < mp->m_quotainfo->qi_dqperchunk; j++) { in xfs_qm_reset_dqcounts()
868 if (xfs_dqblk_verify(mp, &dqb[j], id + j) || in xfs_qm_reset_dqcounts()
870 xfs_dqblk_repair(mp, &dqb[j], id + j, type); in xfs_qm_reset_dqcounts()
893 if (xfs_has_bigtime(mp)) in xfs_qm_reset_dqcounts()
897 if (xfs_has_crc(mp)) { in xfs_qm_reset_dqcounts()
907 struct xfs_mount *mp, in xfs_qm_reset_dqcounts_all() argument
929 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, in xfs_qm_reset_dqcounts_all()
930 XFS_FSB_TO_DADDR(mp, bno), in xfs_qm_reset_dqcounts_all()
931 mp->m_quotainfo->qi_dqchunklen, 0, &bp, in xfs_qm_reset_dqcounts_all()
942 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, in xfs_qm_reset_dqcounts_all()
943 XFS_FSB_TO_DADDR(mp, bno), in xfs_qm_reset_dqcounts_all()
944 mp->m_quotainfo->qi_dqchunklen, 0, &bp, in xfs_qm_reset_dqcounts_all()
957 xfs_qm_reset_dqcounts(mp, bp, firstid, type); in xfs_qm_reset_dqcounts_all()
963 firstid += mp->m_quotainfo->qi_dqperchunk; in xfs_qm_reset_dqcounts_all()
975 struct xfs_mount *mp, in xfs_qm_reset_dqcounts_buf() argument
1001 maxlblkcnt = XFS_B_TO_FSB(mp, mp->m_super->s_maxbytes); in xfs_qm_reset_dqcounts_buf()
1030 mp->m_quotainfo->qi_dqperchunk; in xfs_qm_reset_dqcounts_buf()
1039 xfs_buf_readahead(mp->m_ddev_targp, in xfs_qm_reset_dqcounts_buf()
1040 XFS_FSB_TO_DADDR(mp, rablkno), in xfs_qm_reset_dqcounts_buf()
1041 mp->m_quotainfo->qi_dqchunklen, in xfs_qm_reset_dqcounts_buf()
1050 error = xfs_qm_reset_dqcounts_all(mp, firstid, in xfs_qm_reset_dqcounts_buf()
1079 struct xfs_mount *mp = ip->i_mount; in xfs_qm_quotacheck_dqadjust() local
1085 error = xfs_qm_dqget(mp, id, type, true, &dqp); in xfs_qm_quotacheck_dqadjust()
1134 struct xfs_mount *mp, in xfs_qm_dqusage_adjust() argument
1144 ASSERT(XFS_IS_QUOTA_ON(mp)); in xfs_qm_dqusage_adjust()
1150 if (xfs_is_quota_inode(&mp->m_sb, ino)) in xfs_qm_dqusage_adjust()
1157 error = xfs_iget(mp, tp, ino, XFS_IGET_DONTCACHE, 0, &ip); in xfs_qm_dqusage_adjust()
1171 xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); in xfs_qm_dqusage_adjust()
1203 if (XFS_IS_UQUOTA_ON(mp)) { in xfs_qm_dqusage_adjust()
1210 if (XFS_IS_GQUOTA_ON(mp)) { in xfs_qm_dqusage_adjust()
1217 if (XFS_IS_PQUOTA_ON(mp)) { in xfs_qm_dqusage_adjust()
1234 struct xfs_mount *mp = dqp->q_mount; in xfs_qm_flush_one() local
1255 error = xfs_buf_incore(mp->m_ddev_targp, dqp->q_blkno, in xfs_qm_flush_one()
1256 mp->m_quotainfo->qi_dqchunklen, 0, &bp); in xfs_qm_flush_one()
1291 xfs_mount_t *mp) in xfs_qm_quotacheck() argument
1296 struct xfs_inode *uip = mp->m_quotainfo->qi_uquotaip; in xfs_qm_quotacheck()
1297 struct xfs_inode *gip = mp->m_quotainfo->qi_gquotaip; in xfs_qm_quotacheck()
1298 struct xfs_inode *pip = mp->m_quotainfo->qi_pquotaip; in xfs_qm_quotacheck()
1303 ASSERT(XFS_IS_QUOTA_ON(mp)); in xfs_qm_quotacheck()
1305 xfs_notice(mp, "Quotacheck needed: Please wait."); in xfs_qm_quotacheck()
1313 error = xfs_qm_reset_dqcounts_buf(mp, uip, XFS_DQTYPE_USER, in xfs_qm_quotacheck()
1321 error = xfs_qm_reset_dqcounts_buf(mp, gip, XFS_DQTYPE_GROUP, in xfs_qm_quotacheck()
1329 error = xfs_qm_reset_dqcounts_buf(mp, pip, XFS_DQTYPE_PROJ, in xfs_qm_quotacheck()
1336 xfs_set_quotacheck_running(mp); in xfs_qm_quotacheck()
1337 error = xfs_iwalk_threaded(mp, 0, 0, xfs_qm_dqusage_adjust, 0, true, in xfs_qm_quotacheck()
1339 xfs_clear_quotacheck_running(mp); in xfs_qm_quotacheck()
1353 if (XFS_IS_UQUOTA_ON(mp)) { in xfs_qm_quotacheck()
1354 error = xfs_qm_dquot_walk(mp, XFS_DQTYPE_USER, xfs_qm_flush_one, in xfs_qm_quotacheck()
1357 if (XFS_IS_GQUOTA_ON(mp)) { in xfs_qm_quotacheck()
1358 error2 = xfs_qm_dquot_walk(mp, XFS_DQTYPE_GROUP, xfs_qm_flush_one, in xfs_qm_quotacheck()
1363 if (XFS_IS_PQUOTA_ON(mp)) { in xfs_qm_quotacheck()
1364 error2 = xfs_qm_dquot_walk(mp, XFS_DQTYPE_PROJ, xfs_qm_flush_one, in xfs_qm_quotacheck()
1389 mp->m_qflags &= ~XFS_ALL_QUOTA_CHKD; in xfs_qm_quotacheck()
1390 mp->m_qflags |= flags; in xfs_qm_quotacheck()
1396 xfs_warn(mp, in xfs_qm_quotacheck()
1402 ASSERT(mp->m_quotainfo != NULL); in xfs_qm_quotacheck()
1403 xfs_qm_destroy_quotainfo(mp); in xfs_qm_quotacheck()
1404 if (xfs_mount_reset_sbqflags(mp)) { in xfs_qm_quotacheck()
1405 xfs_warn(mp, in xfs_qm_quotacheck()
1409 xfs_notice(mp, "Quotacheck: Done."); in xfs_qm_quotacheck()
1422 xfs_inodegc_flush(mp); in xfs_qm_quotacheck()
1423 xfs_qm_dqpurge_all(mp); in xfs_qm_quotacheck()
1439 struct xfs_mount *mp) in xfs_qm_mount_quotas() argument
1448 if (mp->m_sb.sb_rextents) { in xfs_qm_mount_quotas()
1449 xfs_notice(mp, "Cannot turn on quotas for realtime filesystem"); in xfs_qm_mount_quotas()
1450 mp->m_qflags = 0; in xfs_qm_mount_quotas()
1454 ASSERT(XFS_IS_QUOTA_ON(mp)); in xfs_qm_mount_quotas()
1460 error = xfs_qm_init_quotainfo(mp); in xfs_qm_mount_quotas()
1465 ASSERT(mp->m_quotainfo == NULL); in xfs_qm_mount_quotas()
1466 mp->m_qflags = 0; in xfs_qm_mount_quotas()
1472 if (XFS_QM_NEED_QUOTACHECK(mp)) { in xfs_qm_mount_quotas()
1473 error = xfs_qm_quotacheck(mp); in xfs_qm_mount_quotas()
1484 if (!XFS_IS_UQUOTA_ON(mp)) in xfs_qm_mount_quotas()
1485 mp->m_qflags &= ~XFS_UQUOTA_CHKD; in xfs_qm_mount_quotas()
1486 if (!XFS_IS_GQUOTA_ON(mp)) in xfs_qm_mount_quotas()
1487 mp->m_qflags &= ~XFS_GQUOTA_CHKD; in xfs_qm_mount_quotas()
1488 if (!XFS_IS_PQUOTA_ON(mp)) in xfs_qm_mount_quotas()
1489 mp->m_qflags &= ~XFS_PQUOTA_CHKD; in xfs_qm_mount_quotas()
1496 spin_lock(&mp->m_sb_lock); in xfs_qm_mount_quotas()
1497 sbf = mp->m_sb.sb_qflags; in xfs_qm_mount_quotas()
1498 mp->m_sb.sb_qflags = mp->m_qflags & XFS_MOUNT_QUOTA_ALL; in xfs_qm_mount_quotas()
1499 spin_unlock(&mp->m_sb_lock); in xfs_qm_mount_quotas()
1501 if (sbf != (mp->m_qflags & XFS_MOUNT_QUOTA_ALL)) { in xfs_qm_mount_quotas()
1502 if (xfs_sync_sb(mp, false)) { in xfs_qm_mount_quotas()
1509 ASSERT(!(XFS_IS_QUOTA_ON(mp))); in xfs_qm_mount_quotas()
1510 xfs_alert(mp, "%s: Superblock update failed!", in xfs_qm_mount_quotas()
1516 xfs_warn(mp, "Failed to initialize disk quotas."); in xfs_qm_mount_quotas()
1527 xfs_mount_t *mp) in xfs_qm_init_quotainos() argument
1535 ASSERT(mp->m_quotainfo); in xfs_qm_init_quotainos()
1540 if (xfs_has_quota(mp)) { in xfs_qm_init_quotainos()
1541 if (XFS_IS_UQUOTA_ON(mp) && in xfs_qm_init_quotainos()
1542 mp->m_sb.sb_uquotino != NULLFSINO) { in xfs_qm_init_quotainos()
1543 ASSERT(mp->m_sb.sb_uquotino > 0); in xfs_qm_init_quotainos()
1544 error = xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, in xfs_qm_init_quotainos()
1549 if (XFS_IS_GQUOTA_ON(mp) && in xfs_qm_init_quotainos()
1550 mp->m_sb.sb_gquotino != NULLFSINO) { in xfs_qm_init_quotainos()
1551 ASSERT(mp->m_sb.sb_gquotino > 0); in xfs_qm_init_quotainos()
1552 error = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, in xfs_qm_init_quotainos()
1557 if (XFS_IS_PQUOTA_ON(mp) && in xfs_qm_init_quotainos()
1558 mp->m_sb.sb_pquotino != NULLFSINO) { in xfs_qm_init_quotainos()
1559 ASSERT(mp->m_sb.sb_pquotino > 0); in xfs_qm_init_quotainos()
1560 error = xfs_iget(mp, NULL, mp->m_sb.sb_pquotino, in xfs_qm_init_quotainos()
1575 if (XFS_IS_UQUOTA_ON(mp) && uip == NULL) { in xfs_qm_init_quotainos()
1576 error = xfs_qm_qino_alloc(mp, &uip, in xfs_qm_init_quotainos()
1583 if (XFS_IS_GQUOTA_ON(mp) && gip == NULL) { in xfs_qm_init_quotainos()
1584 error = xfs_qm_qino_alloc(mp, &gip, in xfs_qm_init_quotainos()
1591 if (XFS_IS_PQUOTA_ON(mp) && pip == NULL) { in xfs_qm_init_quotainos()
1592 error = xfs_qm_qino_alloc(mp, &pip, in xfs_qm_init_quotainos()
1598 mp->m_quotainfo->qi_uquotaip = uip; in xfs_qm_init_quotainos()
1599 mp->m_quotainfo->qi_gquotaip = gip; in xfs_qm_init_quotainos()
1600 mp->m_quotainfo->qi_pquotaip = pip; in xfs_qm_init_quotainos()
1636 struct xfs_mount *mp = dqp->q_mount; in xfs_qm_dqfree_one() local
1637 struct xfs_quotainfo *qi = mp->m_quotainfo; in xfs_qm_dqfree_one()
1672 struct xfs_mount *mp = ip->i_mount; in xfs_qm_vop_dqalloc() local
1681 if (!XFS_IS_QUOTA_ON(mp)) in xfs_qm_vop_dqalloc()
1694 if (XFS_NOT_DQATTACHED(mp, ip)) { in xfs_qm_vop_dqalloc()
1702 if ((flags & XFS_QMOPT_UQUOTA) && XFS_IS_UQUOTA_ON(mp)) { in xfs_qm_vop_dqalloc()
1715 error = xfs_qm_dqget(mp, from_kuid(user_ns, uid), in xfs_qm_vop_dqalloc()
1736 if ((flags & XFS_QMOPT_GQUOTA) && XFS_IS_GQUOTA_ON(mp)) { in xfs_qm_vop_dqalloc()
1740 error = xfs_qm_dqget(mp, from_kgid(user_ns, gid), in xfs_qm_vop_dqalloc()
1754 if ((flags & XFS_QMOPT_PQUOTA) && XFS_IS_PQUOTA_ON(mp)) { in xfs_qm_vop_dqalloc()
1758 error = xfs_qm_dqget(mp, prid, in xfs_qm_vop_dqalloc()
1862 struct xfs_mount *mp = i_tab[0]->i_mount; in xfs_qm_vop_rename_dqattach() local
1865 if (!XFS_IS_QUOTA_ON(mp)) in xfs_qm_vop_rename_dqattach()
1876 if (XFS_NOT_DQATTACHED(mp, ip)) { in xfs_qm_vop_rename_dqattach()
1894 struct xfs_mount *mp = tp->t_mountp; in xfs_qm_vop_create_dqattach() local
1896 if (!XFS_IS_QUOTA_ON(mp)) in xfs_qm_vop_create_dqattach()
1901 if (udqp && XFS_IS_UQUOTA_ON(mp)) { in xfs_qm_vop_create_dqattach()
1908 if (gdqp && XFS_IS_GQUOTA_ON(mp)) { in xfs_qm_vop_create_dqattach()
1915 if (pdqp && XFS_IS_PQUOTA_ON(mp)) { in xfs_qm_vop_create_dqattach()