Changeset 6dd7f65 in mainline


Ignore:
Timestamp:
2015-04-15T20:14:27Z (9 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
447201e
Parents:
749fe15b
Message:

libext4: add missing parts that will be needed to support flexible block groups

  • Add function to read the superblock's fields "backup_bgs" (SUPER_SPARSE2).
  • Add function to get the number of reserved GDT blocks.
  • Drop the "s_" prefix from some superblock's fields.
Location:
uspace/lib/ext4
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/libext4_superblock.c

    r749fe15b r6dd7f65  
    12981298}
    12991299
     1300/** Get the backup groups used with SPARSE_SUPER2
     1301 *
     1302 * @param sb    Pointer to the superblock
     1303 * @param g1    Output pointer to the first backup group
     1304 * @param g2    Output pointer to the second backup group
     1305 */
     1306void ext4_superblock_get_backup_groups_sparse2(ext4_superblock_t *sb,
     1307    uint32_t *g1, uint32_t *g2)
     1308{
     1309        *g1 = uint32_t_le2host(sb->backup_bgs[0]);
     1310        *g2 = uint32_t_le2host(sb->backup_bgs[1]);
     1311}
     1312
     1313/** Set the backup groups (SPARSE SUPER2)
     1314 *
     1315 * @param sb    Pointer to the superblock
     1316 * @param g1    Index of the first group
     1317 * @param g2    Index of the second group
     1318 */
     1319void ext4_superblock_set_backup_groups_sparse2(ext4_superblock_t *sb,
     1320    uint32_t g1, uint32_t g2)
     1321{
     1322        sb->backup_bgs[0] = host2uint32_t_le(g1);
     1323        sb->backup_bgs[1] = host2uint32_t_le(g2);
     1324}
     1325
     1326/** Get the number of blocks (per group) reserved to GDT expansion
     1327 *
     1328 * @param sb    Pointer to the superblock
     1329 *
     1330 * @return      Number of blocks
     1331 */
     1332uint32_t ext4_superblock_get_reserved_gdt_blocks(ext4_superblock_t *sb)
     1333{
     1334        return uint32_t_le2host(sb->reserved_gdt_blocks);
     1335}
     1336
     1337/** Set the number of blocks (per group) reserved to GDT expansion
     1338 *
     1339 * @param sb    Pointer to the superblock
     1340 * @param n     Number of reserved blocks
     1341 */
     1342void ext4_superblock_set_reserved_gdt_blocks(ext4_superblock_t *sb,
     1343    uint32_t n)
     1344{
     1345        sb->reserved_gdt_blocks = host2uint32_t_le(n);
     1346}
     1347
    13001348/**
    13011349 * @}
  • uspace/lib/ext4/libext4_superblock.h

    r749fe15b r6dd7f65  
    135135extern void ext4_superblock_set_flags(ext4_superblock_t *, uint32_t);
    136136
     137extern void ext4_superblock_get_backup_groups_sparse2(ext4_superblock_t *sb,
     138    uint32_t *g1, uint32_t *g2);
     139extern void ext4_superblock_set_backup_groups_sparse2(ext4_superblock_t *sb,
     140    uint32_t g1, uint32_t g2);
     141
     142extern uint32_t ext4_superblock_get_reserved_gdt_blocks(ext4_superblock_t *sb);
     143extern void ext4_superblock_set_reserved_gdt_blocks(ext4_superblock_t *sb,
     144    uint32_t n);
     145
    137146/* More complex superblock functions */
    138147extern bool ext4_superblock_has_flag(ext4_superblock_t *, uint32_t);
  • uspace/lib/ext4/libext4_types.h

    r749fe15b r6dd7f65  
    8383         * happen if the EXT4_FEATURE_COMPAT_DIR_PREALLOC flag is on.
    8484         */
    85         uint8_t s_prealloc_blocks;       /* Number of blocks to try to preallocate */
    86         uint8_t s_prealloc_dir_blocks;   /* Number to preallocate for dirs */
    87         uint16_t s_reserved_gdt_blocks;  /* Per group desc for online growth */
     85        uint8_t prealloc_blocks;        /* Number of blocks to try to preallocate */
     86        uint8_t prealloc_dir_blocks;    /* Number to preallocate for dirs */
     87        uint16_t reserved_gdt_blocks;   /* Per group desc for online growth */
    8888       
    8989        /*
     
    133133        uint64_t last_error_block;          /* Block involved of last error */
    134134        uint8_t last_error_func[32];        /* Function where the error happened */
    135         uint8_t mount_opts[64];
    136         uint32_t padding[112];              /* Padding to the end of the block */
     135        uint8_t mount_opts[64];             /* String containing the mount options */
     136        uint32_t usr_quota_inum;            /* Inode number of user quota file */
     137        uint32_t grp_quota_inum;            /* Inode number of group quota file */
     138        uint32_t overhead_blocks;           /* Overhead blocks/clusters */
     139        uint32_t backup_bgs[2];             /* Block groups containing superblock backups (if SPARSE_SUPER2) */
     140        uint32_t encrypt_algos;             /* Encrypt algorithm in use */
     141        uint32_t padding[105];              /* Padding to the end of the block */
    137142} __attribute__((packed)) ext4_superblock_t;
    138143
     
    176181#define EXT4_FEATURE_COMPAT_RESIZE_INODE   0x0010
    177182#define EXT4_FEATURE_COMPAT_DIR_INDEX      0x0020
     183#define EXT4_FEATURE_COMPAT_SPARSE_SUPER2  0x0200
    178184
    179185/*
Note: See TracChangeset for help on using the changeset viewer.