From patchwork Sat May 31 23:48:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Philip Worrall X-Patchwork-Id: 4276811 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 482809F30B for ; Sat, 31 May 2014 23:49:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 68F8920397 for ; Sat, 31 May 2014 23:49:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9DCB820340 for ; Sat, 31 May 2014 23:49:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756753AbaEaXs6 (ORCPT ); Sat, 31 May 2014 19:48:58 -0400 Received: from mail-we0-f182.google.com ([74.125.82.182]:54672 "EHLO mail-we0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756730AbaEaXsw (ORCPT ); Sat, 31 May 2014 19:48:52 -0400 Received: by mail-we0-f182.google.com with SMTP id t60so3489538wes.41 for ; Sat, 31 May 2014 16:48:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=udmidr8qIKcId20GVjInmZtwlPpXTDagYxPBRYyDEIU=; b=RN0hOju+dQNNuAR/+IQMXYueUWY63K6Msl1eRaFAks409Zu/NN7w7ugJQA5gVMmm8B llmAoQqZrTIkHzvhAAbAe0bJh1MQUkWEIl+sLn0SKDGeoVtud06dTG6WjzDQb9ujxBnt gr37MSEwQ5nbjFq9qIwQF5b6PaIi94vMcgHGgmGa8FNfyQYOKdLVV+rNNviIDhkTu77r KfVUxqkCvGzTvvx9aW0BOSt2M4dlHR2YncDqiOz3tmPGC+WS7vOI5GzRFmvbSDjts/sJ kprW40dlCe7Z3j/ndBv4p7AoIdJw2alLT0HG6BkKbN8JK6chgwwhSuXxUzxhhtgFIyk9 M7Dg== X-Received: by 10.180.77.225 with SMTP id v1mr9954053wiw.5.1401580131577; Sat, 31 May 2014 16:48:51 -0700 (PDT) Received: from ubuntu.home (host86-148-25-253.range86-148.btcentralplus.com. [86.148.25.253]) by mx.google.com with ESMTPSA id em5sm18605440wic.23.2014.05.31.16.48.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 31 May 2014 16:48:51 -0700 (PDT) From: Philip Worrall To: linux-btrfs@vger.kernel.org Cc: Philip Worrall Subject: [PATCH 8/8] Btrfs: Check for compress=lz4 in mount options Date: Sat, 31 May 2014 23:48:36 +0000 Message-Id: <1401580116-10458-9-git-send-email-philip.worrall@googlemail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1401580116-10458-1-git-send-email-philip.worrall@googlemail.com> References: <1401580116-10458-1-git-send-email-philip.worrall@googlemail.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Check whether the user has set compress=lz4 in the mount options and if so set the compress method to lz4. Signed-off-by: Philip Worrall --- fs/btrfs/super.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index d4878dd..a348734 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -506,6 +506,14 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) btrfs_clear_opt(info->mount_opt, NODATACOW); btrfs_clear_opt(info->mount_opt, NODATASUM); btrfs_set_fs_incompat(info, COMPRESS_LZO); + } else if (strcmp(args[0].from, "lz4") == 0) { + printk(KERN_WARNING "BTRFS: Using LZ4 compression\n"); + compress_type = "lz4"; + info->compress_type = BTRFS_COMPRESS_LZ4; + btrfs_set_opt(info->mount_opt, COMPRESS); + btrfs_clear_opt(info->mount_opt, NODATACOW); + btrfs_clear_opt(info->mount_opt, NODATASUM); + btrfs_set_fs_incompat(info, COMPRESS_LZ4); } else if (strncmp(args[0].from, "no", 2) == 0) { compress_type = "no"; btrfs_clear_opt(info->mount_opt, COMPRESS); @@ -1035,8 +1043,10 @@ static int btrfs_show_options(struct seq_file *seq, struct dentry *dentry) if (btrfs_test_opt(root, COMPRESS)) { if (info->compress_type == BTRFS_COMPRESS_ZLIB) compress_type = "zlib"; - else + else if (info->compress_type == BTRFS_COMPRESS_LZO) compress_type = "lzo"; + else + compress_type = "lz4"; if (btrfs_test_opt(root, FORCE_COMPRESS)) seq_printf(seq, ",compress-force=%s", compress_type); else