NVSL / linux-nova

NOVA is a log-structured file system designed for byte-addressable non-volatile memories, developed at the University of California, San Diego.
http://nvsl.ucsd.edu/index.php?path=projects/nova
Other
421 stars 117 forks source link

Code for printing out snapshots misuses radix tree gang lookups #52

Closed stevenjswanson closed 7 years ago

stevenjswanson commented 7 years ago

In several spots in snapshot.c we have something like this:

    /* Print in epoch ID increasing order */
    do {
        nr_infos = radix_tree_gang_lookup(&sbi->snapshot_info_tree,
                    (void **)infos, epoch_id, FREE_BATCH);
        for (i = 0; i < nr_infos; i++) {
            info = infos[i];
            BUG_ON(!info);
            epoch_id = info->epoch_id;
            nova_print_snapshot_info(info, seq);
            count++;
        }
        epoch_id++;

    } while (nr_infos == FREE_BATCH);  

But https://lwn.net/Articles/175432/ points out that "The number of items returned may be less than requested, but a short return (other than zero) does not imply that there are no more values in the tree."

Andiry commented 7 years ago

True. Seems the while condition should be nr_infos > 0.