Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp981002pxb; Thu, 21 Apr 2022 15:10:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFLEMwSgMC7qGLQlYZF8PzYmTjy918hoegfoRWQD/pCUYS+4N+bdo6oOd4k+8+yDGts8Q+ X-Received: by 2002:a17:906:dc8b:b0:6ef:86e8:777 with SMTP id cs11-20020a170906dc8b00b006ef86e80777mr1468971ejc.326.1650579026672; Thu, 21 Apr 2022 15:10:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650579026; cv=none; d=google.com; s=arc-20160816; b=jXt7ynVDSZnpZFn+5KICMlgvLtH9ZkC0Ep5YjmISbCkyTz6n3WtyGszyADHv2u+swf NHSfjANzq3i9938AJ36aRRGENaITR54HKxPUi/5E5wLD2OkNIQPs0+wF5FCceS+NMg7B EpuvsB9HeMmEkZ0Mne9TYBIx5RyiR/TbSMse3KPrZDI5dPLnItcrZzBSNjdHN9CVuZhe s+BeKLnCuZ9rVeD6F45fEtILukpguUkmX8ulyX+VvEL2vQYcBXZ910AOI+Y5ej/ODF4r OfjrvbFx+AjS9UbDA34RQSkxG+wLwedPQfyztUA+ymoXr0Vgf9sXBJw+RM6o8EUKRJg6 d/+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mkTk6jJ30N/x3F4AyIBMkhdrEysHqLwx5nd2q3CElLU=; b=OZpkL36vTeS5xFYPHimDxVbTUvyAew1uR8cQju21+t+jhhora16i7Mt9RgD7o7jelF +QvQejZanjy3d/YJlutpq+W5yLXzemOG7aOkkKQ3zPLWepbOBEAx706mKceO1175CuDd xd0qfIx2m+qThNyv1Qj0RZoLGU/+tBTThiR7l5coZllvzYBqvXGvfpPK+63sTJxlk6Nx +99u/J1EI2LAySKaZQwvntTqVmzJiOVPCwllS8lDzJcxMtrP1oQ9TqE3k4/SochKrlpD mxjYOxjSTfCkjOC3fyrsxH5cTmaw2cJDx3dsb9E6TFUwlx9VK4tiTi+uPivVs2BXh19e RP1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Hc0+5Igr; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id re27-20020a170906d8db00b006e0d40033ffsi4841392ejb.693.2022.04.21.15.09.55; Thu, 21 Apr 2022 15:10:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Hc0+5Igr; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384298AbiDUF0f (ORCPT + 99 others); Thu, 21 Apr 2022 01:26:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233065AbiDUF0f (ORCPT ); Thu, 21 Apr 2022 01:26:35 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00FB3DFAB; Wed, 20 Apr 2022 22:23:46 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id ga4-20020a17090b038400b001d4b33c74ccso2904121pjb.1; Wed, 20 Apr 2022 22:23:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mkTk6jJ30N/x3F4AyIBMkhdrEysHqLwx5nd2q3CElLU=; b=Hc0+5IgrOya2iYRzrDxmtBBvxHXeMw89ZPAP7iTNdSp6LlrD6DHKIteDsapSIPn+Zz vv2qF1dTw4fLdGTkQtwGH70TmBB5kOdtIPbKrQ8khICLgKd7Rnpi8zqekpr0lcnnNp5H C9Hkw/X9CMDaO+BK163KMxwDk5A6PKZsTYnFG9T2Sgzmkzch7bBH9R3EEwCm6zEbcF8C S2VYWsPHfGriq+4302WB9Tgqo9Hp6gcjLUuzeggRYdcLotGNqCIT72DYwuVihl2rEMib KsVZ5vvp8CJvWOcpG1nG1MyUiaLWkQX0fYECcttcCA5VDj6ZktlWvbvjdP0hBuX1luqq uJww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mkTk6jJ30N/x3F4AyIBMkhdrEysHqLwx5nd2q3CElLU=; b=g8EM6YmhvpYRYPbb1l3Jb4uDExQvKseEQSaGB7E2Cra4EtrlA96cexJv8hWHaKgRVY UkD6FliIdsB3Qn333RzArgr/Z02hRSSGLwNzsvr0QkkQifvOMqo+s1yXmPLFIuQMhCqw 3LrR8//SnzW4g7noGQKDXxDpFiUYN/PZLiPWUVsyW5DRfpl0PzcanePlL7VoVSDXDKJy T0GQIBH70xeIeg9AvVnfLSYjMSQdNVYsuJ127syrbTlKMgSfZuxtlHxU4Ye7UkPupgrk rW9G+cgmqFOauoJWBqS43IsaVhCP4mwsOn2RUynuNDD+uLFyviQ9ZlEQXAbZn0xFr/YQ Xk/A== X-Gm-Message-State: AOAM533GbI4J47QysIl4vh97bC9VH5dpaGcETH9xuKXH7hejXI76pT8o DxyvB0nLGTJmTTqPPYp36xuBtOtTO9Q= X-Received: by 2002:a17:90a:2809:b0:1cb:99a8:ffcd with SMTP id e9-20020a17090a280900b001cb99a8ffcdmr8452065pjd.7.1650518626541; Wed, 20 Apr 2022 22:23:46 -0700 (PDT) Received: from localhost ([2406:7400:63:fca5:5639:1911:2ab6:cfe6]) by smtp.gmail.com with ESMTPSA id cu19-20020a17090afa9300b001cd4989ff59sm988919pjb.32.2022.04.20.22.23.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Apr 2022 22:23:46 -0700 (PDT) From: Ritesh Harjani To: linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org Cc: Eric Biggers , Theodore Ts'o , Jan Kara , Ritesh Harjani Subject: [RFC 3/6] ext4: Directly opencode ext4_set_test_dummy_encryption Date: Thu, 21 Apr 2022 10:53:19 +0530 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Simplify the code by opencoding ext4_set_test_dummy_encryption(), since there is only one caller of it and ext4_** variant in itself does nothing special other than calling fscrypt_set_test_dummy_encryption(). This can be done directly by opencoding it in the caller. Signed-off-by: Ritesh Harjani --- fs/ext4/super.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 8bb5fa15a013..e7e5c9c057d7 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1863,24 +1863,6 @@ ext4_sb_read_encoding(const struct ext4_super_block *es) } #endif -static int ext4_set_test_dummy_encryption(struct super_block *sb, char *arg) -{ -#ifdef CONFIG_FS_ENCRYPTION - struct ext4_sb_info *sbi = EXT4_SB(sb); - int err; - - err = fscrypt_set_test_dummy_encryption(sb, arg, - &sbi->s_dummy_enc_policy); - if (err) { - ext4_msg(sb, KERN_WARNING, - "Error while setting test dummy encryption [%d]", err); - return err; - } - ext4_msg(sb, KERN_WARNING, "Test dummy encryption mode enabled"); -#endif - return 0; -} - #define EXT4_SPEC_JQUOTA (1 << 0) #define EXT4_SPEC_JQFMT (1 << 1) #define EXT4_SPEC_DATAJ (1 << 2) @@ -2795,8 +2777,20 @@ static int ext4_apply_options(struct fs_context *fc, struct super_block *sb) ext4_apply_quota_options(fc, sb); - if (ctx->spec & EXT4_SPEC_DUMMY_ENCRYPTION) - ret = ext4_set_test_dummy_encryption(sb, ctx->test_dummy_enc_arg); + if (IS_ENABLED(CONFIG_FS_ENCRYPTION) && + (ctx->spec & EXT4_SPEC_DUMMY_ENCRYPTION)) { + + ret = fscrypt_set_test_dummy_encryption(sb, + ctx->test_dummy_enc_arg, + &sbi->s_dummy_enc_policy); + if (ret) { + ext4_msg(sb, KERN_WARNING, "Error while setting test dummy encryption [%d]", + ret); + return ret; + } + + ext4_msg(sb, KERN_WARNING, "Test dummy encryption mode enabled"); + } return ret; } -- 2.31.1