From patchwork Tue Dec 20 13:17:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9481549 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 36079606DB for ; Tue, 20 Dec 2016 13:18:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 266622848D for ; Tue, 20 Dec 2016 13:18:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B0D5284B6; Tue, 20 Dec 2016 13:18:10 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 C88012848D for ; Tue, 20 Dec 2016 13:18:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757995AbcLTNSJ (ORCPT ); Tue, 20 Dec 2016 08:18:09 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36141 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757965AbcLTNSI (ORCPT ); Tue, 20 Dec 2016 08:18:08 -0500 Received: by mail-wm0-f66.google.com with SMTP id m203so24240914wma.3 for ; Tue, 20 Dec 2016 05:18:07 -0800 (PST) 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=iO51GBsHpEN4qH9d/CO0x5CUeOg4PMXnx5ZAXUGpGSc=; b=ZKEvmZOqtj4fL8Yb1+N9bRFEcz9tlNdv2ZgGuO1pHBhkDnbaSAYsabwXPmIybKKVAi +pqz3awy4LTwuwgPe2UKsHkzdd5eF843lGBdeG3fA+Y/AKNS7K0X7DjxirWcBPOorJOX Nlh/kNvCYKQEAU/rbRVevw75i+iUPJcYYaRTBjdciY3KJs7pXVOIILLdJ3bz5OSSyXSc RRvkp/Y1J/lx9mqL622vvDYwwy2v7W9h1uSmlxEC6b7oYpFzBtzjaC36t+fmejZ98ZBr 77QWWnZq8VtRKnSXfCgqwdkixSQZYMz4wYQeqoLs1rJSIF6EoN7KBmBImarKc6VADuYx KYNg== 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=iO51GBsHpEN4qH9d/CO0x5CUeOg4PMXnx5ZAXUGpGSc=; b=AzufFT2J+aUbjGw+9gLiBLRBMdOQcm6/G8h04qG1SjYkXHK2FDwMzGa/yh2zAiNRPK ednbV2EiMc9jpbhrgjpSrRYdx+fywbZsqaa0mK8QtmgXsFte9K7qQxmFM9KRP6Mld89s 6OKdk7wXO7oLjVtU0pGgkt3+CZ/i/YOYVsqKuVeOYGNSk19wYg4xuBoCSWGARPNiimev OAILCleNqX3fDZcwucmpQIdwiIc3/dzRQwHpZ27/JrXNWMa80m/UL+Gc7XMsQYTNLScU 0TLhO1mFM0fkh2GMhj4sjS7Nf5yLY+GB2zQ9qbR4XgZYg6EF73W8RROTPsuR9l6+Qsk5 DPPw== X-Gm-Message-State: AIkVDXIjeQyvQumChbNotl7eomA/Xjyrp1hXxuWb8q7qPA81UAQnXwl0qKd50kZHk+OpdA== X-Received: by 10.28.18.194 with SMTP id 185mr1847760wms.124.1482239884543; Tue, 20 Dec 2016 05:18:04 -0800 (PST) Received: from amir-VirtualBox.ctera.local (bzq-82-81-193-202.cablep.bezeqint.net. [82.81.193.202]) by smtp.gmail.com with ESMTPSA id d64sm22041525wmh.3.2016.12.20.05.18.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Dec 2016 05:18:03 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: Dave Chinner , Christoph Hellwig , "Darrick J . Wong" , Miklos Szeredi , fstests@vger.kernel.org Subject: [PATCH v2 1/3] common/rc: factor out _supports_filetype() helper Date: Tue, 20 Dec 2016 15:17:33 +0200 Message-Id: <1482239855-791-2-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482239855-791-1-git-send-email-amir73il@gmail.com> References: <1482239855-791-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 _overlay_mount_dirs() checks for the filetype feature on upper dir fs. factor out that feature test to a helper. Signed-off-by: Amir Goldstein --- common/rc | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/common/rc b/common/rc index 2639fbd..288517f 100644 --- a/common/rc +++ b/common/rc @@ -264,6 +264,23 @@ _scratch_mount_options() $SCRATCH_DEV $SCRATCH_MNT } +_supports_filetype() +{ + local dir=$1 + shift 1 + + local upper_fst=$(df --output=fstype $dir | tail -1) + case "$upper_fst" in + xfs) + xfs_info $dir | grep -q "ftype=1" + ;; + ext2|ext3|ext4) + tune2fs -l $(df --output=source $dir | tail -1) | \ + grep -q filetype + ;; + esac +} + # helper function to do the actual overlayfs mount operation _overlay_mount_dirs() { @@ -284,20 +301,8 @@ _overlay_mount() local mnt=$2 shift 2 - local upper_fst=$(df --output=fstype $dir | tail -1) - case "$upper_fst" in - xfs) - if ! xfs_info $dir | grep -q "ftype=1" ; then - _notrun "upper fs needs to support d_type" - fi - ;; - ext2|ext3|ext4) - if ! tune2fs -l $(df --output=source $dir | tail -1) | \ - grep -q filetype ; then - _notrun "upper fs needs to support d_type" - fi - ;; - esac + _supports_filetype $dir || \ + _notrun "upper fs needs to support d_type" mkdir -p $dir/$OVERLAY_UPPER_DIR mkdir -p $dir/$OVERLAY_LOWER_DIR