Changeset 1196df6 in mainline
- Timestamp:
- 2012-04-08T09:02:16Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6f41312
- Parents:
- 3b5c119
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/libext4_extent.c
r3b5c119 r1196df6 249 249 ext4_extent_binsearch(header, &extent, iblock); 250 250 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 } 258 260 259 261 if (block != NULL) { 260 262 block_put(block); 261 263 } 262 263 264 264 265 return EOK; … … 396 397 } 397 398 398 int ext4_extent_release_blocks_from(ext4_inode_ref_t *inode_ref, uint32_t iblock_from) 399 int ext4_extent_release_blocks_from(ext4_inode_ref_t *inode_ref, 400 uint32_t iblock_from) 399 401 { 400 402 int rc; … … 600 602 601 603 } else { 602 // try allocate s ucceeding extent block604 // try allocate scceeding extent block 603 605 604 606 // TODO … … 609 611 610 612 finish: 613 614 *iblock = new_block_idx; 615 *fblock = phys_block; 616 611 617 // Put loaded blocks 612 618 // From 1 -> 0 is a block with inode data -
uspace/lib/ext4/libext4_filesystem.c
r3b5c119 r1196df6 541 541 ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS)) { 542 542 543 rc = ext4_extent_release_blocks_from(inode_ref, old_blocks_count - diff_blocks_count); 543 rc = ext4_extent_release_blocks_from(inode_ref, 544 old_blocks_count - diff_blocks_count); 544 545 if (rc != EOK) { 545 546 return rc; -
uspace/srv/fs/ext4fs/ext4fs_ops.c
r3b5c119 r1196df6 1097 1097 1098 1098 if (fblock == 0) { 1099 rc = ext4_balloc_alloc_block(inode_ref, &fblock); 1100 if (rc != EOK) { 1101 ext4fs_node_put(fn); 1102 async_answer_0(callid, rc); 1103 return rc; 1104 } 1105 1106 rc = ext4_filesystem_set_inode_data_block_index(inode_ref, iblock, fblock); 1107 if (rc != EOK) { 1108 ext4_balloc_free_block(inode_ref, fblock); 1109 ext4fs_node_put(fn); 1110 async_answer_0(callid, rc); 1111 return rc; 1112 } 1099 1100 if (ext4_superblock_has_feature_incompatible( 1101 fs->superblock, EXT4_FEATURE_INCOMPAT_EXTENTS) && 1102 (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_EXTENTS))) { 1103 1104 uint32_t tmp_iblock = 0; 1105 do { 1106 rc = ext4_filesystem_append_inode_block(inode_ref, &fblock, &tmp_iblock); 1107 if (rc != EOK) { 1108 ext4fs_node_put(fn); 1109 async_answer_0(callid, rc); 1110 return rc; 1111 } 1112 } while (tmp_iblock < iblock); 1113 1114 } else { 1115 rc = ext4_balloc_alloc_block(inode_ref, &fblock); 1116 if (rc != EOK) { 1117 ext4fs_node_put(fn); 1118 async_answer_0(callid, rc); 1119 return rc; 1120 } 1121 1122 rc = ext4_filesystem_set_inode_data_block_index(inode_ref, iblock, fblock); 1123 if (rc != EOK) { 1124 ext4_balloc_free_block(inode_ref, fblock); 1125 ext4fs_node_put(fn); 1126 async_answer_0(callid, rc); 1127 return rc; 1128 } 1129 } 1130 1131 flags = BLOCK_FLAGS_NOREAD; 1113 1132 inode_ref->dirty = true; 1114 1115 flags = BLOCK_FLAGS_NOREAD;1116 1133 } 1117 1134
Note:
See TracChangeset
for help on using the changeset viewer.