aboutsummaryrefslogtreecommitdiffstats
path: root/btrfs-image.c
diff options
context:
space:
mode:
authorZhao Lei <zhaolei@cn.fujitsu.com>2015-09-09 21:32:22 +0800
committerDavid Sterba <dsterba@suse.com>2015-09-11 17:02:52 +0200
commitde554435e8ed18aea9f8a4da876c2b5a67bdc0ee (patch)
treefd9e79331d2603c5ff6a283143eab595eb35f24d /btrfs-image.c
parent50ef0322b4aecf8c5ea8031aa4f022619d255f10 (diff)
downloadbtrfs-progs-de554435e8ed18aea9f8a4da876c2b5a67bdc0ee.tar.gz
btrfs-progs-de554435e8ed18aea9f8a4da876c2b5a67bdc0ee.tar.xz
btrfs-progs-de554435e8ed18aea9f8a4da876c2b5a67bdc0ee.zip
btrfs-progs: image: don't create unused threads
In case of creating an image without compression, we don't need to create unused threads. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'btrfs-image.c')
-rw-r--r--btrfs-image.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/btrfs-image.c b/btrfs-image.c
index 6eddbd5..551487f 100644
--- a/btrfs-image.c
+++ b/btrfs-image.c
@@ -2786,11 +2786,14 @@ int main(int argc, char *argv[])
}
}
- if ((compress_level > 0 || create == 0) &&
- num_threads == 0) {
- num_threads = sysconf(_SC_NPROCESSORS_ONLN);
- if (num_threads <= 0)
- num_threads = 1;
+ if (compress_level > 0 || create == 0) {
+ if (num_threads == 0) {
+ num_threads = sysconf(_SC_NPROCESSORS_ONLN);
+ if (num_threads <= 0)
+ num_threads = 1;
+ }
+ } else {
+ num_threads = 0;
}
if (create) {