]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - db/agfl.c
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2000-2001,2005 Silicon Graphics, Inc.
19 static int agfl_bno_size(void *obj
, int startoff
);
20 static int agfl_f(int argc
, char **argv
);
21 static void agfl_help(void);
23 static const cmdinfo_t agfl_cmd
=
24 { "agfl", NULL
, agfl_f
, 0, 1, 1, N_("[agno]"),
25 N_("set address to agfl block"), agfl_help
};
27 const field_t agfl_hfld
[] = { {
28 "", FLDT_AGFL
, OI(0), C1
, 0, TYP_NONE
, },
32 const field_t agfl_crc_hfld
[] = { {
33 "", FLDT_AGFL_CRC
, OI(0), C1
, 0, TYP_NONE
, },
37 #define OFF(f) bitize(offsetof(struct xfs_agfl, agfl_ ## f))
38 const field_t agfl_flds
[] = {
39 { "bno", FLDT_AGBLOCKNZ
, OI(OFF(magicnum
)), agfl_bno_size
,
40 FLD_ARRAY
|FLD_COUNT
, TYP_DATA
},
44 const field_t agfl_crc_flds
[] = {
45 { "magicnum", FLDT_UINT32X
, OI(OFF(magicnum
)), C1
, 0, TYP_NONE
},
46 { "seqno", FLDT_AGNUMBER
, OI(OFF(seqno
)), C1
, 0, TYP_NONE
},
47 { "uuid", FLDT_UUID
, OI(OFF(uuid
)), C1
, 0, TYP_NONE
},
48 { "lsn", FLDT_UINT64X
, OI(OFF(lsn
)), C1
, 0, TYP_NONE
},
49 { "crc", FLDT_CRC
, OI(OFF(crc
)), C1
, 0, TYP_NONE
},
50 /* the bno array is after the actual structure */
51 { "bno", FLDT_AGBLOCKNZ
, OI(bitize(sizeof(struct xfs_agfl
))),
52 agfl_bno_size
, FLD_ARRAY
|FLD_COUNT
, TYP_DATA
},
61 return libxfs_agfl_size(mp
);
69 " set allocation group freelist\n"
75 " Located in the fourth sector of each allocation group,\n"
76 " the agfl freelist for internal btree space allocation is maintained\n"
77 " for each allocation group. This acts as a reserved pool of space\n"
78 " separate from the general filesystem freespace (not used for user data).\n"
93 agno
= (xfs_agnumber_t
)strtoul(argv
[1], &p
, 0);
94 if (*p
!= '\0' || agno
>= mp
->m_sb
.sb_agcount
) {
95 dbprintf(_("bad allocation group number %s\n"), argv
[1]);
99 } else if (cur_agno
== NULLAGNUMBER
)
101 ASSERT(typtab
[TYP_AGFL
].typnm
== TYP_AGFL
);
102 set_cur(&typtab
[TYP_AGFL
],
103 XFS_AG_DADDR(mp
, cur_agno
, XFS_AGFL_DADDR(mp
)),
104 XFS_FSS_TO_BB(mp
, 1), DB_RING_ADD
, NULL
);
111 add_command(&agfl_cmd
);
121 return bitize(mp
->m_sb
.sb_sectsize
);