@@ -66,6 +66,7 @@ static size_t arg_chunk_size_min = 0;
6666static size_t arg_chunk_size_avg = 0 ;
6767static size_t arg_chunk_size_max = 0 ;
6868static uint64_t arg_rate_limit_bps = UINT64_MAX ;
69+ static unsigned arg_max_active_chunks = 0 ;
6970static uint64_t arg_with = 0 ;
7071static uint64_t arg_without = 0 ;
7172static uid_t arg_uid_shift = 0 , arg_uid_range = 0x10000U ;
@@ -107,6 +108,8 @@ static void help(void) {
107108 " -c --cache-auto Pick encoder cache directory automatically\n"
108109 " --rate-limit-bps=LIMIT Maximum bandwidth in bytes/s for remote\n"
109110 " communication\n"
111+ " --max-active-chunks=MAX Maximum number of simultaneously active chunks for\n"
112+ " remote communication\n"
110113 " --exclude-nodump=no Don't exclude files with chattr(1)'s +d 'nodump'\n"
111114 " flag when creating archive\n"
112115 " --exclude-submounts=yes Exclude submounts when creating archive\n"
@@ -328,6 +331,7 @@ static int parse_argv(int argc, char *argv[]) {
328331 ARG_SEED ,
329332 ARG_CACHE ,
330333 ARG_RATE_LIMIT_BPS ,
334+ ARG_MAX_ACTIVE_CHUNKS ,
331335 ARG_WITH ,
332336 ARG_WITHOUT ,
333337 ARG_WHAT ,
@@ -362,6 +366,7 @@ static int parse_argv(int argc, char *argv[]) {
362366 { "cache" , required_argument , NULL , ARG_CACHE },
363367 { "cache-auto" , no_argument , NULL , 'c' },
364368 { "rate-limit-bps" , required_argument , NULL , ARG_RATE_LIMIT_BPS },
369+ { "max-active-chunks" , required_argument , NULL , ARG_MAX_ACTIVE_CHUNKS },
365370 { "with" , required_argument , NULL , ARG_WITH },
366371 { "without" , required_argument , NULL , ARG_WITHOUT },
367372 { "what" , required_argument , NULL , ARG_WHAT },
@@ -475,6 +480,14 @@ static int parse_argv(int argc, char *argv[]) {
475480
476481 break ;
477482
483+ case ARG_MAX_ACTIVE_CHUNKS :
484+ r = safe_atou (optarg , & arg_max_active_chunks );
485+ if (r < 0 ) {
486+ log_error ("Failed to parse --max-active-chunks= value %s" , optarg );
487+ return - EINVAL ;
488+ }
489+ break ;
490+
478491 case ARG_WITH : {
479492 uint64_t u ;
480493
@@ -1330,6 +1343,12 @@ static int verb_make(int argc, char *argv[]) {
13301343 return log_error_errno (r , "Failed to set rate limit: %m" );
13311344 }
13321345
1346+ if (arg_max_active_chunks ) {
1347+ r = ca_sync_set_max_active_chunks (s , arg_max_active_chunks );
1348+ if (r < 0 )
1349+ return log_error_errno (r , "Failed to set max active chunks: %m" );
1350+ }
1351+
13331352 r = ca_sync_set_base_fd (s , input_fd );
13341353 if (r < 0 )
13351354 return log_error_errno (r , "Failed to set sync base: %m" );
@@ -1635,6 +1654,12 @@ static int verb_extract(int argc, char *argv[]) {
16351654 return log_error_errno (r , "Failed to set rate limit: %m" );
16361655 }
16371656
1657+ if (arg_max_active_chunks ) {
1658+ r = ca_sync_set_max_active_chunks (s , arg_max_active_chunks );
1659+ if (r < 0 )
1660+ return log_error_errno (r , "Failed to set max active chunks: %m" );
1661+ }
1662+
16381663 if (seek_path ) {
16391664 if (output_fd >= 0 )
16401665 r = ca_sync_set_boundary_fd (s , output_fd );
@@ -2796,6 +2821,12 @@ static int verb_mount(int argc, char *argv[]) {
27962821 return log_error_errno (r , "Failed to set rate limit: %m" );
27972822 }
27982823
2824+ if (arg_max_active_chunks ) {
2825+ r = ca_sync_set_max_active_chunks (s , arg_max_active_chunks );
2826+ if (r < 0 )
2827+ return log_error_errno (r , "Failed to set max active chunks: %m" );
2828+ }
2829+
27992830 if (operation == MOUNT_ARCHIVE ) {
28002831 if (input_fd >= 0 )
28012832 r = ca_sync_set_archive_fd (s , input_fd );
@@ -2922,6 +2953,12 @@ static int verb_mkdev(int argc, char *argv[]) {
29222953 return log_error_errno (r , "Failed to set rate limit: %m" );
29232954 }
29242955
2956+ if (arg_max_active_chunks ) {
2957+ r = ca_sync_set_max_active_chunks (s , arg_max_active_chunks );
2958+ if (r < 0 )
2959+ return log_error_errno (r , "Failed to set max active chunks: %m" );
2960+ }
2961+
29252962 if (operation == MKDEV_BLOB ) {
29262963 if (input_fd >= 0 )
29272964 r = ca_sync_set_archive_fd (s , input_fd );
@@ -3489,6 +3526,12 @@ static int verb_pull(int argc, char *argv[]) {
34893526 return log_error_errno (r , "Failed to set rate limit: %m" );
34903527 }
34913528
3529+ if (arg_max_active_chunks ) {
3530+ r = ca_remote_set_max_active_chunks (rr , arg_max_active_chunks );
3531+ if (r < 0 )
3532+ return log_error_errno (r , "Failed to set max active chunks: %m" );
3533+ }
3534+
34923535 r = ca_remote_set_io_fds (rr , STDIN_FILENO , STDOUT_FILENO );
34933536 if (r < 0 )
34943537 return log_error_errno (r , "Failed to set I/O file descriptors: %m" );
@@ -3648,6 +3691,12 @@ static int verb_push(int argc, char *argv[]) {
36483691 log_error_errno (r , "Failed to set rate limit: %m" );
36493692 }
36503693
3694+ if (arg_max_active_chunks ) {
3695+ r = ca_remote_set_max_active_chunks (rr , arg_max_active_chunks );
3696+ if (r < 0 )
3697+ return log_error_errno (r , "Failed to set max active chunks: %m" );
3698+ }
3699+
36513700 r = ca_remote_set_io_fds (rr , STDIN_FILENO , STDOUT_FILENO );
36523701 if (r < 0 )
36533702 log_error_errno (r , "Failed to set I/O file descriptors: %m" );
0 commit comments