From patchwork Mon Jan 29 21:06:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 193706 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp833571dyb; Mon, 29 Jan 2024 13:09:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IFtS2CpnxKdIAZAzCBB40kxXPiiDIjgNpGHhID9wwku1GoFF3CelvOYdqc0meufaBshVdMx X-Received: by 2002:a05:6512:1308:b0:511:f2d:367d with SMTP id x8-20020a056512130800b005110f2d367dmr3239800lfu.65.1706562568897; Mon, 29 Jan 2024 13:09:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706562568; cv=pass; d=google.com; s=arc-20160816; b=vM6TVY7wooqgjwo6outmpIo7IsPOx9A9k7BCLbT71ZzBaOjAcGwD+PXh6NL73hIZkT CALHMG9KoMinsfbMFCLiJshEAi/H/6iUP+QPDbQvOFerxZfrVKcqc8Zmd9EJDzK/9WOn ksMt1gYWxf3TIbi8djngAqcnKYE1kvcjgOnuJqylfuts6pqp/HFk5TfO9PNT9IdH5HvH rbDA9pyFb8HwTtG/HJuT68SI1Tgej3uhwHms+PhDAbIlMCCfVDZW3bzVKJA4bp6FUFER cBJU4SmHOpKSWAKj2RNrgOmCtk3Q8JZ8c4BFs6DVw6CHXFIbEjnW+yWaWHIin3XocLpI jJxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ccax4+tRpSP7QOIA6T2K6a0Oaxx0rZWM8kMN95JROEw=; fh=Z7G8cS2FPFt+4nAR/nvsWrTWKiqS73mTX+NUjt/ssNI=; b=RrWQckoyYPM+erHajqJTlI5Z9lGxeQ//ATDo9XCcyr2Q/0cMuzR5pzFMadrgEsXynR KGD6d5isKmzZwjWyegIr77Dc6o4QnHKG9tkl5QDbBKOmkW+UbO2wKu3bH7gBxTz/vt21 z+pZ1raVYIPI3rK8o7tZaaR8qj7FseP8aNbSgSya84Fq7+f0iAoWLoBX8cTnsDgD6nxy kBTQ5n14L4jiwRI1FzNUhMLVhyeDKhu9yjNDMCQlNpcoKJSwxDzMGuvG5DcFbYcalNoL Vd+YbMFmLIzUifUQFH3eYo+mLsv4V4Gt76a1V08BjXDEOz+v4vNGA8SW9ZBpPXxUJArd ZT4Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=tKXBPkUC; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-43506-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43506-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f1-20020a170906390100b00a34a7e6c096si3643315eje.262.2024.01.29.13.09.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 13:09:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43506-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=tKXBPkUC; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-43506-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43506-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 7ED491F25E27 for ; Mon, 29 Jan 2024 21:09:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 70CCE15B313; Mon, 29 Jan 2024 21:07:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="tKXBPkUC" Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B141159569; Mon, 29 Jan 2024 21:06:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=167.114.26.122 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706562416; cv=none; b=ju9Gpt+93LT87othN2J1NZM3TImYDiJIuCxElmfkgugjoYN8J0xZDtZ0AbQYQo2ekSYXhKrHpbZIcU23aP/DwKuqT8dJapYPRbAah0mJX+gLrNEUKOgqmoLdaGZg9hrzBfMx4A6382MjlZjyNiw1rTkGqbjF1ytWdo7eLxz7Hrw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706562416; c=relaxed/simple; bh=PA2bNaQGUroOCG4PbvCJuxBIvden1XyXhOeNSYG6Pc8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ujC9w3aHVUKhWAgw0KXlV6oaG7WHsk8EqWcvY4ktt678tNT2ggfndXvnBV17wR3gNCy7iGjkLDv9ZQebxCJJhydxapHhx3pIu+kWdT+celZAVW/2e2/wy1duCeXeUPyAGbmkWEPf54+VULNh2K0iaaJ3HW2JITa81dXfQeyMxQw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=tKXBPkUC; arc=none smtp.client-ip=167.114.26.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706562410; bh=PA2bNaQGUroOCG4PbvCJuxBIvden1XyXhOeNSYG6Pc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tKXBPkUCiGqFx3UJT68UfJtfsZvo9lzQSlEslbntl3bHG2N68r4Lg/D78jIgJDYa5 mKyvpwpcXLdU721AkT9t5A65cL9pS2PxkKh8Fqsl5nrw7+xrZmhxODO2+ZETuH9BbJ fDx6jE3SERSeIc4yM77HcMOgHXxE+lcWi4Ya/iAB8zY2JS8yCgdYb0NWKbr3VG+rXO 5EXvs71nWGiOpNbObd5zHkTG22F3cC3Un8ScMy7nRmxFtw6ivamNeQeeFdbFBuwGQy D9mHV02DMJsL15eKEnMFvo3u8CAMg9Tjc8pioep5x28rnNCaNJ/z68wTPZKQA2v0SR mi8tFk2/icD4g== Received: from thinkos.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TP17t4mGTzVXX; Mon, 29 Jan 2024 16:06:50 -0500 (EST) From: Mathieu Desnoyers To: Dan Williams , Vishal Verma , Dave Jiang Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , "Theodore Ts'o" , Andreas Dilger , linux-ext4@vger.kernel.org, Andrew Morton , Linus Torvalds , linux-mm@kvack.org, linux-arch@vger.kernel.org, Matthew Wilcox , nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org Subject: [RFC PATCH 5/7] ext4: Use dax_is_supported() Date: Mon, 29 Jan 2024 16:06:29 -0500 Message-Id: <20240129210631.193493-6-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> References: <20240129210631.193493-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789460552357556918 X-GMAIL-MSGID: 1789460552357556918 Use dax_is_supported() to validate whether the architecture has virtually aliased caches at mount time. This is relevant for architectures which require a dynamic check to validate whether they have virtually aliased data caches (ARCH_HAS_CACHE_ALIASING_DYNAMIC=y). Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing caches") Signed-off-by: Mathieu Desnoyers Cc: "Theodore Ts'o" Cc: Andreas Dilger Cc: linux-ext4@vger.kernel.org Cc: Andrew Morton Cc: Linus Torvalds Cc: linux-mm@kvack.org Cc: linux-arch@vger.kernel.org Cc: Dan Williams Cc: Vishal Verma Cc: Dave Jiang Cc: Matthew Wilcox Cc: nvdimm@lists.linux.dev Cc: linux-cxl@vger.kernel.org --- fs/ext4/super.c | 52 ++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index c5fcf377ab1f..9e0606289239 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -2359,34 +2359,32 @@ static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param) return ext4_parse_test_dummy_encryption(param, ctx); case Opt_dax: case Opt_dax_type: -#ifdef CONFIG_FS_DAX - { - int type = (token == Opt_dax) ? - Opt_dax : result.uint_32; - - switch (type) { - case Opt_dax: - case Opt_dax_always: - ctx_set_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS); - ctx_clear_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER); - break; - case Opt_dax_never: - ctx_set_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER); - ctx_clear_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS); - break; - case Opt_dax_inode: - ctx_clear_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS); - ctx_clear_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER); - /* Strictly for printing options */ - ctx_set_mount_opt2(ctx, EXT4_MOUNT2_DAX_INODE); - break; + if (dax_is_supported()) { + int type = (token == Opt_dax) ? + Opt_dax : result.uint_32; + + switch (type) { + case Opt_dax: + case Opt_dax_always: + ctx_set_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS); + ctx_clear_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER); + break; + case Opt_dax_never: + ctx_set_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER); + ctx_clear_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS); + break; + case Opt_dax_inode: + ctx_clear_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS); + ctx_clear_mount_opt2(ctx, EXT4_MOUNT2_DAX_NEVER); + /* Strictly for printing options */ + ctx_set_mount_opt2(ctx, EXT4_MOUNT2_DAX_INODE); + break; + } + return 0; + } else { + ext4_msg(NULL, KERN_INFO, "dax option not supported"); + return -EINVAL; } - return 0; - } -#else - ext4_msg(NULL, KERN_INFO, "dax option not supported"); - return -EINVAL; -#endif case Opt_data_err: if (result.uint_32 == Opt_data_err_abort) ctx_set_mount_opt(ctx, m->mount_opt);