Changeset 1196df6 in mainline for uspace/lib/ext4/libext4_extent.c


Ignore:
Timestamp:
2012-04-08T09:02:16Z (13 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6f41312
Parents:
3b5c119
Message:

extents: hotfix with writing to an existing empty file

File:
1 edited

Legend:

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

    r3b5c119 r1196df6  
    249249        ext4_extent_binsearch(header, &extent, iblock);
    250250
    251         assert(extent != NULL);
    252 
    253         uint32_t phys_block;
    254         phys_block = ext4_extent_get_start(extent) + iblock;
    255         phys_block -= ext4_extent_get_first_block(extent);
    256 
    257         *fblock = phys_block;
     251        if (extent == NULL) {
     252                *fblock = 0;
     253        } else {
     254                uint32_t phys_block;
     255                phys_block = ext4_extent_get_start(extent) + iblock;
     256                phys_block -= ext4_extent_get_first_block(extent);
     257
     258                *fblock = phys_block;
     259        }
    258260
    259261        if (block != NULL) {
    260262                block_put(block);
    261263        }
    262 
    263264
    264265        return EOK;
     
    396397}
    397398
    398 int ext4_extent_release_blocks_from(ext4_inode_ref_t *inode_ref, uint32_t iblock_from)
     399int ext4_extent_release_blocks_from(ext4_inode_ref_t *inode_ref,
     400                uint32_t iblock_from)
    399401{
    400402        int rc;
     
    600602
    601603        } else {
    602                 // try allocate succeeding extent block
     604                // try allocate scceeding extent block
    603605
    604606                // TODO
     
    609611
    610612finish:
     613
     614        *iblock = new_block_idx;
     615        *fblock = phys_block;
     616
    611617        // Put loaded blocks
    612618        // From 1 -> 0 is a block with inode data
Note: See TracChangeset for help on using the changeset viewer.