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_types.h"
37 #include "xfs_trans.h"
42 #include "xfs_dmapi.h"
43 #include "xfs_mount.h"
44 #include "xfs_quota.h"
45 #include "xfs_error.h"
47 STATIC struct xfs_dquot *
48 xfs_dqvopchown_default(
51 struct xfs_dquot **dqp,
58 * Clear the quotaflags in memory and in the superblock.
61 xfs_mount_reset_sbqflags(xfs_mount_t *mp)
69 * It is OK to look at sb_qflags here in mount path,
72 if (mp->m_sb.sb_qflags == 0)
75 mp->m_sb.sb_qflags = 0;
79 * if the fs is readonly, let the incore superblock run
80 * with quotas off but don't flush the update out to disk
82 if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY)
85 xfs_fs_cmn_err(CE_NOTE, mp, "Writing superblock quota changes");
87 tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE);
88 if ((error = xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0,
89 XFS_DEFAULT_LOG_COUNT))) {
90 xfs_trans_cancel(tp, 0);
91 xfs_fs_cmn_err(CE_ALERT, mp,
92 "xfs_mount_reset_sbqflags: Superblock update failed!");
95 xfs_mod_sb(tp, XFS_SB_QFLAGS);
96 error = xfs_trans_commit(tp, 0, NULL);
103 uint *needquotamount,
109 *needquotamount = B_FALSE;
111 ASSERT(!XFS_IS_QUOTA_ON(mp));
114 * If a file system had quotas running earlier, but decided to
115 * mount without -o uquota/pquota/gquota options, revoke the
116 * quotachecked license.
118 if (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT) {
120 "XFS resetting qflags for filesystem %s",
123 error = xfs_mount_reset_sbqflags(mp);
128 xfs_qmops_t xfs_qmcore_stub = {
129 .xfs_qminit = (xfs_qminit_t) xfs_noquota_init,
130 .xfs_qmdone = (xfs_qmdone_t) fs_noerr,
131 .xfs_qmmount = (xfs_qmmount_t) fs_noerr,
132 .xfs_qmunmount = (xfs_qmunmount_t) fs_noerr,
133 .xfs_dqrele = (xfs_dqrele_t) fs_noerr,
134 .xfs_dqattach = (xfs_dqattach_t) fs_noerr,
135 .xfs_dqdetach = (xfs_dqdetach_t) fs_noerr,
136 .xfs_dqpurgeall = (xfs_dqpurgeall_t) fs_noerr,
137 .xfs_dqvopalloc = (xfs_dqvopalloc_t) fs_noerr,
138 .xfs_dqvopcreate = (xfs_dqvopcreate_t) fs_noerr,
139 .xfs_dqvoprename = (xfs_dqvoprename_t) fs_noerr,
140 .xfs_dqvopchown = xfs_dqvopchown_default,
141 .xfs_dqvopchownresv = (xfs_dqvopchownresv_t) fs_noerr,