Use lzma_stream_encoder_mt() to enable xz parallel compression in the
xz write filter.

	--xtraeme

--- libarchive/archive_write_add_filter_xz.c.orig	2015-01-07 13:19:20.106417631 +0100
+++ libarchive/archive_write_add_filter_xz.c	2015-01-07 13:24:20.097461789 +0100
@@ -103,6 +103,7 @@ struct private_data {
 	lzma_stream	 stream;
 	lzma_filter	 lzmafilters[2];
 	lzma_options_lzma lzma_opt;
+	lzma_mt		 lzma_mt;
 	int64_t		 total_in;
 	unsigned char	*compressed;
 	size_t		 compressed_buffer_size;
@@ -151,6 +152,13 @@ common_setup(struct archive_write_filter
 	}
 	f->data = data;
 	data->compression_level = LZMA_PRESET_DEFAULT;
+	data->lzma_mt.check = LZMA_CHECK_CRC64;
+	data->lzma_mt.filters = data->lzmafilters;
+	data->lzma_mt.preset = data->compression_level;
+	data->lzma_mt.threads = lzma_cputhreads();
+	if (data->lzma_mt.threads == 0)
+		data->lzma_mt.threads = 1;
+
 	f->open = &archive_compressor_xz_open;
 	f->close = archive_compressor_xz_close;
 	f->free = archive_compressor_xz_free;
@@ -226,8 +234,7 @@ archive_compressor_xz_init_stream(struct
 	data->stream.next_out = data->compressed;
 	data->stream.avail_out = data->compressed_buffer_size;
 	if (f->code == ARCHIVE_FILTER_XZ)
-		ret = lzma_stream_encoder(&(data->stream),
-		    data->lzmafilters, LZMA_CHECK_CRC64);
+		ret = lzma_stream_encoder_mt(&(data->stream), &data->lzma_mt);
 	else if (f->code == ARCHIVE_FILTER_LZMA)
 		ret = lzma_alone_encoder(&(data->stream), &data->lzma_opt);
 	else {	/* ARCHIVE_FILTER_LZIP */
