Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3641351pxf; Mon, 15 Mar 2021 14:43:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys2byjYEFy66FAPzJk+sR3sRg5sFfYxVjid5R046I1hLQoddDzyaItyHv5Iibo4yVrTEtx X-Received: by 2002:a17:906:4d44:: with SMTP id b4mr26035938ejv.338.1615844592269; Mon, 15 Mar 2021 14:43:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615844592; cv=none; d=google.com; s=arc-20160816; b=kM6Z3NIuX9L96OUD1L9IVaUI3G4KYtK6Z4wvLmztfPpyFgKQcOj5wj42U/SIBc2xeY YHeayHDhqDHhYujlcq0gCNskcAYGzN59HcaZ1SiWdPhJn2mNrWgZ4VQ/FbIyAsHdjMOp 0AseUyUcwmRS41aANDVwE0zOHt79CZ6PxKaTXcdgE0oycn1wq2ugZm51Aljq7bMEasXU 8ExEweq8sF3/LwXDQhT/CEOGbAQI55wpaqyWZMSDhIMyBo0l0azuCbfvi5D8ai/H3YGJ ysFLTWQrU9Jpp4qlV1ZsO6K3Rwoag26zsQHcElsNU9Q6Rta+tOkia+OWAFOvrPGbAC09 iEcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=embSwMWKLR6mcojsmr9qI/asFqc3qxsVqoQVl8EgYLk=; b=QNLkAr/1mYNhWU84qn6cbJLdd85WZpRLsO7vtB6s4WOP8YoXsSQ0BkYhQttI6gep5Z h2MmW1i5zl+mzvuuERNbKLKtvAjr9/oYGiPk61U6t6LkDUPmiBzo1cLmjwvjZ4+k9qBY 2HC2iY3UX0O8k748AXAWvdEVW0y/hTmnLQr9VkObyiDSdb8ZXfXeA4QxfkIQgLgG2HCV gvlzKNVU/QWsfVUNQR2oQ4r4SBMsG9KhDoND+wPEASVaJff6yQFtOUlg1z+5V3mDjsd8 EFej2IhnLOgvYKFXgIN5jSKFRPo48WT1qRUU/slQCv5ECE/K2stARoKRtgZUT7T4lX6r 85Mw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r25si11753235ejs.195.2021.03.15.14.42.49; Mon, 15 Mar 2021 14:43:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233936AbhCOUDF (ORCPT + 99 others); Mon, 15 Mar 2021 16:03:05 -0400 Received: from mail-ej1-f50.google.com ([209.85.218.50]:33975 "EHLO mail-ej1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233923AbhCOUCz (ORCPT ); Mon, 15 Mar 2021 16:02:55 -0400 Received: by mail-ej1-f50.google.com with SMTP id si25so12686408ejb.1; Mon, 15 Mar 2021 13:02:54 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=embSwMWKLR6mcojsmr9qI/asFqc3qxsVqoQVl8EgYLk=; b=Ap6WK7et//RMwv4PoAfLVBkmaxWXZSlNS/OzSouGECrQf8rKNt63SgZPIboy85WY9k Yms0aoKrSSkzJo8PRI0d24R2TNPFZyV9qi33qTWS+aoqp5ruYzRWQSvHnMN9PwxbWer2 U6Bb8cZm6yprSFweJgsTvUBiNUcC8RJl2xa7pfGm+MUuYM/iT1X8DS9rs4WAd/FLC+7C JIezABlNqWaX2v6Vde1sADiH8d9tiiLRb722494oiKhwmCk57opEE6r++9MuZOC4TzDS LF8yoW9SfQcbvWjqgV14rduwUE/1CPra19eT9/V+QaucxdBKlHMQmLOJyEJlCCCwcQRR Y0BA== X-Gm-Message-State: AOAM5335k+GFNkQRqde06k3BlNVRz+ROleIaEofu5T2gFUEvtIjX5WGE XYeiaDjWk4haNfq8yhb/Q4IPpgbuAHydaw== X-Received: by 2002:a17:906:3b47:: with SMTP id h7mr25280421ejf.377.1615838573458; Mon, 15 Mar 2021 13:02:53 -0700 (PDT) Received: from msft-t490s.teknoraver.net (net-188-216-41-250.cust.vodafonedsl.it. [188.216.41.250]) by smtp.gmail.com with ESMTPSA id x21sm8551210eds.53.2021.03.15.13.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 13:02:52 -0700 (PDT) From: Matteo Croce To: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Lennart Poettering , Luca Boccassi , Jens Axboe , Alexander Viro , Damien Le Moal , Tejun Heo , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , Niklas Cassel , Johannes Thumshirn , Hannes Reinecke Subject: [PATCH -next 0/5] block: add a sequence number to disks Date: Mon, 15 Mar 2021 21:02:37 +0100 Message-Id: <20210315200242.67355-1-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matteo Croce With this series a monotonically increasing number is added to disks, precisely in the genhd struct, and it's exported in sysfs and uevent. This helps the userspace correlate events for devices that reuse the same device, like loop. The first patch is the core one, the 2..4 expose the information in different ways, while the last one increase the sequence number for loop devices at every attach. # udevadm monitor -kp |grep -e ^DEVNAME -e ^DISKSEQ & [1] 523 # losetup -fP 3part [ 3698.615848] loop0: detected capacity change from 16384 to 0 DEVNAME=/dev/loop0 DISKSEQ=13 [ 3698.647189] loop0: p1 p2 p3 DEVNAME=/dev/loop0 DISKSEQ=13 DEVNAME=/dev/loop0p1 DISKSEQ=13 DEVNAME=/dev/loop0p2 DISKSEQ=13 DEVNAME=/dev/loop0p3 DISKSEQ=13 # losetup -fP 2part [ 3705.170766] loop1: detected capacity change from 40960 to 0 DEVNAME=/dev/loop1 DISKSEQ=14 [ 3705.247280] loop1: p1 p2 DEVNAME=/dev/loop1 DISKSEQ=14 DEVNAME=/dev/loop1p1 DISKSEQ=14 DEVNAME=/dev/loop1p2 DISKSEQ=14 # ./getdiskseq /dev/loop* /dev/loop0: 13 /dev/loop0p1: 13 /dev/loop0p2: 13 /dev/loop0p3: 13 /dev/loop1: 14 /dev/loop1p1: 14 /dev/loop1p2: 14 /dev/loop2: 5 /dev/loop3: 6 /dev/loop-control: Function not implemented # grep . /sys/class/block/*/diskseq /sys/class/block/loop0/diskseq:13 /sys/class/block/loop1/diskseq:14 /sys/class/block/loop2/diskseq:5 /sys/class/block/loop3/diskseq:6 /sys/class/block/ram0/diskseq:1 /sys/class/block/ram1/diskseq:2 /sys/class/block/vda/diskseq:7 If merged, this feature will immediately used by the userspace: https://github.com/systemd/systemd/issues/17469#issuecomment-762919781 This is just a resend after the merge window and rebased on linux-block. Also, added more people in CC from the get_maintainer.pl output as well as -next in the subject. Matteo Croce (5): block: add disk sequence number block: add ioctl to read the disk sequence number block: refactor sysfs code block: export diskseq in sysfs loop: increment sequence number Documentation/ABI/testing/sysfs-block | 12 ++++++++ block/genhd.c | 43 ++++++++++++++++++++++++--- block/ioctl.c | 2 ++ drivers/block/loop.c | 3 ++ include/linux/genhd.h | 2 ++ include/uapi/linux/fs.h | 1 + 6 files changed, 59 insertions(+), 4 deletions(-) -- 2.30.2