From patchwork Wed Feb 5 22:48:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Moyer X-Patchwork-Id: 11367305 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 B202414E3 for ; Wed, 5 Feb 2020 22:48:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 90917218AC for ; Wed, 5 Feb 2020 22:48:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="erCXd6pP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727607AbgBEWsZ (ORCPT ); Wed, 5 Feb 2020 17:48:25 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:45801 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727389AbgBEWsZ (ORCPT ); Wed, 5 Feb 2020 17:48:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580942904; 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=ZEYBcodEQheuhpFfEN+YUYsb4nlhPnB2q7hb4r/C62E=; b=erCXd6pPz3/RRzElb3y6XZif53abg718nJxrdWNsWmkuTPpnrvzP04eKU630sAhAIA58wm vNR6+UCEGrl0e+TLXkGG+g4MS/0g8vHrwyNwKrETJzukDLJa/PnGU64wTbeD8INhCGMfeJ iiZiX7bFpnicgiz5/sQpK8VPAMTbdOY= 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-336-LpAcnSVCMFS29N8Prp6DAA-1; Wed, 05 Feb 2020 17:48:22 -0500 X-MC-Unique: LpAcnSVCMFS29N8Prp6DAA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6444E190D340; Wed, 5 Feb 2020 22:48:21 +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 497C45DA75; Wed, 5 Feb 2020 22:48:21 +0000 (UTC) Received: by segfault.boston.devel.redhat.com (Postfix, from userid 3734) id 4841520675C6; Wed, 5 Feb 2020 17:48:20 -0500 (EST) From: Jeff Moyer To: linux-fsdevel@vger.kernel.org Cc: linux-xfs@vger.kernel.org, Jeff Moyer Subject: [PATCH 1/3] dax/dm: disable testing on devices that don't support dax Date: Wed, 5 Feb 2020 17:48:16 -0500 Message-Id: <20200205224818.18707-2-jmoyer@redhat.com> In-Reply-To: <20200205224818.18707-1-jmoyer@redhat.com> References: <20200205224818.18707-1-jmoyer@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Move the hack out of dmflakey and put it into _require_dm_target. This fixes up a lot of missed tests that are failing due to the lack of dax support (such as tests on dm-thin, snapshot, etc). Signed-off-by: Jeff Moyer --- common/dmflakey | 5 ----- common/rc | 11 +++++++++++ 2 files changed, 11 insertions(+), 5 deletions(-) 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/rc b/common/rc index eeac1355..785f34c6 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|error) + ;; + *) + _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 Wed Feb 5 22:48:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Moyer X-Patchwork-Id: 11367313 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 7E45814D5 for ; Wed, 5 Feb 2020 22:48:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5C159218AC for ; Wed, 5 Feb 2020 22:48:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="heBi+B/B" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727620AbgBEWs2 (ORCPT ); Wed, 5 Feb 2020 17:48:28 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:39923 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727389AbgBEWs0 (ORCPT ); Wed, 5 Feb 2020 17:48:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580942905; 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=heBi+B/BS095kMJ8VFATPKJdmVIzm8TTuhPubmqKM9cVnKtPqiN8+Jkv4vD9Qg4LObWfpe j7h44f64/h7/qQEH8xEiB5xi0/pMB1Rsrai3w0h5G4nd6jv94ZVRfUVeqDm15wMxtEkGF0 A5pOlSowQfbeL2AjIlEpy1py+Z8XT9M= 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-346-Arg-gos3NIq1Mp_hcL-EvA-1; Wed, 05 Feb 2020 17:48:22 -0500 X-MC-Unique: Arg-gos3NIq1Mp_hcL-EvA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 65D911081FA2; Wed, 5 Feb 2020 22:48:21 +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 49B7284DB8; Wed, 5 Feb 2020 22:48:21 +0000 (UTC) Received: by segfault.boston.devel.redhat.com (Postfix, from userid 3734) id 4B4A3208CD11; Wed, 5 Feb 2020 17:48:20 -0500 (EST) From: Jeff Moyer To: linux-fsdevel@vger.kernel.org Cc: linux-xfs@vger.kernel.org, Jeff Moyer Subject: [PATCH 2/3] t_mmap_collision: fix hard-coded page size Date: Wed, 5 Feb 2020 17:48:17 -0500 Message-Id: <20200205224818.18707-3-jmoyer@redhat.com> In-Reply-To: <20200205224818.18707-1-jmoyer@redhat.com> References: <20200205224818.18707-1-jmoyer@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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 Wed Feb 5 22:48:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Moyer X-Patchwork-Id: 11367311 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 F34C714E3 for ; Wed, 5 Feb 2020 22:48:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C83AE214AF for ; Wed, 5 Feb 2020 22:48:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MNjlhtt/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727617AbgBEWs0 (ORCPT ); Wed, 5 Feb 2020 17:48:26 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:56258 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727562AbgBEWs0 (ORCPT ); Wed, 5 Feb 2020 17:48:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580942904; 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=MNjlhtt/alMa2Mu3QkQR02vVR2uYPqIBcRpKslVHNEkCPQHlPFEhQLBDg8wH+WqNh5qvqA LRAte+Y6rZhz/rwpfC2I671snqvOW8wK7VQdtPh1rr/QOoNbhFk++bHIHtx+IVxgdrJC0F 1fNdNseeh3ejkSSR3alqMoM4gbnHl74= 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-40-wdQJQxF3NOyPxJUEGsh1cQ-1; Wed, 05 Feb 2020 17:48:22 -0500 X-MC-Unique: wdQJQxF3NOyPxJUEGsh1cQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 64592190D341; Wed, 5 Feb 2020 22:48:21 +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 498075DA7C; Wed, 5 Feb 2020 22:48:21 +0000 (UTC) Received: by segfault.boston.devel.redhat.com (Postfix, from userid 3734) id 4F927208D0E6; Wed, 5 Feb 2020 17:48:20 -0500 (EST) From: Jeff Moyer To: linux-fsdevel@vger.kernel.org Cc: linux-xfs@vger.kernel.org, Jeff Moyer Subject: [PATCH 3/3] xfs/300: modify test to work on any fs block size Date: Wed, 5 Feb 2020 17:48:18 -0500 Message-Id: <20200205224818.18707-4-jmoyer@redhat.com> In-Reply-To: <20200205224818.18707-1-jmoyer@redhat.com> References: <20200205224818.18707-1-jmoyer@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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