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