[PATCH 2/3] btrfs-progs: don't create no-used threads in btrfs-image

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In case of creating image without compess, we don't need to create
many no-used compress threads.

Signed-off-by: Zhao Lei <zhaolei@xxxxxxxxxxxxxx>
---
 btrfs-image.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/btrfs-image.c b/btrfs-image.c
index 7f49cce..c7681f4 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) {
-- 
1.8.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux