2 * Copyright (c) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
34 #include "xfs_macros.h"
35 #include "xfs_types.h"
38 #include "xfs_trans.h"
43 #include "xfs_dmapi.h"
44 #include "xfs_mount.h"
45 #include "xfs_quota.h"
46 #include "xfs_error.h"
48 STATIC struct xfs_dquot *
49 xfs_dqvopchown_default(
52 struct xfs_dquot **dqp,
59 * Clear the quotaflags in memory and in the superblock.
62 xfs_mount_reset_sbqflags(xfs_mount_t *mp)
70 * It is OK to look at sb_qflags here in mount path,
73 if (mp->m_sb.sb_qflags == 0)
76 mp->m_sb.sb_qflags = 0;
80 * if the fs is readonly, let the incore superblock run
81 * with quotas off but don't flush the update out to disk
83 if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY)
86 xfs_fs_cmn_err(CE_NOTE, mp, "Writing superblock quota changes");
88 tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE);
89 if ((error = xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0,
90 XFS_DEFAULT_LOG_COUNT))) {
91 xfs_trans_cancel(tp, 0);
92 xfs_fs_cmn_err(CE_ALERT, mp,
93 "xfs_mount_reset_sbqflags: Superblock update failed!");
96 xfs_mod_sb(tp, XFS_SB_QFLAGS);
97 error = xfs_trans_commit(tp, 0, NULL);
104 uint *needquotamount,
110 *needquotamount = B_FALSE;
112 ASSERT(!XFS_IS_QUOTA_ON(mp));
115 * If a file system had quotas running earlier, but decided to
116 * mount without -o uquota/pquota/gquota options, revoke the
117 * quotachecked license.
119 if (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT) {
121 "XFS resetting qflags for filesystem %s",
124 error = xfs_mount_reset_sbqflags(mp);
129 xfs_qmops_t xfs_qmcore_stub = {
130 .xfs_qminit = (xfs_qminit_t) xfs_noquota_init,
131 .xfs_qmdone = (xfs_qmdone_t) fs_noerr,
132 .xfs_qmmount = (xfs_qmmount_t) fs_noerr,
133 .xfs_qmunmount = (xfs_qmunmount_t) fs_noerr,
134 .xfs_dqrele = (xfs_dqrele_t) fs_noerr,
135 .xfs_dqattach = (xfs_dqattach_t) fs_noerr,
136 .xfs_dqdetach = (xfs_dqdetach_t) fs_noerr,
137 .xfs_dqpurgeall = (xfs_dqpurgeall_t) fs_noerr,
138 .xfs_dqvopalloc = (xfs_dqvopalloc_t) fs_noerr,
139 .xfs_dqvopcreate = (xfs_dqvopcreate_t) fs_noerr,
140 .xfs_dqvoprename = (xfs_dqvoprename_t) fs_noerr,
141 .xfs_dqvopchown = xfs_dqvopchown_default,
142 .xfs_dqvopchownresv = (xfs_dqvopchownresv_t) fs_noerr,