From patchwork Thu Feb 20 20:06:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Moyer X-Patchwork-Id: 11394907 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B717D17E0 for ; Thu, 20 Feb 2020 20:06:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 96DA7208CD for ; Thu, 20 Feb 2020 20:06:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="N1xxaST+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728963AbgBTUGk (ORCPT ); Thu, 20 Feb 2020 15:06:40 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:46399 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728770AbgBTUGj (ORCPT ); Thu, 20 Feb 2020 15:06:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582229198; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U/oLbx5cHHC38z0dd70vpQOtX19OGfnYLbW8tHaodgw=; b=N1xxaST+WrYXpiN+88PC9hsJIAbSCGzvcB2O27jMc7Jo7NIRelODVwJq34Ges9upQpEBLD 4ksiwoDQZbCZsjqRZaJfFFkbMtx6S6TBzLOwAYMgeyjhp7Yp4GPEw5ZWg7w0wClNgE0k1y b1WnDUrzGTpPHbCLUpBb9luutgsChvo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-176-oTXoGsccMzS-R5h8VXKLkw-1; Thu, 20 Feb 2020 15:06:36 -0500 X-MC-Unique: oTXoGsccMzS-R5h8VXKLkw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B7AC68017CC; Thu, 20 Feb 2020 20:06:35 +0000 (UTC) Received: from segfault.boston.devel.redhat.com (segfault.boston.devel.redhat.com [10.19.60.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99CF387B0A; Thu, 20 Feb 2020 20:06:35 +0000 (UTC) Received: by segfault.boston.devel.redhat.com (Postfix, from userid 3734) id 9602B2015B1C; Thu, 20 Feb 2020 15:06:34 -0500 (EST) From: Jeff Moyer To: fstests@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, Jeff Moyer Subject: [PATCH V2 1/3] dax/dm: disable testing on devices that don't support dax Date: Thu, 20 Feb 2020 15:06:30 -0500 Message-Id: <20200220200632.14075-2-jmoyer@redhat.com> In-Reply-To: <20200220200632.14075-1-jmoyer@redhat.com> References: <20200220200632.14075-1-jmoyer@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Move the check for dax from the individual target scripts into _require_dm_target. This fixes up a couple of missed tests that are failing due to the lack of dax support (such as tests requiring dm-snapshot). Signed-off-by: Jeff Moyer --- common/dmdelay | 5 ----- common/dmerror | 5 ----- common/dmflakey | 5 ----- common/dmthin | 5 ----- common/rc | 11 +++++++++++ 5 files changed, 11 insertions(+), 20 deletions(-) diff --git a/common/dmdelay b/common/dmdelay index f1e725b9..66cac1a7 100644 --- a/common/dmdelay +++ b/common/dmdelay @@ -7,11 +7,6 @@ DELAY_NONE=0 DELAY_READ=1 -echo $MOUNT_OPTIONS | grep -q dax -if [ $? -eq 0 ]; then - _notrun "Cannot run tests with DAX on dmdelay devices" -fi - _init_delay() { local BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV` diff --git a/common/dmerror b/common/dmerror index 426f1e96..7d12e0a1 100644 --- a/common/dmerror +++ b/common/dmerror @@ -4,11 +4,6 @@ # # common functions for setting up and tearing down a dmerror device -echo $MOUNT_OPTIONS | grep -q dax -if [ $? -eq 0 ]; then - _notrun "Cannot run tests with DAX on dmerror devices" -fi - _dmerror_setup() { local dm_backing_dev=$SCRATCH_DEV diff --git a/common/dmflakey b/common/dmflakey index 2af3924d..b4e11ae9 100644 --- a/common/dmflakey +++ b/common/dmflakey @@ -8,11 +8,6 @@ FLAKEY_ALLOW_WRITES=0 FLAKEY_DROP_WRITES=1 FLAKEY_ERROR_WRITES=2 -echo $MOUNT_OPTIONS | grep -q dax -if [ $? -eq 0 ]; then - _notrun "Cannot run tests with DAX on dmflakey devices" -fi - _init_flakey() { local BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV` diff --git a/common/dmthin b/common/dmthin index 7946e9a7..61dd6f89 100644 --- a/common/dmthin +++ b/common/dmthin @@ -21,11 +21,6 @@ DMTHIN_POOL_DEV="/dev/mapper/$DMTHIN_POOL_NAME" DMTHIN_VOL_NAME="thin-vol" DMTHIN_VOL_DEV="/dev/mapper/$DMTHIN_VOL_NAME" -echo $MOUNT_OPTIONS | grep -q dax -if [ $? -eq 0 ]; then - _notrun "Cannot run tests with DAX on dmthin devices" -fi - _dmthin_cleanup() { $UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1 diff --git a/common/rc b/common/rc index eeac1355..65cde32b 100644 --- a/common/rc +++ b/common/rc @@ -1874,6 +1874,17 @@ _require_dm_target() _require_sane_bdev_flush $SCRATCH_DEV _require_command "$DMSETUP_PROG" dmsetup + echo $MOUNT_OPTIONS | grep -q dax + if [ $? -eq 0 ]; then + case $target in + stripe|linear|log-writes) + ;; + *) + _notrun "Cannot run tests with DAX on $target devices." + ;; + esac + fi + modprobe dm-$target >/dev/null 2>&1 $DMSETUP_PROG targets 2>&1 | grep -q ^$target From patchwork Thu Feb 20 20:06:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Moyer X-Patchwork-Id: 11394923 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 18193109A for ; Thu, 20 Feb 2020 20:06:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ECB8B207FD for ; Thu, 20 Feb 2020 20:06:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="It5xKGkQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728927AbgBTUGn (ORCPT ); Thu, 20 Feb 2020 15:06:43 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:27155 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728988AbgBTUGm (ORCPT ); Thu, 20 Feb 2020 15:06:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582229201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iiv+hFypyOtyHQ75Ev+LMGFV0c8VrCNpawf4WxNY7Yw=; b=It5xKGkQrjbTsrJYd71P6meT3eWGBXwZFaKadHPpnFE02QtYrZriWIu9QaUgF//313eqgN F6jPevt9WGIquqsr1KGwkPgKBgj3UxJtqWLaKlGMsFSIA76iWqf6ZhgpD1VxOApTs3u0LG REQxukUoDm/16XWMX6eroNXmrwkTEEI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-76-X4oQB5BTOPe3qAk79UdDpw-1; Thu, 20 Feb 2020 15:06:36 -0500 X-MC-Unique: X4oQB5BTOPe3qAk79UdDpw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CE4E18010E5; Thu, 20 Feb 2020 20:06:35 +0000 (UTC) Received: from segfault.boston.devel.redhat.com (segfault.boston.devel.redhat.com [10.19.60.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A8EE388; Thu, 20 Feb 2020 20:06:35 +0000 (UTC) Received: by segfault.boston.devel.redhat.com (Postfix, from userid 3734) id 99542203CFC0; Thu, 20 Feb 2020 15:06:34 -0500 (EST) From: Jeff Moyer To: fstests@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, Jeff Moyer Subject: [PATCH V2 2/3] t_mmap_collision: fix hard-coded page size Date: Thu, 20 Feb 2020 15:06:31 -0500 Message-Id: <20200220200632.14075-3-jmoyer@redhat.com> In-Reply-To: <20200220200632.14075-1-jmoyer@redhat.com> References: <20200220200632.14075-1-jmoyer@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Fix the test to run on non-4k page size systems. Signed-off-by: Jeff Moyer --- src/t_mmap_collision.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/t_mmap_collision.c b/src/t_mmap_collision.c index d547bc05..c872f4e2 100644 --- a/src/t_mmap_collision.c +++ b/src/t_mmap_collision.c @@ -25,13 +25,12 @@ #include #include -#define PAGE(a) ((a)*0x1000) -#define FILE_SIZE PAGE(4) - void *dax_data; int nodax_fd; int dax_fd; bool done; +static int pagesize; +static int file_size; #define err_exit(op) \ { \ @@ -49,18 +48,18 @@ void punch_hole_fn(void *ptr) read = 0; do { - rc = pread(nodax_fd, dax_data + read, FILE_SIZE - read, + rc = pread(nodax_fd, dax_data + read, file_size - read, read); if (rc > 0) read += rc; } while (rc > 0); - if (read != FILE_SIZE || rc != 0) + if (read != file_size || rc != 0) err_exit("pread"); rc = fallocate(dax_fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, - 0, FILE_SIZE); + 0, file_size); if (rc < 0) err_exit("fallocate"); @@ -81,18 +80,18 @@ void zero_range_fn(void *ptr) read = 0; do { - rc = pread(nodax_fd, dax_data + read, FILE_SIZE - read, + rc = pread(nodax_fd, dax_data + read, file_size - read, read); if (rc > 0) read += rc; } while (rc > 0); - if (read != FILE_SIZE || rc != 0) + if (read != file_size || rc != 0) err_exit("pread"); rc = fallocate(dax_fd, FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE, - 0, FILE_SIZE); + 0, file_size); if (rc < 0) err_exit("fallocate"); @@ -113,11 +112,11 @@ void truncate_down_fn(void *ptr) if (ftruncate(dax_fd, 0) < 0) err_exit("ftruncate"); - if (fallocate(dax_fd, 0, 0, FILE_SIZE) < 0) + if (fallocate(dax_fd, 0, 0, file_size) < 0) err_exit("fallocate"); do { - rc = pread(nodax_fd, dax_data + read, FILE_SIZE - read, + rc = pread(nodax_fd, dax_data + read, file_size - read, read); if (rc > 0) read += rc; @@ -142,15 +141,15 @@ void collapse_range_fn(void *ptr) while (!done) { read = 0; - if (fallocate(dax_fd, 0, 0, FILE_SIZE) < 0) + if (fallocate(dax_fd, 0, 0, file_size) < 0) err_exit("fallocate 1"); - if (fallocate(dax_fd, FALLOC_FL_COLLAPSE_RANGE, 0, PAGE(1)) < 0) + if (fallocate(dax_fd, FALLOC_FL_COLLAPSE_RANGE, 0, pagesize) < 0) err_exit("fallocate 2"); - if (fallocate(dax_fd, 0, 0, FILE_SIZE) < 0) + if (fallocate(dax_fd, 0, 0, file_size) < 0) err_exit("fallocate 3"); do { - rc = pread(nodax_fd, dax_data + read, FILE_SIZE - read, + rc = pread(nodax_fd, dax_data + read, file_size - read, read); if (rc > 0) read += rc; @@ -192,6 +191,9 @@ int main(int argc, char *argv[]) exit(0); } + pagesize = getpagesize(); + file_size = 4 * pagesize; + dax_fd = open(argv[1], O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); if (dax_fd < 0) err_exit("dax_fd open"); @@ -202,15 +204,15 @@ int main(int argc, char *argv[]) if (ftruncate(dax_fd, 0) < 0) err_exit("dax_fd ftruncate"); - if (fallocate(dax_fd, 0, 0, FILE_SIZE) < 0) + if (fallocate(dax_fd, 0, 0, file_size) < 0) err_exit("dax_fd fallocate"); if (ftruncate(nodax_fd, 0) < 0) err_exit("nodax_fd ftruncate"); - if (fallocate(nodax_fd, 0, 0, FILE_SIZE) < 0) + if (fallocate(nodax_fd, 0, 0, file_size) < 0) err_exit("nodax_fd fallocate"); - dax_data = mmap(NULL, FILE_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, + dax_data = mmap(NULL, file_size, PROT_READ|PROT_WRITE, MAP_SHARED, dax_fd, 0); if (dax_data == MAP_FAILED) err_exit("mmap"); @@ -220,7 +222,7 @@ int main(int argc, char *argv[]) run_test(&truncate_down_fn); run_test(&collapse_range_fn); - if (munmap(dax_data, FILE_SIZE) != 0) + if (munmap(dax_data, file_size) != 0) err_exit("munmap"); err = close(dax_fd); From patchwork Thu Feb 20 20:06:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Moyer X-Patchwork-Id: 11394913 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E56E1109A for ; Thu, 20 Feb 2020 20:06:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BB7E420722 for ; Thu, 20 Feb 2020 20:06:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PGreV+6c" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729041AbgBTUGl (ORCPT ); Thu, 20 Feb 2020 15:06:41 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:53663 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728988AbgBTUGl (ORCPT ); Thu, 20 Feb 2020 15:06:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582229200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wR5HRYcM5uIHBhBeX4VTBixBrxH10MbVv1tab5F2B7Y=; b=PGreV+6covNF7MleRyvsPphLMbe1WzL/2kY9LFOGPiX2QdMMk/yP0cuuTYpJIvY47sj/Rw 6dsVM9wdv0aGeudd9PU8mwj3AcROAEbIqHPADmy0lZ6TzSRPnMjSoa7TT+yMxv0cd3czn2 XJ1RX8ZA8yMQi3DJn5u/xpoq/+PRR8I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-222-j3A7chXyOqmVGJRm5sYKaw-1; Thu, 20 Feb 2020 15:06:36 -0500 X-MC-Unique: j3A7chXyOqmVGJRm5sYKaw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8A2A713E6; Thu, 20 Feb 2020 20:06:35 +0000 (UTC) Received: from segfault.boston.devel.redhat.com (segfault.boston.devel.redhat.com [10.19.60.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 716835C1B0; Thu, 20 Feb 2020 20:06:35 +0000 (UTC) Received: by segfault.boston.devel.redhat.com (Postfix, from userid 3734) id 9DB572067400; Thu, 20 Feb 2020 15:06:34 -0500 (EST) From: Jeff Moyer To: fstests@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, Jeff Moyer Subject: [PATCH V2 3/3] xfs/300: modify test to work on any fs block size Date: Thu, 20 Feb 2020 15:06:32 -0500 Message-Id: <20200220200632.14075-4-jmoyer@redhat.com> In-Reply-To: <20200220200632.14075-1-jmoyer@redhat.com> References: <20200220200632.14075-1-jmoyer@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org The test currently assumes a file system block size of 4k. It will work just fine on any user-specified block size, though. Signed-off-by: Jeff Moyer --- tests/xfs/300 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/xfs/300 b/tests/xfs/300 index 28608b81..4f1c927a 100755 --- a/tests/xfs/300 +++ b/tests/xfs/300 @@ -50,8 +50,9 @@ $XFS_IO_PROG -f -c "pwrite -S 0x63 0 4096" $SCRATCH_MNT/attrvals >> $seqres.full cat $SCRATCH_MNT/attrvals | attr -s name $SCRATCH_MNT/$seq.test >> $seqres.full 2>&1 # Fragment the file by writing backwards +bs=$(_get_file_block_size $SCRATCH_MNT) for I in `seq 6 -1 0`; do - dd if=/dev/zero of=$SCRATCH_MNT/$seq.test seek=$I bs=4k \ + dd if=/dev/zero of=$SCRATCH_MNT/$seq.test seek=$I bs=${bs} \ oflag=direct count=1 conv=notrunc >> $seqres.full 2>&1 done