-/*
- * Return the next free block in the map.
- */
-static int get_next_free_block(struct thread_data *td, struct fio_file *f,
- enum fio_ddir ddir, unsigned long long *b)
-{
- unsigned long long block, min_bs = td->o.rw_min_bs, lastb;
- int i;
-
- lastb = last_block(td, f, ddir);
- if (!lastb)
- return 1;
-
- i = f->last_free_lookup;
- block = i * BLOCKS_PER_MAP;
- while (block * min_bs < f->real_file_size &&
- block * min_bs < f->io_size) {
- if (f->file_map[i] != -1UL) {
- block += ffz(f->file_map[i]);
- if (block > lastb)
- break;
- f->last_free_lookup = i;
- *b = block;
- return 0;
- }
-
- block += BLOCKS_PER_MAP;
- i++;
- }
-
- dprint(FD_IO, "failed finding a free block\n");
- return 1;
-}
-