flexnbd: Acknowledge new return type of bitset_run_count
This commit is contained in:
@@ -79,7 +79,7 @@ void client_destroy( struct client *client )
|
|||||||
* allocated, we can proceed as normal and make one call to writeloop.
|
* allocated, we can proceed as normal and make one call to writeloop.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void write_not_zeroes(struct client* client, uint64_t from, int len)
|
void write_not_zeroes(struct client* client, uint64_t from, uint64_t len)
|
||||||
{
|
{
|
||||||
NULLCHECK( client );
|
NULLCHECK( client );
|
||||||
NULLCHECK( client->serve );
|
NULLCHECK( client->serve );
|
||||||
@@ -96,7 +96,7 @@ void write_not_zeroes(struct client* client, uint64_t from, int len)
|
|||||||
* and end to get the exact number of bytes.
|
* and end to get the exact number of bytes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int run = bitset_run_count(map, from, len);
|
uint64_t run = bitset_run_count(map, from, len);
|
||||||
|
|
||||||
debug("write_not_zeroes: from=%ld, len=%d, run=%d", from, len, run);
|
debug("write_not_zeroes: from=%ld, len=%d, run=%d", from, len, run);
|
||||||
|
|
||||||
|
@@ -171,17 +171,17 @@ int mirror_pass(struct server * serve, int is_last_pass, uint64_t *written)
|
|||||||
|
|
||||||
|
|
||||||
while (current < serve->size) {
|
while (current < serve->size) {
|
||||||
int run = bitset_run_count(map, current, mirror_longest_write);
|
uint64_t run = bitset_run_count(map, current, mirror_longest_write);
|
||||||
|
|
||||||
if ( current + run > serve->size ) {
|
if ( current + run > serve->size ) {
|
||||||
debug(
|
debug(
|
||||||
"Size not divisible by %i, adjusting final block",
|
"Size not divisible by %i, adjusting final block",
|
||||||
block_allocation_resolution
|
block_allocation_resolution
|
||||||
);
|
);
|
||||||
run -= (( current + run ) - serve->size );
|
run = serve->size - current;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("mirror current=%ld, run=%d", current, run);
|
debug("mirror current=%"PRIu64", run=%"PRIu64, current, run);
|
||||||
|
|
||||||
/* FIXME: we could avoid sending sparse areas of the
|
/* FIXME: we could avoid sending sparse areas of the
|
||||||
* disc here, and probably save a lot of bandwidth and
|
* disc here, and probably save a lot of bandwidth and
|
||||||
|
@@ -149,14 +149,19 @@ END_TEST
|
|||||||
START_TEST( test_bitset_set )
|
START_TEST( test_bitset_set )
|
||||||
{
|
{
|
||||||
struct bitset_mapping* map;
|
struct bitset_mapping* map;
|
||||||
uint64_t *num;
|
|
||||||
|
|
||||||
map = bitset_alloc(64, 1);
|
map = bitset_alloc(64, 1);
|
||||||
num = (uint64_t*) map->bits;
|
|
||||||
|
|
||||||
ck_assert_int_eq( 0x0000000000000000, *num );
|
assert_bitset_is( map, 0x0000000000000000 );
|
||||||
bitset_set( map );
|
bitset_set( map );
|
||||||
ck_assert_int_eq( 0xffffffffffffffff, *num );
|
assert_bitset_is( map, 0xffffffffffffffff );
|
||||||
|
free( map );
|
||||||
|
|
||||||
|
map = bitset_alloc( 6400, 100 );
|
||||||
|
assert_bitset_is( map, 0x0000000000000000 );
|
||||||
|
bitset_set( map );
|
||||||
|
assert_bitset_is( map, 0xffffffffffffffff );
|
||||||
|
free( map );
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user