aboutsummaryrefslogtreecommitdiff
path: root/mkfs
diff options
context:
space:
mode:
Diffstat (limited to 'mkfs')
-rw-r--r--mkfs/mkfs.c2
-rw-r--r--mkfs/mkfs.h1
-rw-r--r--mkfs/options.c17
3 files changed, 18 insertions, 2 deletions
diff --git a/mkfs/mkfs.c b/mkfs/mkfs.c
index 919ec20..fda9831 100644
--- a/mkfs/mkfs.c
+++ b/mkfs/mkfs.c
@@ -165,7 +165,7 @@ int main(int argc, char **argv)
super.flags |= SQFS_FLAG_COMPRESSOR_OPTIONS;
data = data_writer_create(&super, cmp, outfile,
- opt.devblksz, opt.num_jobs);
+ opt.devblksz, opt.num_jobs, opt.max_backlog);
if (data == NULL)
goto out_cmp;
diff --git a/mkfs/mkfs.h b/mkfs/mkfs.h
index 7ad9460..9d34d02 100644
--- a/mkfs/mkfs.h
+++ b/mkfs/mkfs.h
@@ -39,6 +39,7 @@ typedef struct {
int devblksz;
unsigned int dirscan_flags;
unsigned int num_jobs;
+ size_t max_backlog;
bool exportable;
bool quiet;
const char *infile;
diff --git a/mkfs/options.c b/mkfs/options.c
index 7b83ec4..f15569a 100644
--- a/mkfs/options.c
+++ b/mkfs/options.c
@@ -15,6 +15,7 @@ static struct option long_opts[] = {
{ "pack-file", required_argument, NULL, 'F' },
{ "pack-dir", required_argument, NULL, 'D' },
{ "num-jobs", required_argument, NULL, 'j' },
+ { "queue-backlog", required_argument, NULL, 'Q' },
{ "keep-time", no_argument, NULL, 'k' },
#ifdef HAVE_SYS_XATTR_H
{ "keep-xattr", no_argument, NULL, 'x' },
@@ -30,7 +31,7 @@ static struct option long_opts[] = {
{ "help", no_argument, NULL, 'h' },
};
-static const char *short_opts = "F:D:X:c:b:B:d:j:kxoefqhV"
+static const char *short_opts = "F:D:X:c:b:B:d:j:Q:kxoefqhV"
#ifdef WITH_SELINUX
"s:"
#endif
@@ -65,6 +66,10 @@ static const char *help_string =
" the selected compressor. Specify 'help' to\n"
" get a list of available options.\n"
" --num-jobs, -j <count> Number of compressor jobs to create.\n"
+" --queue-backlog, -Q <count> Maximum number of data blocks in the thread\n"
+" worker queue before the packer starts waiting\n"
+" for the block processors to catch up.\n"
+" Defaults to 10 times the number of jobs.\n"
" --block-size, -b <size> Block size to use for Squashfs image.\n"
" Defaults to %u.\n"
" --dev-block-size, -B <size> Device block size to padd the image to.\n"
@@ -151,6 +156,7 @@ void process_command_line(options_t *opt, int argc, char **argv)
opt->blksz = SQFS_DEFAULT_BLOCK_SIZE;
opt->devblksz = SQFS_DEVBLK_SIZE;
opt->num_jobs = 1;
+ opt->max_backlog = 0;
for (;;) {
i = getopt_long(argc, argv, short_opts, long_opts, NULL);
@@ -181,6 +187,9 @@ void process_command_line(options_t *opt, int argc, char **argv)
case 'j':
opt->num_jobs = strtol(optarg, NULL, 0);
break;
+ case 'Q':
+ opt->max_backlog = strtol(optarg, NULL, 0);
+ break;
case 'B':
opt->devblksz = strtol(optarg, NULL, 0);
if (opt->devblksz < 1024) {
@@ -240,6 +249,12 @@ void process_command_line(options_t *opt, int argc, char **argv)
}
}
+ if (opt->num_jobs < 1)
+ opt->num_jobs = 1;
+
+ if (opt->max_backlog < 1)
+ opt->max_backlog = 10 * opt->num_jobs;
+
if (opt->comp_extra != NULL && strcmp(opt->comp_extra, "help") == 0) {
compressor_print_help(opt->compressor);
exit(EXIT_SUCCESS);