Changeset 412f813 in mainline for uspace/lib/ext4/libext4_directory_index.c
- Timestamp:
- 2012-02-28T19:18:39Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e2ec667e
- Parents:
- 41998ec
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.