From patchwork Thu Apr 26 05:53:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10364647 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 1B075601BE for ; Thu, 26 Apr 2018 05:52:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0CC462868D for ; Thu, 26 Apr 2018 05:52:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0108C29015; Thu, 26 Apr 2018 05:52:07 +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 A6C292868D for ; Thu, 26 Apr 2018 05:52:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752749AbeDZFwH (ORCPT ); Thu, 26 Apr 2018 01:52:07 -0400 Received: from mail-io0-f182.google.com ([209.85.223.182]:37422 "EHLO mail-io0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752785AbeDZFwF (ORCPT ); Thu, 26 Apr 2018 01:52:05 -0400 Received: by mail-io0-f182.google.com with SMTP id y128-v6so29648802iod.4; Wed, 25 Apr 2018 22:52:05 -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=k9nD4srkKP5UiYzNfSTbAcBhPFfl7Q4ILyGYJZHFmD4=; b=IFbgfcrGhxxL/rQPIp+Fcu0a0jcd1Y0Q8Z7x71vwztWk8mM/RcxdPHLa2o5z281TM3 yhYAqNBMB4CxHMCooNHNVrxPP1YDPHHQVL/oY6K53kVqJAekjOdS/6p8UHHhcroie0LB QImZfj81RwbgoW8520wCPF3DoeNjO/2bFElL+2VdraynwQwqZxwZeh+6QX0OwZNdTZ+8 61Fk3zZusbZm+Gn72QCs68DCKrV8ySdvV+ySFSyxYaUmI+ol6n0gcccwQq7/eupmOul4 4wfDe7vi+pHc+XftaVYucZw7HlszOl+kB02RCC03+hlUnAZeKwm/pQuqi0k+ls5ZyZD+ Zjtw== 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=k9nD4srkKP5UiYzNfSTbAcBhPFfl7Q4ILyGYJZHFmD4=; b=s438ERHaCGujVPVVklK2yX3l+f6TnARDY2xzN9Sx9q6awcN4E9i/GXADcu0C7eW5K3 wYIyCNrnfN05X0/No5B+aK2pZ7a/1howsx5uTslTQ70lOqGIDmpufu9Ok5i65ko89sZd 8Ov0RVagVPhP/2HgOlC4mFa5C8M1D2OblaTPWDSqzoTDTJcGJWl4Y0VS5GOxHpmwlunO vconZ/bvL8k5kwhU9ntVjUQWBGqzSSxGpGkAGQs335r3g/F/Vs5Abn3sF8qZ+zHJ1YJA N/EHZtZy+FRTBlTzBXvvH7hpfv3K+KmsD0qqZwWwaoeuDFD4R73+VIkrNqDUBWKcOQU2 ku/w== X-Gm-Message-State: ALQs6tDIGYC6jpNoVsYjC2fD4q4ihy1kDKDzMCQCdLs25YwAsjNMWgnx YYp9OrVICtvxfTVdcRcCNm0= X-Google-Smtp-Source: AB8JxZrinopzUEprPU9JGaoa/KGxga+LP5yC2Mv63uy6P8oB9tZsalu3D6Qw+/6EJxxt4YUcaCkvBA== X-Received: by 2002:a6b:8d55:: with SMTP id p82-v6mr32962444iod.57.1524721925075; Wed, 25 Apr 2018 22:52:05 -0700 (PDT) Received: from amir-VirtualBox.Home (174-23-139-12.slkc.qwest.net. [174.23.139.12]) by smtp.gmail.com with ESMTPSA id t9-v6sm2258493ioa.82.2018.04.25.22.52.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 25 Apr 2018 22:52:04 -0700 (PDT) From: Amir Goldstein To: Eryu Guan Cc: Miklos Szeredi , linux-unionfs@vger.kernel.org, fstests@vger.kernel.org Subject: [PATCH v2 1/4] common/rc: factor out _require_scratch_fs_option Date: Wed, 25 Apr 2018 23:53:24 -0600 Message-Id: <1524722007-30891-2-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524722007-30891-1-git-send-email-amir73il@gmail.com> References: <1524722007-30891-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 366489b..78bc59d 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() {