Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp702598lqh; Thu, 28 Mar 2024 13:42:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUmxG9mIvQd8y1megW6mxJ7EmJZ6Be07SqUIyYBFpBnndZ+IB+WAcaGuIjjZs/nff6fC8s+cF3DSjcExu7WHuJ1+4ACRmeaGIJ6pWK/jA== X-Google-Smtp-Source: AGHT+IFwGdVGfy85l7lC6dfIr3kZp/jzAhHR+3GOgobKURJfGatZ5jMzZWAaHXAL4ZzR7OsJP76U X-Received: by 2002:a17:902:f683:b0:1e0:fc73:8f81 with SMTP id l3-20020a170902f68300b001e0fc738f81mr620887plg.64.1711658547444; Thu, 28 Mar 2024 13:42:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711658547; cv=pass; d=google.com; s=arc-20160816; b=s/wcoO+evmd7+Wuwq7LMFv5UM9UTV+mcXX9LQThk+Z2M9VOeqRfWlClC+EGLwkRsDp 1FTpBqdbyH+jQTN05RLu2yR/euI6e264UZMDrXco20v4dxzvPQ0xYgMBvn+Tk8pRNEeS AZTsGCcwcMNnLjU3V5VJa8oWAmgbZEl+ZnC6BUdEYyu32RqL8ECCyQGw1AxupVXRcOJf mC5yKxS2ZJTffiOd1/xB71Gv0lLyEcfY23KL7KWrrG0LRL4Kl03bcIKtx8d3FcXrX8dT Gm7EafwqsEVz2eKfcveINh3OeD/7j2WIjlOpM7FJ91Vzqq90nrVKBlX7k2o0sR+yrqN7 EMLQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Nu/r5NDd0Gy6+JgiI/0jpbuTZcHkzRRhPWBk6MBfw3I=; fh=RMJuV2Y3SJza63ZzuPXP6nO1gt49mM9k7teQJSpE9RE=; b=JLRGBU4L9SvXAFFqGylUBhtd6tVK04ntpWbppgTgGuzQjvdopWda1Yj5LIjEWMjm3J QlaT8DwEUMq5bGM/qTohNoGXSn2ZHtRDEIdnQ3DkW0Tw3q5GsztEaCTXe5e72F5T+j57 zDDfJTs9SX8u+BK0bInIcAY/aRKilgfkybOS7u2IF9oc4L+mmGtWIDKp6gFqltkzD1LW R1ZugWQMY8zDex/0COEwqagjWHhyA2t1JYJ05VVvzKOTmDo6UTOKMEcymhQ+4rIUCOrJ eT/Sj35elUCkwpzhniS+UqsXPQjep8awo4ESOJngUMUZyZ0leoaXBatDk5mXatFtD5BJ s+Mw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UdWyUkjt; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-123607-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123607-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y16-20020a17090264d000b001deef4992fasi2021454pli.248.2024.03.28.13.42.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 13:42:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123607-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UdWyUkjt; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-123607-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123607-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 184C829A656 for ; Thu, 28 Mar 2024 20:42:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 859CE13BC28; Thu, 28 Mar 2024 20:40:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UdWyUkjt" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29AF313AA5C for ; Thu, 28 Mar 2024 20:40:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711658432; cv=none; b=LQ1gVDddmaPlAFXjVdpyZzT/kprm8L9hsghRsuCghA/BuBDpRUZLvogBAE4ZLfln2r07KiNzVOzrNalGihmCeDfTo4zYmIyitV4PbS0T5Ql+7EjZL77TNBlzLEWAzmUGZFbCclVwOIn5xYH8oGRf0Wmm39FChUsgfrSUAJZBXRY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711658432; c=relaxed/simple; bh=FebcY8GW4qSxZjt6PKBKn/4SmoqAJZOlJIPy8dlvqF0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WCWUFfI++UP8zdC6a2aHCyPvnIcLE+jH3bM0dyM8coDK5JDjcLSyRqsXfoOCYCTt+g1ssApYNr9nb1DBRwU2HMBoLpbWAuoamNYb/i1NuJUshVJBHoolSyMidzBKdUPbq9R8kjGOhbM6kjL5WMQ5qibXpmyieIargvUxUTXEim8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=UdWyUkjt; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711658430; 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=Nu/r5NDd0Gy6+JgiI/0jpbuTZcHkzRRhPWBk6MBfw3I=; b=UdWyUkjtTW4WJ+RlAv9g7tPDWYOSZ+yZwYTfwWcoSlGQ5pFTITWIftlrrIDM/Sihe2sFq0 lChbQSjhJXVVnom4KZNIxozBFLTBI8fvmOcOCCWM7J8Oj2SJyrdQEGk8afTn9dzb1Tm3Xj KNJizN43ptSomckYlstOlkImtXa8nJY= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-507-IncmixdjM7iaA-qSd38v7g-1; Thu, 28 Mar 2024 16:40:26 -0400 X-MC-Unique: IncmixdjM7iaA-qSd38v7g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5E2142802267; Thu, 28 Mar 2024 20:40:26 +0000 (UTC) Received: from localhost (unknown [10.39.194.117]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5233FC1576F; Thu, 28 Mar 2024 20:40:25 +0000 (UTC) From: Stefan Hajnoczi To: linux-block@vger.kernel.org Cc: linux-kernel@vger.kernel.org, eblake@redhat.com, Alasdair Kergon , Mikulas Patocka , dm-devel@lists.linux.dev, David Teigland , Mike Snitzer , Jens Axboe , Christoph Hellwig , Joe Thornber , Stefan Hajnoczi Subject: [RFC 7/9] selftests: block_seek_hole: add dm-linear test Date: Thu, 28 Mar 2024 16:39:08 -0400 Message-ID: <20240328203910.2370087-8-stefanha@redhat.com> In-Reply-To: <20240328203910.2370087-1-stefanha@redhat.com> References: <20240328203910.2370087-1-stefanha@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 The dm-linear linear target passes through SEEK_HOLE/SEEK_DATA. Extend the test case to check that the same holes/data are reported as for the underlying file. Signed-off-by: Stefan Hajnoczi --- tools/testing/selftests/block_seek_hole/test.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/block_seek_hole/test.py b/tools/testing/selftests/block_seek_hole/test.py index 4f7c2d01ab3d3..6360b72aee338 100755 --- a/tools/testing/selftests/block_seek_hole/test.py +++ b/tools/testing/selftests/block_seek_hole/test.py @@ -45,6 +45,20 @@ def loop_device(file_path): finally: run(['losetup', '-d', loop_path]) +@contextmanager +def dm_linear(file_path): + file_size = os.path.getsize(file_path) + + with loop_device(file_path) as loop_path: + dm_name = f'test-{os.getpid()}' + run(['dmsetup', 'create', dm_name, '--table', + f'0 {file_size // 512} linear {loop_path} 0']) + + try: + yield f'/dev/mapper/{dm_name}' + finally: + run(['dmsetup', 'remove', dm_name]) + def test(layout, dev_context_manager): with test_file(layout) as file_path, dev_context_manager(file_path) as dev_path: cmd = run(['./map_holes.py', file_path]) @@ -99,5 +113,5 @@ if __name__ == '__main__': holes_at_beginning_and_end, no_holes, empty_file] - dev_context_managers = [loop_device] + dev_context_managers = [loop_device, dm_linear] test_all(layouts, dev_context_managers) -- 2.44.0