From patchwork Wed Apr 18 14:16:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10348211 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8870C60216 for ; Wed, 18 Apr 2018 14:15:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7917628675 for ; Wed, 18 Apr 2018 14:15:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D868286A2; Wed, 18 Apr 2018 14:15:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2ADB28675 for ; Wed, 18 Apr 2018 14:15:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753790AbeDROPl (ORCPT ); Wed, 18 Apr 2018 10:15:41 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:42832 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753412AbeDROPk (ORCPT ); Wed, 18 Apr 2018 10:15:40 -0400 Received: by mail-wr0-f195.google.com with SMTP id s18-v6so5291228wrg.9; Wed, 18 Apr 2018 07:15:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fC3ATwSZ0oKDgaBPXrUKYt96YQ3MnTKg17dUMUazLoE=; b=S/os3V9lnuNdaEZlY4QxpX9A64lfCwl9pSTIf5Rud+w2oFRho7E7M+4D3ZYyQcniC7 FnOZE1cw7V45QZVcwUlfoZUPxqtK34e2hV5DBsCSRH+ExHkvTA/2qHoTSOsH6azrDWrj DfpWswdf3TS/RvmtKZQkzbWMUC9qMURHCMHiPM30JaxNczCZmq7fXi1WarAznNPfouSj QuHhsEWsEGgBskPP2B0wnNd0nncFkXlfCU02yVQH1GplG7KbzhTZvCWX8nFN+xRV003S zNKeF9dG4zxpgpZa2MME6mKQq88+Cs7eaccUBe1ReR2FeOOqU0/tfQ23GIfhhTR2pD4g 6gig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fC3ATwSZ0oKDgaBPXrUKYt96YQ3MnTKg17dUMUazLoE=; b=NglFo/L86yUQAiaU9bk8PwJ3Tbx+h2vovU6VhHgY13ZpImictUpOgma75xqiy7eKoz OsMznkVTAKQ3bmS2RsUjroWWA83ylBRJ4bIwMAMs47tFfVIvMhbnqgurypXdn+bmcxv6 26P9CF7G3g9Rvb5H8W9jJLyjW3QdAJDuqkC8fVZQFQzKhrki41W40sWd13dwdtMAc/Ml WU0ZQtrwy3VyQfP+TLZpLZwudG/8VsDS7ljbeSV94O+NcuOVOfcI4FDg2YAGXwQbVk0X 0bmWcxUdbe29JqJGTjXhQfdhLECgs45Lvb4DUclypMnnXeQ8iLspEh5d4yD8OkN9B2Y1 9yTA== X-Gm-Message-State: ALQs6tA2DEA3uZ3UNisxHWbP7OUYOJdkRYLbc/6ISvCsvXnUAwN8Yl/H /FqzHzX56pL8S+SuqnivMqeWhQ== X-Google-Smtp-Source: AIpwx48PPrOtM82jb9fEMnQmoePhOq6Bpbhz3B9RJ0rGF3rS1uSdlqpNUGUl/oXP820DV01r/wUvxQ== X-Received: by 2002:adf:b979:: with SMTP id b54-v6mr1910926wrg.265.1524060939322; Wed, 18 Apr 2018 07:15:39 -0700 (PDT) Received: from localhost.localdomain ([141.226.11.133]) by smtp.gmail.com with ESMTPSA id t8sm1645462wmc.20.2018.04.18.07.15.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Apr 2018 07:15:38 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH 1/2] common/rc: factor out _require_scratch_fs_option Date: Wed, 18 Apr 2018 17:16:57 +0300 Message-Id: <1524061018-20413-2-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524061018-20413-1-git-send-email-amir73il@gmail.com> References: <1524061018-20413-1-git-send-email-amir73il@gmail.com> Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Factor out _require_scratch_fs_option and _check_scratch_fs_option from the helper _require_scratch_dax. Those are generic helpers to test if mount option is supported and if mount option was enabled. Signed-off-by: Amir Goldstein --- common/rc | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/common/rc b/common/rc index 622afd6..23c3978 100644 --- a/common/rc +++ b/common/rc @@ -3036,20 +3036,35 @@ _require_scratch_shutdown() _scratch_unmount } -# Does dax mount option work on this dev/fs? -_require_scratch_dax() +_check_scratch_fs_option() +{ + local opt=$1 + + _fs_options $SCRATCH_DEV | grep -qw "$opt" +} + +# Does mount option work on this dev/fs? +_require_scratch_fs_option() { + local opt=$1 + _require_scratch _scratch_mkfs > /dev/null 2>&1 - _try_scratch_mount -o dax || \ - _notrun "mount $SCRATCH_DEV with dax failed" - # Check options to be sure. XFS ignores dax option + _try_scratch_mount -o "$opt" || \ + _notrun "mount $SCRATCH_DEV with $opt failed" + # Check options to be sure. For example, XFS ignores dax option # and goes on if dev underneath does not support dax. - _fs_options $SCRATCH_DEV | grep -qw "dax" || \ - _notrun "$SCRATCH_DEV $FSTYP does not support -o dax" + _check_scratch_fs_option "$opt" || \ + _notrun "$SCRATCH_DEV $FSTYP does not support -o $opt" _scratch_unmount } +# Does dax mount option work on this dev/fs? +_require_scratch_dax() +{ + _require_scratch_fs_option "dax" +} + # Does norecovery support by this fs? _require_norecovery() {