Changeset 936132f in mainline for uspace/lib/ext4/libext4_filesystem.c


Ignore:
Timestamp:
2012-04-08T12:19:12Z (12 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b73530a
Parents:
847f2cb
Message:

extent file initialization and allocation

File:
1 edited

Legend:

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

    r847f2cb r936132f  
    342342        }
    343343
    344         if (ext4_superblock_has_feature_incompatible(
    345                         fs->superblock, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
    346                 ext4_inode_set_flag(inode, EXT4_INODE_FLAG_EXTENTS);
    347         }
    348 
    349344        ext4_inode_set_uid(inode, 0);
    350345        ext4_inode_set_gid(inode, 0);
     
    358353        ext4_inode_set_generation(inode, 0);
    359354
     355        // Reset blocks array
    360356        for (uint32_t i = 0; i < EXT4_INODE_BLOCKS; i++) {
    361357                inode->blocks[i] = 0;
     358        }
     359
     360        if (ext4_superblock_has_feature_incompatible(
     361                        fs->superblock, EXT4_FEATURE_INCOMPAT_EXTENTS)) {
     362
     363                ext4_inode_set_flag(inode, EXT4_INODE_FLAG_EXTENTS);
     364
     365                // Initialize extent root header
     366                ext4_extent_header_t *header = ext4_inode_get_extent_header(inode);
     367                ext4_extent_header_set_depth(header, 0);
     368                ext4_extent_header_set_entries_count(header, 0);
     369                ext4_extent_header_set_generation(header, 0);
     370                ext4_extent_header_set_magic(header, EXT4_EXTENT_MAGIC);
     371
     372                uint16_t max_entries = (EXT4_INODE_BLOCKS * sizeof (uint32_t) - sizeof(ext4_extent_header_t))
     373                                / sizeof(ext4_extent_t);
     374
     375                ext4_extent_header_set_max_entries_count(header, max_entries);
    362376        }
    363377
Note: See TracChangeset for help on using the changeset viewer.