2 * Copyright (c) 2000 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/
38 #include "err_protos.h"
42 update_sb_version(xfs_mount_t
*mp
)
50 if (!XFS_SB_VERSION_HASATTR(sb
)) {
51 ASSERT(fs_attributes_allowed
);
53 XFS_SB_VERSION_ADDATTR(sb
);
58 if (!XFS_SB_VERSION_HASNLINK(sb
)) {
59 ASSERT(fs_inode_nlink_allowed
);
61 XFS_SB_VERSION_ADDNLINK(sb
);
66 * fix up the superblock version number and feature bits,
67 * turn off quota bits and flags if the filesystem doesn't
71 if (!XFS_SB_VERSION_HASQUOTA(sb
)) {
72 ASSERT(fs_quotas_allowed
);
74 XFS_SB_VERSION_ADDQUOTA(sb
);
78 * protect against stray bits in the quota flag field
80 if (sb
->sb_qflags
& ~(XFS_UQUOTA_ACCT
|XFS_UQUOTA_ENFD
|
81 XFS_UQUOTA_CHKD
|XFS_GQUOTA_ACCT
|
82 XFS_GQUOTA_ENFD
|XFS_GQUOTA_CHKD
)) {
84 * update the incore superblock, if we're in
85 * no_modify mode, it'll never get flushed out
88 do_warn("bogus quota flags 0x%x set in superblock",
89 sb
->sb_qflags
& ~(XFS_UQUOTA_ACCT
|
91 XFS_UQUOTA_CHKD
|XFS_GQUOTA_ACCT
|
92 XFS_GQUOTA_ENFD
|XFS_GQUOTA_CHKD
));
94 sb
->sb_qflags
&= (XFS_UQUOTA_ACCT
|
96 XFS_UQUOTA_CHKD
|XFS_GQUOTA_ACCT
|
97 XFS_GQUOTA_ENFD
|XFS_GQUOTA_CHKD
);
100 do_warn(", bogus flags will be cleared\n");
102 do_warn(", bogus flags would be cleared\n");
107 if (XFS_SB_VERSION_HASQUOTA(sb
)) {
109 vn
= sb
->sb_versionnum
;
110 vn
&= ~XFS_SB_VERSION_QUOTABIT
;
112 if (!(vn
& XFS_SB_VERSION_ALLFBITS
))
113 vn
= XFS_SB_VERSION_TOOLD(vn
);
116 sb
->sb_versionnum
= vn
;
120 if (!fs_aligned_inodes
) {
121 if (XFS_SB_VERSION_HASALIGN(sb
)) {
122 if (XFS_SB_VERSION_NUM(sb
) == XFS_SB_VERSION_4
)
123 XFS_SB_VERSION_SUBALIGN(sb
);
129 * returns 0 if things are fine, 1 if we don't understand
130 * this superblock version. Sets superblock geometry-dependent
134 parse_sb_version(xfs_sb_t
*sb
)
141 fs_aligned_inodes
= 0;
142 fs_sb_feature_bits
= 0;
143 fs_ino_alignment
= 0;
144 fs_has_extflgbit
= 0;
150 * ok, check to make sure that the sb isn't newer
153 if (XFS_SB_VERSION_HASEXTFLGBIT(sb
)) {
154 fs_has_extflgbit
= 1;
155 if (!fs_has_extflgbit_allowed
) {
158 "This filesystem has uninitialized extent flags.\n");
162 if (XFS_SB_VERSION_HASSHARED(sb
)) {
164 if (!fs_shared_allowed
) {
166 do_warn("This filesystem is marked shared.\n");
172 "This filesystem uses 6.5 feature(s) not yet supported in this release.\n\
173 Please run a 6.5 version of xfs_repair.\n");
177 if (!XFS_SB_GOOD_VERSION(sb
)) {
179 "WARNING: unknown superblock version %d\n", XFS_SB_VERSION_NUM(sb
));
181 "This filesystem contains features not understood by this program.\n");
185 if (XFS_SB_VERSION_NUM(sb
) == XFS_SB_VERSION_4
) {
186 if (!fs_sb_feature_bits_allowed
) {
188 "WARNING: you have disallowed superblock feature bits disallowed\n");
190 "\tbut this superblock has feature bits. The superblock\n");
194 "\twill be downgraded. This may cause loss of filesystem meta-data\n");
197 "\twould be downgraded. This might cause loss of filesystem\n");
202 fs_sb_feature_bits
= 1;
206 if (XFS_SB_VERSION_HASATTR(sb
)) {
207 if (!fs_attributes_allowed
) {
209 "WARNING: you have disallowed attributes but this filesystem\n");
212 "\thas attributes. The filesystem will be downgraded and\n");
214 "\tall attributes will be removed.\n");
217 "\thas attributes. The filesystem would be downgraded and\n");
219 "\tall attributes would be removed.\n");
226 if (XFS_SB_VERSION_HASNLINK(sb
)) {
227 if (!fs_inode_nlink_allowed
) {
229 "WARNING: you have disallowed version 2 inodes but this filesystem\n");
232 "\thas version 2 inodes. The filesystem will be downgraded and\n");
234 "\tall version 2 inodes will be converted to version 1 inodes.\n");
236 "\tThis may cause some hard links to files to be destroyed\n");
239 "\thas version 2 inodes. The filesystem would be downgraded and\n");
241 "\tall version 2 inodes would be converted to version 1 inodes.\n");
243 "\tThis might cause some hard links to files to be destroyed\n");
250 if (XFS_SB_VERSION_HASQUOTA(sb
)) {
251 if (!fs_quotas_allowed
) {
253 "WARNING: you have disallowed quotas but this filesystem\n");
256 "\thas quotas. The filesystem will be downgraded and\n");
258 "\tall quota information will be removed.\n");
261 "\thas quotas. The filesystem would be downgraded and\n");
263 "\tall quota information would be removed.\n");
268 if (sb
->sb_uquotino
!= 0 &&
269 sb
->sb_uquotino
!= NULLFSINO
)
272 if (sb
->sb_gquotino
!= 0 &&
273 sb
->sb_gquotino
!= NULLFSINO
)
278 if (XFS_SB_VERSION_HASALIGN(sb
)) {
279 if (fs_aligned_inodes_allowed
) {
280 fs_aligned_inodes
= 1;
281 fs_ino_alignment
= sb
->sb_inoalignmt
;
284 "WARNING: you have disallowed aligned inodes but this filesystem\n");
287 "\thas aligned inodes. The filesystem will be downgraded.\n");
289 "\tThis will permanently degrade the performance of this filesystem.\n");
292 "\thas aligned inodes. The filesystem would be downgraded.\n");
294 "\tThis would permanently degrade the performance of this filesystem.\n");
300 * calculate maximum file offset for this geometry
302 fs_max_file_offset
= 0x7fffffffffffffffLL
>> sb
->sb_blocklog
;