[PATCH 1/8] libblock: Add sparse disk
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Nov 30 08:13:17 UTC 2012
Hello Gedare,
thanks for your review.
On 11/29/2012 05:55 PM, Gedare Bloom wrote:
> + sc = rtems_semaphore_create(
> + rtems_build_name('S', 'P', 'A', 'R'),
> + 1,
> + RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY,
> + 0,
> + &sd->mutex
> + );
>
> This semaphore should be accounted in application configuration requirements,
> either explicitly by applications that use the rtems_sparse_disk, or with some
> macro that detects it..
This sparse disk is only for testing purposes. I don't think we should pollute
confdefs.h with it.
[...]
> +static rtems_sparse_disk_key *
> + sparse_disk_get_new_block(
> + rtems_sparse_disk *sparse_disk,
> + const rtems_blkdev_bnum block
> +)
> +{
> + rtems_sparse_disk_key *key;
> +
> + if (sparse_disk->used_count < sparse_disk->blocks_allocated) {
> + key = &sparse_disk->key_table [sparse_disk->used_count];
> + key->block = block;
> + ++sparse_disk->used_count;
> + qsort(sparse_disk->key_table, sparse_disk->used_count,
> sizeof(rtems_sparse_disk_key), sparse_disk_compare);
>
> is quicksort every time OK here? is a sorted array the best structure to use,
> or should a tree be used? Just wondering out loud.
The origin of this code predates your tree contribution. For us this
implementation is ok since it is only for testing.
--
Sebastian Huber, embedded brains GmbH
Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the devel
mailing list