Changeset 30ac3c3 in mainline


Ignore:
Timestamp:
2012-03-26T06:57:04Z (12 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9463b245
Parents:
6514d1f
Message:

some debugging modifications, not yet completely debugged binary search in index node

File:
1 edited

Legend:

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

    r6514d1f r30ac3c3  
    149149}
    150150
    151 //static void ext4_extent_binsearch_idx(ext4_extent_path_t *path, uint32_t iblock)
     151//static void ext4_extent_binsearch_idx(ext4_extent_header_t *header,
     152//      ext4_extent_index_t **index, uint32_t iblock)
    152153//{
    153 //      ext4_extent_header_t *header = path->header;
    154154//      ext4_extent_index_t *r, *l, *m;
    155155//
     
    168168//      }
    169169//
    170 //      path->index = l - 1;
     170//      *index = l - 1;
    171171//}
    172172//
    173 static void ext4_extent_binsearch(ext4_extent_path_t *path, uint32_t iblock)
    174 {
    175         ext4_extent_header_t *header = path->header;
     173static void ext4_extent_binsearch(ext4_extent_header_t *header,
     174                ext4_extent_t **extent, uint32_t iblock)
     175{
    176176        ext4_extent_t *r, *l, *m;
    177177
     
    196196        }
    197197
    198         path->extent = l - 1;
     198        *extent = l - 1;
    199199
    200200}
     
    210210        while (ext4_extent_header_get_depth(header) != 0) {
    211211
     212//              ext4_extent_path_t path2;
     213//              path2.header = header;
     214//              path2.index = NULL;
     215//              ext4_extent_binsearch_idx(header, &path2.index, iblock);
     216//
     217//              uint64_t child = ext4_extent_index_get_leaf(path2.index);
     218//              if (block != NULL) {
     219//                      block_put(block);
     220//              }
     221//
     222//              rc = block_get(&block, fs->device, child, BLOCK_FLAGS_NONE);
     223//              if (rc != EOK) {
     224//                      return rc;
     225//              }
     226//
     227//              header = block->data;
     228//              break;
     229
     230
    212231                ext4_extent_index_t *extent_index = EXT4_EXTENT_FIRST_INDEX(header);
    213232
    214                 for (uint16_t i = 0; i < ext4_extent_header_get_entries_count(header); ++i) {
     233                for (uint16_t i = 0; i < ext4_extent_header_get_entries_count(header); ++i, extent_index++) {
    215234                        if (iblock >= ext4_extent_index_get_first_block(extent_index)) {
    216235
     
    238257        path.extent = NULL;
    239258
    240         ext4_extent_binsearch(&path, iblock);
     259        ext4_extent_binsearch(path.header, &path.extent, iblock);
    241260
    242261        *ret_extent = path.extent;
    243 
    244 //      for (uint16_t i = 0; i < ext4_extent_header_get_entries_count(header); ++i) {
    245 //
    246 //              uint32_t first_block = ext4_extent_get_first_block(extent);
    247 //              uint16_t block_count = ext4_extent_get_block_count(extent);
    248 //
    249 //              if ((iblock >= first_block) && (iblock < first_block + block_count)) {
    250 //                      break;
    251 //              }
    252 //              // Go to the next extent
    253 //              ++extent;
    254 //      }
    255 //
    256 //      *ret_extent = extent;
    257262
    258263        return EOK;
Note: See TracChangeset for help on using the changeset viewer.