Changeset 412f813 in mainline
- Timestamp:
- 2012-02-28T19:18:39Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e2ec667e
- Parents:
- 41998ec
- Location:
- uspace/lib/ext4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/libext4_balloc.c
r41998ec r412f813 242 242 } 243 243 244 int ext4_balloc_alloc_block(ext4_filesystem_t *fs, ext4_inode_ref_t *inode_ref, uint32_t *fblock) 244 int ext4_balloc_alloc_block(ext4_filesystem_t *fs, 245 ext4_inode_ref_t *inode_ref, uint32_t *fblock) 245 246 { 246 247 int rc; … … 462 463 463 464 // Update inode blocks (different block size!) count 465 464 466 uint64_t ino_blocks = ext4_inode_get_blocks_count(fs->superblock, inode_ref->inode); 465 467 ino_blocks += block_size / EXT4_INODE_BLOCK_SIZE; -
uspace/lib/ext4/libext4_directory_index.c
r41998ec r412f813 510 510 511 511 while ((void *)dentry < old_data_block->data + block_size) { 512 char *name = (char *)dentry->name; 513 514 uint8_t len = ext4_directory_entry_ll_get_name_length(fs->superblock, dentry); 515 ext4_hash_string(&tmp_hinfo, len, name); 516 517 uint32_t rec_len = 8 + len; 518 519 if ((rec_len % 4) != 0) { 520 rec_len += 4 - (rec_len % 4); 521 } 522 523 memcpy(entry_buffer_ptr, dentry, rec_len); 524 525 sort_array[idx].dentry = entry_buffer_ptr; 526 sort_array[idx].rec_len = rec_len; 527 sort_array[idx].hash = tmp_hinfo.hash; 528 529 entry_buffer_ptr += rec_len; 530 real_size += rec_len; 531 532 idx++; 512 513 // Read only valid entries 514 if (ext4_directory_entry_ll_get_inode(dentry) != 0) { 515 char *name = (char *)dentry->name; 516 517 uint8_t len = ext4_directory_entry_ll_get_name_length(fs->superblock, dentry); 518 ext4_hash_string(&tmp_hinfo, len, name); 519 520 uint32_t rec_len = 8 + len; 521 522 if ((rec_len % 4) != 0) { 523 rec_len += 4 - (rec_len % 4); 524 } 525 526 memcpy(entry_buffer_ptr, dentry, rec_len); 527 528 sort_array[idx].dentry = entry_buffer_ptr; 529 sort_array[idx].rec_len = rec_len; 530 sort_array[idx].hash = tmp_hinfo.hash; 531 532 entry_buffer_ptr += rec_len; 533 real_size += rec_len; 534 idx++; 535 } 536 533 537 dentry = (void *)dentry + ext4_directory_entry_ll_get_entry_length(dentry); 534 538 } … … 571 575 } 572 576 577 uint32_t continued = 0; 578 if (new_hash == sort_array[mid-1].hash) { 579 continued = 1; 580 } 581 573 582 uint32_t offset = 0; 574 583 void *ptr; … … 624 633 625 634 ext4_directory_dx_entry_set_block(new_index_entry, new_iblock); 626 ext4_directory_dx_entry_set_hash(new_index_entry, new_hash );635 ext4_directory_dx_entry_set_hash(new_index_entry, new_hash + continued); 627 636 628 637 ext4_directory_dx_countlimit_set_count(countlimit, count + 1); … … 844 853 success: 845 854 846 block_put(target_block); 847 block_put(new_block); 855 rc = block_put(target_block); 856 if (rc != EOK) { 857 EXT4FS_DBG("error writing target block"); 858 } 859 rc = block_put(new_block); 860 if (rc != EOK) { 861 EXT4FS_DBG("error writing new block"); 862 } 848 863 849 864 ext4_directory_dx_block_t *dx_it = dx_blocks; 850 865 851 866 while (dx_it <= dx_block) { 852 block_put(dx_it->block); 867 rc = block_put(dx_it->block); 868 if (rc != EOK) { 869 EXT4FS_DBG("error writing index block \%u", (uint32_t)dx_it->block->pba); 870 } 853 871 dx_it++; 854 872 }
Note:
See TracChangeset
for help on using the changeset viewer.