]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - db/agfl.c
2 * Copyright (c) 2000-2001,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
19 #include <xfs/libxfs.h>
31 static int agfl_bno_size(void *obj
, int startoff
);
32 static int agfl_f(int argc
, char **argv
);
33 static void agfl_help(void);
35 static const cmdinfo_t agfl_cmd
=
36 { "agfl", NULL
, agfl_f
, 0, 1, 1, N_("[agno]"),
37 N_("set address to agfl block"), agfl_help
};
39 const field_t agfl_hfld
[] = { {
40 "", FLDT_AGFL
, OI(0), C1
, 0, TYP_NONE
, },
44 const field_t agfl_crc_hfld
[] = { {
45 "", FLDT_AGFL_CRC
, OI(0), C1
, 0, TYP_NONE
, },
49 #define OFF(f) bitize(offsetof(xfs_agfl_t, agfl_ ## f))
50 const field_t agfl_flds
[] = {
51 { "bno", FLDT_AGBLOCKNZ
, OI(OFF(magicnum
)), agfl_bno_size
,
52 FLD_ARRAY
|FLD_COUNT
, TYP_DATA
},
56 const field_t agfl_crc_flds
[] = {
57 { "magicnum", FLDT_UINT32X
, OI(OFF(magicnum
)), C1
, 0, TYP_NONE
},
58 { "seqno", FLDT_AGNUMBER
, OI(OFF(seqno
)), C1
, 0, TYP_NONE
},
59 { "uuid", FLDT_UUID
, OI(OFF(uuid
)), C1
, 0, TYP_NONE
},
60 { "lsn", FLDT_UINT64X
, OI(OFF(lsn
)), C1
, 0, TYP_NONE
},
61 { "crc", FLDT_UINT32X
, OI(OFF(crc
)), C1
, 0, TYP_NONE
},
62 { "bno", FLDT_AGBLOCKNZ
, OI(OFF(bno
)), agfl_bno_size
,
63 FLD_ARRAY
|FLD_COUNT
, TYP_DATA
},
72 return XFS_AGFL_SIZE(mp
);
80 " set allocation group freelist\n"
86 " Located in the fourth sector of each allocation group,\n"
87 " the agfl freelist for internal btree space allocation is maintained\n"
88 " for each allocation group. This acts as a reserved pool of space\n"
89 " separate from the general filesystem freespace (not used for user data).\n"
104 agno
= (xfs_agnumber_t
)strtoul(argv
[1], &p
, 0);
105 if (*p
!= '\0' || agno
>= mp
->m_sb
.sb_agcount
) {
106 dbprintf(_("bad allocation group number %s\n"), argv
[1]);
110 } else if (cur_agno
== NULLAGNUMBER
)
112 ASSERT(typtab
[TYP_AGFL
].typnm
== TYP_AGFL
);
113 set_cur(&typtab
[TYP_AGFL
],
114 XFS_AG_DADDR(mp
, cur_agno
, XFS_AGFL_DADDR(mp
)),
115 XFS_FSS_TO_BB(mp
, 1), DB_RING_ADD
, NULL
);
122 add_command(&agfl_cmd
);
132 return bitize(mp
->m_sb
.sb_sectsize
);