2 * Copyright (c) 2000-2001,2004-2005 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * Compute the maximum transaction reservation for a legal combination
23 * of sector size, block size, inode size, directory version, and
24 * directory block size.
28 #include "xfs_multidisk.h"
50 memset(&mount
, 0, sizeof(mount
));
52 sbp
->sb_magicnum
= XFS_SB_MAGIC
;
53 sbp
->sb_sectlog
= sectorlog
;
54 sbp
->sb_sectsize
= 1 << sbp
->sb_sectlog
;
55 sbp
->sb_blocklog
= blocklog
;
56 sbp
->sb_blocksize
= 1 << blocklog
;
57 sbp
->sb_agblocks
= agsize
;
58 sbp
->sb_agblklog
= (uint8_t)log2_roundup((unsigned int)agsize
);
59 sbp
->sb_inodelog
= inodelog
;
60 sbp
->sb_inopblog
= blocklog
- inodelog
;
61 sbp
->sb_inodesize
= 1 << inodelog
;
62 sbp
->sb_inopblock
= 1 << (blocklog
- inodelog
);
63 sbp
->sb_dirblklog
= dirblocklog
- blocklog
;
66 int cluster_size
= XFS_INODE_BIG_CLUSTER_SIZE
;
68 cluster_size
*= sbp
->sb_inodesize
/ XFS_DINODE_MIN_SIZE
;
69 sbp
->sb_inoalignmt
= cluster_size
>> blocklog
;
73 log_sunit
<<= blocklog
;
77 sbp
->sb_logsunit
= log_sunit
;
80 (crcs_enabled
? XFS_SB_VERSION_5
: XFS_SB_VERSION_4
) |
81 (dirversion
== 2 ? XFS_SB_VERSION_DIRV2BIT
: 0) |
82 (logversion
> 1 ? XFS_SB_VERSION_LOGV2BIT
: 0) |
83 XFS_DFL_SB_VERSION_BITS
;
85 sbp
->sb_features_ro_compat
|= XFS_SB_FEAT_RO_COMPAT_FINOBT
;
87 sbp
->sb_features_ro_compat
|= XFS_SB_FEAT_RO_COMPAT_RMAPBT
;
89 sbp
->sb_features_ro_compat
|= XFS_SB_FEAT_RO_COMPAT_REFLINK
;
91 libxfs_mount(&mount
, sbp
, 0,0,0,0);
92 maxfsb
= libxfs_log_calc_minimum_size(&mount
);
93 libxfs_umount(&mount
);
96 printf("#define\tMAXTRRES_S%d_B%d_I%d_D%d_V%d_LSU%d\t%d\n",
97 sectorlog
, blocklog
, inodelog
, dirblocklog
, dirversion
,