From patchwork Thu Aug 4 20:02:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Whitney X-Patchwork-Id: 655950 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3s514b0ZyWz9t43 for ; Fri, 5 Aug 2016 05:59:59 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=cxfCtDoH; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965108AbcHDT75 (ORCPT ); Thu, 4 Aug 2016 15:59:57 -0400 Received: from mail-qk0-f193.google.com ([209.85.220.193]:35174 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934070AbcHDT74 (ORCPT ); Thu, 4 Aug 2016 15:59:56 -0400 Received: by mail-qk0-f193.google.com with SMTP id q62so21856028qkf.2; Thu, 04 Aug 2016 12:59:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=KUJkzNUebLWsMPhiPEPtk85imKEe8v85XStJpK7tESE=; b=cxfCtDoHrWiW9b7vY+oVupJfzUJ8g7iw1OYx7DRQf3UWJIte4UrU8NGxLEb75c8ZAJ W4a/ARTQzFFWNFPQl+5WiZpTg3uy4+S3OvV6FVA2XPOa9aD6Rg3SeSkSnuXmy+G0dHT1 Bfou+0S6D2INPfuIDdk7S30qop2+E35Veizx752FyYYwf2OsHPGoxH8AqeMkarLW77yo BTspUZyfPG8eaA1f1Z5RkFF4vBDZc2cNy08C1EuRqhlN/eOFnC2EMy39Yx/s6fnecgsX DYlHK6hxDmsPjKFx97HywNlsYa1a7wGZMYF5LkYXcGv3vx2XlHuuDZuM1si0v3w3ONxP VlkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=KUJkzNUebLWsMPhiPEPtk85imKEe8v85XStJpK7tESE=; b=TDdcSUg08fqqRFVv+jTTjI0thVqJzLO0en7fBjMphhXH8bf9SnNgxTKXt2DJh2fW60 0g76AkmCirKQwUziS5iSV8DYxcixoOdFdMGtlb2vC1u0fRv/SfcmVxMF/U8USY4u/aRE 2TvDc08mm/jj/W3I4MTfQxTOC4xUC+8dXpTiBn/800rqBbz0yFqm84KgHCWtXkBgpoOf cdGBPQT6DRzXXM4orOmsMQcFIzwC8kdPJ/uWwb9ASoqMNAtDEIq4ePymNlHyaeCBNJGk 8AX+3Ld3ht0MwAOweBRH5vGP1eZ/Ug4He2kTQRRzb93Dahf5undvYZ6cOcRhsH/sHn+L BDcA== X-Gm-Message-State: AEkooutOReHfYeLYX12iKcyp/46hiCBmg9zb6WjgwgQn7rpMdxlfqxH+CM8bL3RxU8dQ4g== X-Received: by 10.55.198.22 with SMTP id b22mr8584206qkj.204.1470340765335; Thu, 04 Aug 2016 12:59:25 -0700 (PDT) Received: from localhost.localdomain (c-50-187-52-22.hsd1.nh.comcast.net. [50.187.52.22]) by smtp.gmail.com with ESMTPSA id g29sm7768147qtg.12.2016.08.04.12.59.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Aug 2016 12:59:24 -0700 (PDT) Date: Thu, 4 Aug 2016 16:02:46 -0400 From: Eric Whitney To: fstests@vger.kernel.org Cc: linux-ext4@vger.kernel.org, tytso@mit.edu Subject: [PATCH] common/defrag: rework _require_defrag for ext4 Message-ID: <20160804200246.GA2208@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org The existing _require_defrag function rejects ext4 file systems mounted with the dax option or constructed without extents. However, there are also a number of other ext4 file system configuration cases that do not currently support online defrag, including encryption, data journaling, and bigalloc. In the future, online defrag functionality may be implemented for some of these, and new configuration cases could be added that don't support it. Rather than add a laundry list of mount and file system configuration options to the existing _require_defrag function that will need ongoing maintenance, use the available src/e4compact program to directly determine whether the kernel supports ext4's move extent ioctl on the test file system. Signed-off-by: Eric Whitney --- common/defrag | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/common/defrag b/common/defrag index 7db0cb4..986b4bf 100644 --- a/common/defrag +++ b/common/defrag @@ -27,14 +27,19 @@ _require_defrag() DEFRAG_PROG="$XFS_FSR_PROG" ;; ext4|ext4dev) - echo $MOUNT_OPTIONS | grep -q dax + testfile="$TEST_DIR/$$-test.defrag" + donorfile="$TEST_DIR/$$-donor.defrag" + bsize=`get_block_size $TEST_DIR` + $XFS_IO_PROG -f -c "pwrite -b $bsize 0 $bsize" $testfile > /dev/null + cp $testfile $donorfile + echo $testfile | $here/src/e4compact -v -f $donorfile | \ + grep -q "err:95" if [ $? -eq 0 ]; then - _notrun "$FSTYP defragmentation not supported with DAX" - else - DEFRAG_PROG="$E4DEFRAG_PROG" + rm -f $testfile $donorfile 2>&1 > /dev/null + _notrun "$FSTYP test filesystem doesn't support online defrag" fi - dumpe2fs -h $TEST_DEV 2> /dev/null | grep -wq extent || \ - _notrun "file system does not have extents, needed for defrag" + rm -f $testfile $donorfile 2>&1 > /dev/null + DEFRAG_PROG="$E4DEFRAG_PROG" ;; btrfs) DEFRAG_PROG="$BTRFS_UTIL_PROG filesystem defragment"