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"
48 memset(&mount
, 0, sizeof(mount
));
50 sbp
->sb_magicnum
= XFS_SB_MAGIC
;
51 sbp
->sb_sectlog
= sectorlog
;
52 sbp
->sb_sectsize
= 1 << sbp
->sb_sectlog
;
53 sbp
->sb_blocklog
= blocklog
;
54 sbp
->sb_blocksize
= 1 << blocklog
;
55 sbp
->sb_agblocks
= agsize
;
56 sbp
->sb_inodelog
= inodelog
;
57 sbp
->sb_inopblog
= blocklog
- inodelog
;
58 sbp
->sb_inodesize
= 1 << inodelog
;
59 sbp
->sb_inopblock
= 1 << (blocklog
- inodelog
);
60 sbp
->sb_dirblklog
= dirblocklog
- blocklog
;
63 log_sunit
<<= blocklog
;
67 sbp
->sb_logsunit
= log_sunit
;
70 (crcs_enabled
? XFS_SB_VERSION_5
: XFS_SB_VERSION_4
) |
71 (dirversion
== 2 ? XFS_SB_VERSION_DIRV2BIT
: 0) |
72 (logversion
> 1 ? XFS_SB_VERSION_LOGV2BIT
: 0) |
73 XFS_DFL_SB_VERSION_BITS
;
75 sbp
->sb_features_ro_compat
|= XFS_SB_FEAT_RO_COMPAT_FINOBT
;
77 sbp
->sb_features_ro_compat
|= XFS_SB_FEAT_RO_COMPAT_RMAPBT
;
79 libxfs_mount(&mount
, sbp
, 0,0,0,0);
80 maxfsb
= libxfs_log_calc_minimum_size(&mount
);
81 libxfs_umount(&mount
);
84 printf("#define\tMAXTRRES_S%d_B%d_I%d_D%d_V%d_LSU%d\t%d\n",
85 sectorlog
, blocklog
, inodelog
, dirblocklog
, dirversion
,