Fixed mirroring to work (error reporting suspect though).
This commit is contained in:
10
serve.c
10
serve.c
@@ -327,10 +327,16 @@ void* mirror_runner(void* serve_params_uncast)
|
||||
for (pass=0; pass < 7 /* biblical */; pass++) {
|
||||
uint64_t current = 0;
|
||||
|
||||
debug("mirror start pass=%d", pass);
|
||||
|
||||
while (current < serve->size) {
|
||||
int run = bitset_run_count(map, current, longest_run);
|
||||
|
||||
debug("mirror current=%d, run=%d", current, run);
|
||||
|
||||
if (bitset_is_set_at(map, current)) {
|
||||
debug("^^^ writing", current, run);
|
||||
|
||||
/* dirty area */
|
||||
socket_nbd_write(
|
||||
serve->mirror->client,
|
||||
@@ -351,7 +357,7 @@ void* mirror_runner(void* serve_params_uncast)
|
||||
|
||||
void control_mirror(struct control_params* client)
|
||||
{
|
||||
off64_t size;
|
||||
off64_t size, remote_size;
|
||||
int fd, map_fd;
|
||||
struct mirror_status *mirror;
|
||||
union mysockaddr connect_to;
|
||||
@@ -377,6 +383,8 @@ void control_mirror(struct control_params* client)
|
||||
|
||||
fd = socket_connect(&connect_to.generic); /* FIXME uses wrong error handler */
|
||||
|
||||
remote_size = socket_nbd_read_hello(fd);
|
||||
|
||||
mirror = xmalloc(sizeof(struct mirror_status));
|
||||
mirror->client = fd;
|
||||
mirror->max_bytes_per_second = 0;
|
||||
|
Reference in New Issue
Block a user