From patchwork Wed Jun 6 12:55:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michele Dionisio X-Patchwork-Id: 925827 X-Patchwork-Delegate: richard@nod.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QzIW1txO"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="O0nNZQ5c"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4117vd6LhVzB3h4 for ; Wed, 6 Jun 2018 22:55:57 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:To:Subject: Message-ID:Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=Kl/l2wv186QtcKK2ELvacaZUq8vOjtbfwFFtfBp0DPQ=; b=QzIW1txOLu4SnPcDSH0dp6S8bK xcn96P1An/JrlRgfKD32nQf7xWuDKoV7hTh31pt0MVxZWiwWgZ3m8TAhLZRuhgnYlrlNH2ye//0fN PoJY4ZtJUbcAFPryOPuRGbTAzcl5fTE5e+ibBYxI3eC2BavKhuCDmZDfsnJsojwBngPwFj281NU/U 0pG2eM/eHc+rk8pkJ2oKktRt7FIY1GTVp2XYUanmLvAHkmqT04hjXADc5eCIhqZ5r7Vwus/hfwR/k irp/A6CjaZU251Ck1nF8OtNu4BL8DM5+/bkdjEqOr62tdRoZ0nNMTLKnMnOOQ1PE/atk8BEEr89KR iA4/wVUA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQXyd-0000fQ-MH; Wed, 06 Jun 2018 12:55:47 +0000 Received: from mail-pl0-x232.google.com ([2607:f8b0:400e:c01::232]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fQXyX-0000eq-Iz for linux-mtd@lists.infradead.org; Wed, 06 Jun 2018 12:55:45 +0000 Received: by mail-pl0-x232.google.com with SMTP id n10-v6so3776725plp.0 for ; Wed, 06 Jun 2018 05:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=7iSFK0iWa3shyr1O+We9pJACSDuBAcJ3/t7aMT65/Xg=; b=O0nNZQ5cEPGWSS0BR9iIXSWCdU5WeIkjm/tte4NCpihcC587//e50rCF04H5+7DZpG nlxPH6YQYzM+BWanQXoDqzrfDrhsxXoWNrnAuzQwvp4Wf3VfptLd8T7+hyc/moAff+ZG KUvfij82cBMMA0cqn/ilNMY6Yr0ihjz/SZMkOoPGrDL7+zL0tS6HvEju5z4mwUiNvUH7 /TmXDYXsPDIfdzYcepLn5E4IJGXnt1ROMasigG6QLJ94JAIQetzXUHN5rh84VRmIdw53 MnB9NjAsGfZL6oWEItvcFL9flWFRTxlXgtanjTqmv8brx5unOoGTSAbjyR4P17ykOkiP CNLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=7iSFK0iWa3shyr1O+We9pJACSDuBAcJ3/t7aMT65/Xg=; b=rXsJ0pt+y/F3N2molxLz6JmjVP510/nEL6ZQ6oMhwbJ/phFGaWHRpbOLpY2xMoYQVu tisJ5yDJQUrqGC0/8xQiP9fYxysmWD1O4S/YTmaqve2t/aNeTiCTIZjKTPGojOiiOJS0 nd9z7p30aikE1G2bMqvbPebEl/aVP/3aOMoMjMFwgPSGjo1M0tsxdBjG2LF0kwNNnya9 SomSGlK1Bdq7lqtJ2NBDLdAruyzn+m+boTTx45coKjnWtbw4oBHirLdPZF469PnNQ0j9 BBFLJotwQWYrwfhVmJyF0ManPzIaaW7i62yGBnKfM2lutXqHyWpYmx7zEE7ABCTmrOBf OlCQ== X-Gm-Message-State: APt69E0921OKXYDN+G0MT7jd8VjvtiRPS8AWHhkY2zSUTCSLyHw6MAbw KHaT/YNizNzxLbVVCuE4bjJNeoJNvW8Ihk+t8m5ILV/F X-Google-Smtp-Source: ADUXVKI0Zx+pXxVL1c8MmTXTGeChCiScHH1AK7/7KwFMLpMkKj0OAcXL29gVAHsayD93oWpBair1jf7Bx1lBjl3KOfE= X-Received: by 2002:a17:902:8648:: with SMTP id y8-v6mr3090674plt.86.1528289727724; Wed, 06 Jun 2018 05:55:27 -0700 (PDT) MIME-Version: 1.0 From: Michele Dionisio Date: Wed, 6 Jun 2018 14:55:16 +0200 Message-ID: Subject: testing UBIFS with zstd To: linux-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180606_055541_657051_F664954E X-CRM114-Status: GOOD ( 13.74 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400e:c01:0:0:0:232 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (michele.dionisio[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org I'm testing ubifs with zstd compression. In my opinion it is a good idea to start to insert this "new" compression algorithem because the performance is paragonable with LZ4 and the compression is much better. I attach patches for mtd-utils and linux too (remember to add also https://lkml.org/lkml/2017/9/8/824) From e4e484259296b1cfbaf14fe3f403df3b4f0b0849 Mon Sep 17 00:00:00 2001 From: Michele Dionisio Date: Wed, 6 Jun 2018 14:53:50 +0200 Subject: Add zstd compression on ubifs Signed-off-by: Michele Dionisio diff --git a/fs/ubifs/Kconfig b/fs/ubifs/Kconfig index 83a961bf7280..1f44a6ff99cf 100644 --- a/fs/ubifs/Kconfig +++ b/fs/ubifs/Kconfig @@ -5,8 +5,10 @@ config UBIFS_FS select CRYPTO if UBIFS_FS_ADVANCED_COMPR select CRYPTO if UBIFS_FS_LZO select CRYPTO if UBIFS_FS_ZLIB + select CRYPTO if UBIFS_FS_ZSTD select CRYPTO_LZO if UBIFS_FS_LZO select CRYPTO_DEFLATE if UBIFS_FS_ZLIB + select CRYPTO_ZSTD if UBIFS_FS_ZSTD depends on MTD_UBI help UBIFS is a file system for flash devices which works on top of UBI. @@ -36,6 +38,14 @@ config UBIFS_FS_ZLIB help Zlib compresses better than LZO but it is slower. Say 'Y' if unsure. +config UBIFS_FS_ZSTD + bool "ZSTD compression support" if UBIFS_FS_ADVANCED_COMPR + depends on UBIFS_FS + default y + help + ZSTD compresses is a big win in speed over Zlib and + in compression ratio over LZO. Say 'Y' if unsure. + config UBIFS_ATIME_SUPPORT bool "Access time support" if UBIFS_FS depends on UBIFS_FS diff --git a/fs/ubifs/compress.c b/fs/ubifs/compress.c index 565cb56d7225..89183aeeeb7a 100644 --- a/fs/ubifs/compress.c +++ b/fs/ubifs/compress.c @@ -71,6 +71,24 @@ static struct ubifs_compressor zlib_compr = { }; #endif +#ifdef CONFIG_UBIFS_FS_ZSTD +static DEFINE_MUTEX(zstd_enc_mutex); +static DEFINE_MUTEX(zstd_dec_mutex); + +static struct ubifs_compressor zstd_compr = { + .compr_type = UBIFS_COMPR_ZSTD, + .comp_mutex = &zstd_enc_mutex, + .decomp_mutex = &zstd_dec_mutex, + .name = "zstd", + .capi_name = "zstd", +}; +#else +static struct ubifs_compressor zstd_compr = { + .compr_type = UBIFS_COMPR_ZSTD, + .name = "zstd", +}; +#endif + /* All UBIFS compressors */ struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT]; @@ -228,13 +246,19 @@ int __init ubifs_compressors_init(void) if (err) return err; - err = compr_init(&zlib_compr); + err = compr_init(&zstd_compr); if (err) goto out_lzo; + err = compr_init(&zlib_compr); + if (err) + goto out_zstd; + ubifs_compressors[UBIFS_COMPR_NONE] = &none_compr; return 0; +out_zstd: + compr_exit(&zstd_compr); out_lzo: compr_exit(&lzo_compr); return err; @@ -247,4 +271,5 @@ void ubifs_compressors_exit(void) { compr_exit(&lzo_compr); compr_exit(&zlib_compr); + compr_exit(&zstd_compr); } diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 6c397a389105..2a725c8174b4 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -1035,6 +1035,8 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options, c->mount_opts.compr_type = UBIFS_COMPR_LZO; else if (!strcmp(name, "zlib")) c->mount_opts.compr_type = UBIFS_COMPR_ZLIB; + else if (!strcmp(name, "zstd")) + c->mount_opts.compr_type = UBIFS_COMPR_ZSTD; else { ubifs_err(c, "unknown compressor \"%s\"", name); //FIXME: is c ready? kfree(name); diff --git a/fs/ubifs/ubifs-media.h b/fs/ubifs/ubifs-media.h index e8c23c9d4f4a..9f869c7c1532 100644 --- a/fs/ubifs/ubifs-media.h +++ b/fs/ubifs/ubifs-media.h @@ -341,12 +341,14 @@ enum { * UBIFS_COMPR_NONE: no compression * UBIFS_COMPR_LZO: LZO compression * UBIFS_COMPR_ZLIB: ZLIB compression + * UBIFS_COMPR_ZSTD: ZSTD compression * UBIFS_COMPR_TYPES_CNT: count of supported compression types */ enum { UBIFS_COMPR_NONE, UBIFS_COMPR_LZO, UBIFS_COMPR_ZLIB, + UBIFS_COMPR_ZSTD, UBIFS_COMPR_TYPES_CNT, };