2 * sparse.c --- find the groups in an ext2 filesystem with metadata backups
4 * Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
5 * Copyright (C) 2002 Andreas Dilger.
8 * This file may be redistributed under the terms of the GNU Public
18 static int test_root(int a, int b)
31 int ext2fs_bg_has_super(ext2_filsys fs, int group_block)
33 if (!(fs->super->s_feature_ro_compat &
34 EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER))
37 if (test_root(group_block, 3) || (test_root(group_block, 5)) ||
38 test_root(group_block, 7))
45 * Iterate through the groups which hold BACKUP superblock/GDT copies in an
46 * ext3 filesystem. The counters should be initialized to 1, 5, and 7 before
47 * calling this for the first time. In a sparse filesystem it will be the
48 * sequence of powers of 3, 5, and 7: 1, 3, 5, 7, 9, 25, 27, 49, 81, ...
49 * For a non-sparse filesystem it will be every group: 1, 2, 3, 4, ...
51 unsigned int ext2fs_list_backups(ext2_filsys fs, unsigned int *three,
52 unsigned int *five, unsigned int *seven)
54 unsigned int *min = three;
58 if (!(fs->super->s_feature_ro_compat &
59 EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER)) {