Lines Matching refs:mp

35 STATIC int	xfs_qm_init_quotainos(struct xfs_mount *mp);
36 STATIC int xfs_qm_init_quotainfo(struct xfs_mount *mp);
51 struct xfs_mount *mp, in xfs_qm_dquot_walk() argument
56 struct xfs_quotainfo *qi = mp->m_quotainfo; in xfs_qm_dquot_walk()
124 struct xfs_mount *mp = dqp->q_mount; in xfs_qm_dqpurge() local
125 struct xfs_quotainfo *qi = mp->m_quotainfo; in xfs_qm_dqpurge()
160 ASSERT(xfs_is_shutdown(mp) || in xfs_qm_dqpurge()
175 XFS_STATS_DEC(mp, xs_qm_dquot_unused); in xfs_qm_dqpurge()
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()
542 struct xfs_mount *mp, in xfs_qm_set_defquota() argument
550 error = xfs_qm_dqget_uncached(mp, 0, type, &dqp); in xfs_qm_set_defquota()
572 struct xfs_mount *mp, in xfs_qm_init_timelimits() argument
575 struct xfs_quotainfo *qinf = mp->m_quotainfo; in xfs_qm_init_timelimits()
596 error = xfs_qm_dqget_uncached(mp, 0, type, &dqp); in xfs_qm_init_timelimits()
627 struct xfs_mount *mp) in xfs_qm_init_quotainfo() argument
632 ASSERT(XFS_IS_QUOTA_ON(mp)); in xfs_qm_init_quotainfo()
634 qinf = mp->m_quotainfo = kmem_zalloc(sizeof(struct xfs_quotainfo), 0); in xfs_qm_init_quotainfo()
644 error = xfs_qm_init_quotainos(mp); in xfs_qm_init_quotainfo()
657 qinf->qi_dqchunklen = XFS_FSB_TO_BB(mp, XFS_DQUOT_CLUSTER_SIZE_FSB); in xfs_qm_init_quotainfo()
659 if (xfs_has_bigtime(mp)) { in xfs_qm_init_quotainfo()
668 trace_xfs_quota_expiry_range(mp, qinf->qi_expiry_min, in xfs_qm_init_quotainfo()
671 mp->m_qflags |= (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_CHKD); in xfs_qm_init_quotainfo()
673 xfs_qm_init_timelimits(mp, XFS_DQTYPE_USER); in xfs_qm_init_quotainfo()
674 xfs_qm_init_timelimits(mp, XFS_DQTYPE_GROUP); in xfs_qm_init_quotainfo()
675 xfs_qm_init_timelimits(mp, XFS_DQTYPE_PROJ); in xfs_qm_init_quotainfo()
677 if (XFS_IS_UQUOTA_ON(mp)) in xfs_qm_init_quotainfo()
678 xfs_qm_set_defquota(mp, XFS_DQTYPE_USER, qinf); in xfs_qm_init_quotainfo()
679 if (XFS_IS_GQUOTA_ON(mp)) in xfs_qm_init_quotainfo()
680 xfs_qm_set_defquota(mp, XFS_DQTYPE_GROUP, qinf); in xfs_qm_init_quotainfo()
681 if (XFS_IS_PQUOTA_ON(mp)) in xfs_qm_init_quotainfo()
682 xfs_qm_set_defquota(mp, XFS_DQTYPE_PROJ, qinf); 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()
1189 if (XFS_IS_UQUOTA_ON(mp)) { in xfs_qm_dqusage_adjust()
1196 if (XFS_IS_GQUOTA_ON(mp)) { in xfs_qm_dqusage_adjust()
1203 if (XFS_IS_PQUOTA_ON(mp)) { in xfs_qm_dqusage_adjust()
1220 struct xfs_mount *mp = dqp->q_mount; in xfs_qm_flush_one() local
1241 bp = xfs_buf_incore(mp->m_ddev_targp, dqp->q_blkno, in xfs_qm_flush_one()
1242 mp->m_quotainfo->qi_dqchunklen, 0); in xfs_qm_flush_one()
1273 xfs_mount_t *mp) in xfs_qm_quotacheck() argument
1278 struct xfs_inode *uip = mp->m_quotainfo->qi_uquotaip; in xfs_qm_quotacheck()
1279 struct xfs_inode *gip = mp->m_quotainfo->qi_gquotaip; in xfs_qm_quotacheck()
1280 struct xfs_inode *pip = mp->m_quotainfo->qi_pquotaip; in xfs_qm_quotacheck()
1285 ASSERT(XFS_IS_QUOTA_ON(mp)); in xfs_qm_quotacheck()
1287 xfs_notice(mp, "Quotacheck needed: Please wait."); in xfs_qm_quotacheck()
1295 error = xfs_qm_reset_dqcounts_buf(mp, uip, XFS_DQTYPE_USER, in xfs_qm_quotacheck()
1303 error = xfs_qm_reset_dqcounts_buf(mp, gip, XFS_DQTYPE_GROUP, in xfs_qm_quotacheck()
1311 error = xfs_qm_reset_dqcounts_buf(mp, pip, XFS_DQTYPE_PROJ, in xfs_qm_quotacheck()
1318 error = xfs_iwalk_threaded(mp, 0, 0, xfs_qm_dqusage_adjust, 0, true, in xfs_qm_quotacheck()
1327 if (XFS_IS_UQUOTA_ON(mp)) { in xfs_qm_quotacheck()
1328 error = xfs_qm_dquot_walk(mp, XFS_DQTYPE_USER, xfs_qm_flush_one, in xfs_qm_quotacheck()
1331 if (XFS_IS_GQUOTA_ON(mp)) { in xfs_qm_quotacheck()
1332 error2 = xfs_qm_dquot_walk(mp, XFS_DQTYPE_GROUP, xfs_qm_flush_one, in xfs_qm_quotacheck()
1337 if (XFS_IS_PQUOTA_ON(mp)) { in xfs_qm_quotacheck()
1338 error2 = xfs_qm_dquot_walk(mp, XFS_DQTYPE_PROJ, xfs_qm_flush_one, in xfs_qm_quotacheck()
1356 xfs_qm_dqpurge_all(mp); in xfs_qm_quotacheck()
1365 mp->m_qflags &= ~XFS_ALL_QUOTA_CHKD; in xfs_qm_quotacheck()
1366 mp->m_qflags |= flags; in xfs_qm_quotacheck()
1372 xfs_warn(mp, in xfs_qm_quotacheck()
1378 ASSERT(mp->m_quotainfo != NULL); in xfs_qm_quotacheck()
1379 xfs_qm_destroy_quotainfo(mp); in xfs_qm_quotacheck()
1380 if (xfs_mount_reset_sbqflags(mp)) { in xfs_qm_quotacheck()
1381 xfs_warn(mp, in xfs_qm_quotacheck()
1385 xfs_notice(mp, "Quotacheck: Done."); in xfs_qm_quotacheck()
1400 struct xfs_mount *mp) in xfs_qm_mount_quotas() argument
1409 if (mp->m_sb.sb_rextents) { in xfs_qm_mount_quotas()
1410 xfs_notice(mp, "Cannot turn on quotas for realtime filesystem"); in xfs_qm_mount_quotas()
1411 mp->m_qflags = 0; in xfs_qm_mount_quotas()
1415 ASSERT(XFS_IS_QUOTA_ON(mp)); in xfs_qm_mount_quotas()
1421 error = xfs_qm_init_quotainfo(mp); in xfs_qm_mount_quotas()
1426 ASSERT(mp->m_quotainfo == NULL); in xfs_qm_mount_quotas()
1427 mp->m_qflags = 0; in xfs_qm_mount_quotas()
1433 if (XFS_QM_NEED_QUOTACHECK(mp)) { in xfs_qm_mount_quotas()
1434 error = xfs_qm_quotacheck(mp); in xfs_qm_mount_quotas()
1445 if (!XFS_IS_UQUOTA_ON(mp)) in xfs_qm_mount_quotas()
1446 mp->m_qflags &= ~XFS_UQUOTA_CHKD; in xfs_qm_mount_quotas()
1447 if (!XFS_IS_GQUOTA_ON(mp)) in xfs_qm_mount_quotas()
1448 mp->m_qflags &= ~XFS_GQUOTA_CHKD; in xfs_qm_mount_quotas()
1449 if (!XFS_IS_PQUOTA_ON(mp)) in xfs_qm_mount_quotas()
1450 mp->m_qflags &= ~XFS_PQUOTA_CHKD; in xfs_qm_mount_quotas()
1457 spin_lock(&mp->m_sb_lock); in xfs_qm_mount_quotas()
1458 sbf = mp->m_sb.sb_qflags; in xfs_qm_mount_quotas()
1459 mp->m_sb.sb_qflags = mp->m_qflags & XFS_MOUNT_QUOTA_ALL; in xfs_qm_mount_quotas()
1460 spin_unlock(&mp->m_sb_lock); in xfs_qm_mount_quotas()
1462 if (sbf != (mp->m_qflags & XFS_MOUNT_QUOTA_ALL)) { in xfs_qm_mount_quotas()
1463 if (xfs_sync_sb(mp, false)) { in xfs_qm_mount_quotas()
1470 ASSERT(!(XFS_IS_QUOTA_ON(mp))); in xfs_qm_mount_quotas()
1471 xfs_alert(mp, "%s: Superblock update failed!", in xfs_qm_mount_quotas()
1477 xfs_warn(mp, "Failed to initialize disk quotas."); in xfs_qm_mount_quotas()
1488 xfs_mount_t *mp) in xfs_qm_init_quotainos() argument
1496 ASSERT(mp->m_quotainfo); in xfs_qm_init_quotainos()
1501 if (xfs_has_quota(mp)) { in xfs_qm_init_quotainos()
1502 if (XFS_IS_UQUOTA_ON(mp) && in xfs_qm_init_quotainos()
1503 mp->m_sb.sb_uquotino != NULLFSINO) { in xfs_qm_init_quotainos()
1504 ASSERT(mp->m_sb.sb_uquotino > 0); in xfs_qm_init_quotainos()
1505 error = xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, in xfs_qm_init_quotainos()
1510 if (XFS_IS_GQUOTA_ON(mp) && in xfs_qm_init_quotainos()
1511 mp->m_sb.sb_gquotino != NULLFSINO) { in xfs_qm_init_quotainos()
1512 ASSERT(mp->m_sb.sb_gquotino > 0); in xfs_qm_init_quotainos()
1513 error = xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, in xfs_qm_init_quotainos()
1518 if (XFS_IS_PQUOTA_ON(mp) && in xfs_qm_init_quotainos()
1519 mp->m_sb.sb_pquotino != NULLFSINO) { in xfs_qm_init_quotainos()
1520 ASSERT(mp->m_sb.sb_pquotino > 0); in xfs_qm_init_quotainos()
1521 error = xfs_iget(mp, NULL, mp->m_sb.sb_pquotino, in xfs_qm_init_quotainos()
1536 if (XFS_IS_UQUOTA_ON(mp) && uip == NULL) { in xfs_qm_init_quotainos()
1537 error = xfs_qm_qino_alloc(mp, &uip, in xfs_qm_init_quotainos()
1544 if (XFS_IS_GQUOTA_ON(mp) && gip == NULL) { in xfs_qm_init_quotainos()
1545 error = xfs_qm_qino_alloc(mp, &gip, in xfs_qm_init_quotainos()
1552 if (XFS_IS_PQUOTA_ON(mp) && pip == NULL) { in xfs_qm_init_quotainos()
1553 error = xfs_qm_qino_alloc(mp, &pip, in xfs_qm_init_quotainos()
1559 mp->m_quotainfo->qi_uquotaip = uip; in xfs_qm_init_quotainos()
1560 mp->m_quotainfo->qi_gquotaip = gip; in xfs_qm_init_quotainos()
1561 mp->m_quotainfo->qi_pquotaip = pip; in xfs_qm_init_quotainos()
1597 struct xfs_mount *mp = dqp->q_mount; in xfs_qm_dqfree_one() local
1598 struct xfs_quotainfo *qi = mp->m_quotainfo; in xfs_qm_dqfree_one()
1633 struct xfs_mount *mp = ip->i_mount; in xfs_qm_vop_dqalloc() local
1642 if (!XFS_IS_QUOTA_ON(mp)) in xfs_qm_vop_dqalloc()
1655 if (XFS_NOT_DQATTACHED(mp, ip)) { in xfs_qm_vop_dqalloc()
1663 if ((flags & XFS_QMOPT_UQUOTA) && XFS_IS_UQUOTA_ON(mp)) { in xfs_qm_vop_dqalloc()
1676 error = xfs_qm_dqget(mp, from_kuid(user_ns, uid), in xfs_qm_vop_dqalloc()
1697 if ((flags & XFS_QMOPT_GQUOTA) && XFS_IS_GQUOTA_ON(mp)) { in xfs_qm_vop_dqalloc()
1701 error = xfs_qm_dqget(mp, from_kgid(user_ns, gid), in xfs_qm_vop_dqalloc()
1715 if ((flags & XFS_QMOPT_PQUOTA) && XFS_IS_PQUOTA_ON(mp)) { in xfs_qm_vop_dqalloc()
1719 error = xfs_qm_dqget(mp, prid, in xfs_qm_vop_dqalloc()
1823 struct xfs_mount *mp = i_tab[0]->i_mount; in xfs_qm_vop_rename_dqattach() local
1826 if (!XFS_IS_QUOTA_ON(mp)) in xfs_qm_vop_rename_dqattach()
1837 if (XFS_NOT_DQATTACHED(mp, ip)) { in xfs_qm_vop_rename_dqattach()
1855 struct xfs_mount *mp = tp->t_mountp; in xfs_qm_vop_create_dqattach() local
1857 if (!XFS_IS_QUOTA_ON(mp)) in xfs_qm_vop_create_dqattach()
1862 if (udqp && XFS_IS_UQUOTA_ON(mp)) { in xfs_qm_vop_create_dqattach()
1869 if (gdqp && XFS_IS_GQUOTA_ON(mp)) { in xfs_qm_vop_create_dqattach()
1876 if (pdqp && XFS_IS_PQUOTA_ON(mp)) { in xfs_qm_vop_create_dqattach()