@@ -1688,70 +1688,6 @@ static int qgroup_parse_sort_string(const char *opt_arg,
16881688 return ret ;
16891689}
16901690
1691- int btrfs_qgroup_inherit_size (struct btrfs_qgroup_inherit * p )
1692- {
1693- return sizeof (* p ) + sizeof (p -> qgroups [0 ]) *
1694- (p -> num_qgroups + 2 * p -> num_ref_copies +
1695- 2 * p -> num_excl_copies );
1696- }
1697-
1698- static int qgroup_inherit_realloc (struct btrfs_qgroup_inherit * * inherit , int n ,
1699- int pos )
1700- {
1701- struct btrfs_qgroup_inherit * out ;
1702- int nitems = 0 ;
1703-
1704- if (* inherit ) {
1705- nitems = (* inherit )-> num_qgroups +
1706- (* inherit )-> num_ref_copies +
1707- (* inherit )-> num_excl_copies ;
1708- }
1709-
1710- out = calloc (1 , sizeof (* out ) + sizeof (out -> qgroups [0 ]) * (nitems + n ));
1711- if (out == NULL ) {
1712- error_msg (ERROR_MSG_MEMORY , NULL );
1713- return - ENOMEM ;
1714- }
1715-
1716- if (* inherit ) {
1717- struct btrfs_qgroup_inherit * i = * inherit ;
1718- int s = sizeof (out -> qgroups [0 ]);
1719-
1720- out -> num_qgroups = i -> num_qgroups ;
1721- out -> num_ref_copies = i -> num_ref_copies ;
1722- out -> num_excl_copies = i -> num_excl_copies ;
1723- memcpy (out -> qgroups , i -> qgroups , pos * s );
1724- memcpy (out -> qgroups + pos + n , i -> qgroups + pos ,
1725- (nitems - pos ) * s );
1726- }
1727- free (* inherit );
1728- * inherit = out ;
1729-
1730- return 0 ;
1731- }
1732-
1733- int btrfs_qgroup_inherit_add_group (struct btrfs_qgroup_inherit * * inherit , char * arg )
1734- {
1735- int ret ;
1736- u64 qgroupid = parse_qgroupid_or_path (arg );
1737- int pos = 0 ;
1738-
1739- if (qgroupid == 0 ) {
1740- error ("invalid qgroup specification, qgroupid must not 0" );
1741- return - EINVAL ;
1742- }
1743-
1744- if (* inherit )
1745- pos = (* inherit )-> num_qgroups ;
1746- ret = qgroup_inherit_realloc (inherit , 1 , pos );
1747- if (ret )
1748- return ret ;
1749-
1750- (* inherit )-> qgroups [(* inherit )-> num_qgroups ++ ] = qgroupid ;
1751-
1752- return 0 ;
1753- }
1754-
17551691static const char * const qgroup_cmd_group_usage [] = {
17561692 "btrfs qgroup <command> [options] <path>" ,
17571693 NULL
0 commit comments