* Create map of hash values, offsets, and sizes, stored at end of block. * Returns number of entries mapped. */
| 1303 | * Returns number of entries mapped. |
| 1304 | */ |
| 1305 | static int dx_make_map (struct ext3_dir_entry_2 *de, int size, |
| 1306 | struct dx_hash_info *hinfo, struct dx_map_entry *map_tail) |
| 1307 | { |
| 1308 | int count = 0; |
| 1309 | char *base = (char *) de; |
| 1310 | struct dx_hash_info h = *hinfo; |
| 1311 | |
| 1312 | while ((char *) de < base + size) |
| 1313 | { |
| 1314 | if (de->name_len && de->inode) { |
| 1315 | ext3_dirhash(de->name, de->name_len, &h); |
| 1316 | map_tail--; |
| 1317 | map_tail->hash = h.hash; |
| 1318 | map_tail->offs = (u16) ((char *) de - base); |
| 1319 | map_tail->size = le16_to_cpu(de->rec_len); |
| 1320 | count++; |
| 1321 | cond_resched(); |
| 1322 | } |
| 1323 | /* XXX: do we need to check rec_len == 0 case? -Chris */ |
| 1324 | de = (struct ext3_dir_entry_2 *) ((char *) de + le16_to_cpu(de->rec_len)); |
| 1325 | } |
| 1326 | return count; |
| 1327 | } |
| 1328 | |
| 1329 | /* Sort map by hash value */ |
| 1330 | static void dx_sort_map (struct dx_map_entry *map, unsigned count) |
no test coverage detected