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


Ignore:
Timestamp:
2012-04-08T12:19:12Z (13 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_extent.c

    r847f2cb r936132f  
    550550        uint64_t inode_size = ext4_inode_get_size(sb, inode_ref->inode);
    551551
    552         ext4_extent_header_t *header =
    553                         ext4_inode_get_extent_header(inode_ref->inode);
    554 
    555         // Initialize if empty inode
    556         if (inode_size == 0) {
    557                 ext4_extent_t *first = EXT4_EXTENT_FIRST(header);
    558                 ext4_extent_set_block_count(first, 0);
    559                 ext4_extent_set_first_block(first, 0);
    560                 ext4_extent_set_start(first, 0);
    561 
    562                 ext4_extent_header_set_depth(header, 0);
    563                 ext4_extent_header_set_entries_count(header, 1);
    564         }
    565 
    566552        uint32_t block_size = ext4_superblock_get_block_size(sb);
    567553        uint32_t new_block_idx = inode_size / block_size;
     
    579565        }
    580566
    581         // Check if extent exists
    582         assert(path_ptr->extent != NULL);
     567        // if extent == NULL -> add extent to leaf
     568        if (path_ptr->extent == NULL) {
     569                ext4_extent_t *ext = EXT4_EXTENT_FIRST(path_ptr->header);
     570                ext4_extent_set_block_count(ext, 0);
     571
     572                ext4_extent_header_set_entries_count(path_ptr->header, 1);
     573
     574                path_ptr->extent = ext;
     575        }
    583576
    584577        uint32_t phys_block;
Note: See TracChangeset for help on using the changeset viewer.