aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r--fs/xfs/xfs_mount.c73
1 files changed, 33 insertions, 40 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 82e1646e6243..541d5dd474be 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -1,40 +1,26 @@
1/* 1/*
2 * Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved. 2 * Copyright (c) 2000-2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
3 * 4 *
4 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or
5 * under the terms of version 2 of the GNU General Public License as 6 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
7 * 8 *
8 * This program is distributed in the hope that it would be useful, but 9 * This program is distributed in the hope that it would be useful,
9 * WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
11 * 13 *
12 * Further, this software is distributed without any warranty that it is 14 * You should have received a copy of the GNU General Public License
13 * free of the rightful claim of any third person regarding infringement 15 * along with this program; if not, write the Free Software Foundation,
14 * or the like. Any license provided herein, whether implied or 16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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.
18 *
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.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */ 17 */
32
33#include "xfs.h" 18#include "xfs.h"
34#include "xfs_macros.h" 19#include "xfs_fs.h"
35#include "xfs_types.h" 20#include "xfs_types.h"
36#include "xfs_inum.h" 21#include "xfs_bit.h"
37#include "xfs_log.h" 22#include "xfs_log.h"
23#include "xfs_inum.h"
38#include "xfs_trans.h" 24#include "xfs_trans.h"
39#include "xfs_sb.h" 25#include "xfs_sb.h"
40#include "xfs_ag.h" 26#include "xfs_ag.h"
@@ -42,21 +28,20 @@
42#include "xfs_dir2.h" 28#include "xfs_dir2.h"
43#include "xfs_dmapi.h" 29#include "xfs_dmapi.h"
44#include "xfs_mount.h" 30#include "xfs_mount.h"
45#include "xfs_alloc_btree.h"
46#include "xfs_bmap_btree.h" 31#include "xfs_bmap_btree.h"
32#include "xfs_alloc_btree.h"
47#include "xfs_ialloc_btree.h" 33#include "xfs_ialloc_btree.h"
48#include "xfs_btree.h"
49#include "xfs_ialloc.h"
50#include "xfs_attr_sf.h"
51#include "xfs_dir_sf.h" 34#include "xfs_dir_sf.h"
52#include "xfs_dir2_sf.h" 35#include "xfs_dir2_sf.h"
36#include "xfs_attr_sf.h"
53#include "xfs_dinode.h" 37#include "xfs_dinode.h"
54#include "xfs_inode.h" 38#include "xfs_inode.h"
39#include "xfs_btree.h"
40#include "xfs_ialloc.h"
55#include "xfs_alloc.h" 41#include "xfs_alloc.h"
56#include "xfs_rtalloc.h" 42#include "xfs_rtalloc.h"
57#include "xfs_bmap.h" 43#include "xfs_bmap.h"
58#include "xfs_error.h" 44#include "xfs_error.h"
59#include "xfs_bit.h"
60#include "xfs_rw.h" 45#include "xfs_rw.h"
61#include "xfs_quota.h" 46#include "xfs_quota.h"
62#include "xfs_fsops.h" 47#include "xfs_fsops.h"
@@ -180,6 +165,10 @@ xfs_mount_free(
180 165
181 if (mp->m_fsname != NULL) 166 if (mp->m_fsname != NULL)
182 kmem_free(mp->m_fsname, mp->m_fsname_len); 167 kmem_free(mp->m_fsname, mp->m_fsname_len);
168 if (mp->m_rtname != NULL)
169 kmem_free(mp->m_rtname, strlen(mp->m_rtname) + 1);
170 if (mp->m_logname != NULL)
171 kmem_free(mp->m_logname, strlen(mp->m_logname) + 1);
183 172
184 if (remove_bhv) { 173 if (remove_bhv) {
185 struct vfs *vfsp = XFS_MTOVFS(mp); 174 struct vfs *vfsp = XFS_MTOVFS(mp);
@@ -318,7 +307,7 @@ xfs_mount_validate_sb(
318 "XFS: Attempted to mount file system with blocksize %d bytes", 307 "XFS: Attempted to mount file system with blocksize %d bytes",
319 sbp->sb_blocksize); 308 sbp->sb_blocksize);
320 cmn_err(CE_WARN, 309 cmn_err(CE_WARN,
321 "XFS: Only page-sized (%d) or less blocksizes currently work.", 310 "XFS: Only page-sized (%ld) or less blocksizes currently work.",
322 PAGE_SIZE); 311 PAGE_SIZE);
323 return XFS_ERROR(ENOSYS); 312 return XFS_ERROR(ENOSYS);
324 } 313 }
@@ -327,7 +316,10 @@ xfs_mount_validate_sb(
327} 316}
328 317
329xfs_agnumber_t 318xfs_agnumber_t
330xfs_initialize_perag(xfs_mount_t *mp, xfs_agnumber_t agcount) 319xfs_initialize_perag(
320 struct vfs *vfs,
321 xfs_mount_t *mp,
322 xfs_agnumber_t agcount)
331{ 323{
332 xfs_agnumber_t index, max_metadata; 324 xfs_agnumber_t index, max_metadata;
333 xfs_perag_t *pag; 325 xfs_perag_t *pag;
@@ -343,7 +335,7 @@ xfs_initialize_perag(xfs_mount_t *mp, xfs_agnumber_t agcount)
343 /* Clear the mount flag if no inode can overflow 32 bits 335 /* Clear the mount flag if no inode can overflow 32 bits
344 * on this filesystem, or if specifically requested.. 336 * on this filesystem, or if specifically requested..
345 */ 337 */
346 if ((mp->m_flags & XFS_MOUNT_32BITINOOPT) && ino > max_inum) { 338 if ((vfs->vfs_flag & VFS_32BITINODES) && ino > max_inum) {
347 mp->m_flags |= XFS_MOUNT_32BITINODES; 339 mp->m_flags |= XFS_MOUNT_32BITINODES;
348 } else { 340 } else {
349 mp->m_flags &= ~XFS_MOUNT_32BITINODES; 341 mp->m_flags &= ~XFS_MOUNT_32BITINODES;
@@ -360,7 +352,7 @@ xfs_initialize_perag(xfs_mount_t *mp, xfs_agnumber_t agcount)
360 icount = sbp->sb_dblocks * sbp->sb_imax_pct; 352 icount = sbp->sb_dblocks * sbp->sb_imax_pct;
361 do_div(icount, 100); 353 do_div(icount, 100);
362 icount += sbp->sb_agblocks - 1; 354 icount += sbp->sb_agblocks - 1;
363 do_div(icount, mp->m_ialloc_blks); 355 do_div(icount, sbp->sb_agblocks);
364 max_metadata = icount; 356 max_metadata = icount;
365 } else { 357 } else {
366 max_metadata = agcount; 358 max_metadata = agcount;
@@ -584,12 +576,13 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp)
584 ASSERT(sbp->sb_inodesize >= 256 && sbp->sb_inodesize <= 2048); 576 ASSERT(sbp->sb_inodesize >= 256 && sbp->sb_inodesize <= 2048);
585 switch (sbp->sb_inodesize) { 577 switch (sbp->sb_inodesize) {
586 case 256: 578 case 256:
587 mp->m_attroffset = XFS_LITINO(mp) - XFS_BMDR_SPACE_CALC(2); 579 mp->m_attroffset = XFS_LITINO(mp) -
580 XFS_BMDR_SPACE_CALC(MINABTPTRS);
588 break; 581 break;
589 case 512: 582 case 512:
590 case 1024: 583 case 1024:
591 case 2048: 584 case 2048:
592 mp->m_attroffset = XFS_BMDR_SPACE_CALC(12); 585 mp->m_attroffset = XFS_BMDR_SPACE_CALC(6 * MINABTPTRS);
593 break; 586 break;
594 default: 587 default:
595 ASSERT(0); 588 ASSERT(0);
@@ -954,7 +947,7 @@ xfs_mountfs(
954 mp->m_perag = 947 mp->m_perag =
955 kmem_zalloc(sbp->sb_agcount * sizeof(xfs_perag_t), KM_SLEEP); 948 kmem_zalloc(sbp->sb_agcount * sizeof(xfs_perag_t), KM_SLEEP);
956 949
957 mp->m_maxagi = xfs_initialize_perag(mp, sbp->sb_agcount); 950 mp->m_maxagi = xfs_initialize_perag(vfsp, mp, sbp->sb_agcount);
958 951
959 /* 952 /*
960 * log's mount-time initialization. Perform 1st part recovery if needed 953 * log's mount-time initialization. Perform 1st part recovery if needed