Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2471409pxb; Tue, 23 Feb 2021 07:51:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7V1E4fhVY/3WfVuQ3l8oouMvJwleBiEvcZL3rAo0Elef+kgxO8KVMTBc/cAtIRufmQwEx X-Received: by 2002:a05:6402:610:: with SMTP id n16mr27826437edv.288.1614095514295; Tue, 23 Feb 2021 07:51:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614095514; cv=none; d=google.com; s=arc-20160816; b=CNN1/uvGiT6IAhC1zuu/HkS2C8F6E9y82gayFyNt5w4GdRQTAUR89kzHxqQr2KQY5M S4emt+yjwNWxhVY0CNyVQU4tjr5dsPQPYcCyeIE4P2apfIbiR2sqqE1wqPAEVTaG7MWr M0NKYgL/twgIh6Gi6lHYcGDQqh9ONlHlh3D518kzaR2puyzMI/pdEBdhxTcve+kFFrye yCLhloNL2BeI3U4sYC9/38i8WEDO2LLrpGL7gjRYu5wxju0zDijJyrIG8qxP5+U6J7ea jA96megDJvfBl/QoyxUi8PPIAJOc1yrnIThG5ij6zZje9kDac+X3TtCt1HFiw470SJNM yNFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature:dkim-filter; bh=CNobBivITyIZHfV9IIhBh12WyKXN0ArCPEmTlhSkQys=; b=C2Y9bLnevIU6L1tc6SygfjsQZjWvYxp55wXynvj9Y6YDweIIQ24oKmsqXPAS3sDV6H uUA7YFhVZu8Cn2F5qXE2H9wu303l4JaO8W3UNrUk8/Az8fvYRn6z/7LGVoYXlkhBswOh kdH7zIcoAj2sXgWCehb/dEHSEcOTAmBxfpnlo6YIm2Vb7FQdCp7GTJlA9p30awHQKj/T bW0VEOePQeeWVV7MlkSCCqIm4NPxqfvCXD/lhijdjC8f6D9WCk1/bNgg55FxDGqIbS/G deAvbGi4Ag+LqG10GyL88PsWVidAgHgUCuM+YOY4KdELw7pvmqnAZTXo2fX92J0SEwg7 5jHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=AnWeEW+A; 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=pass (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 h11si3069609edb.576.2021.02.23.07.51.29; Tue, 23 Feb 2021 07:51:54 -0800 (PST) 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; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=AnWeEW+A; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233472AbhBWPtb (ORCPT + 99 others); Tue, 23 Feb 2021 10:49:31 -0500 Received: from linux.microsoft.com ([13.77.154.182]:41060 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233393AbhBWPsI (ORCPT ); Tue, 23 Feb 2021 10:48:08 -0500 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by linux.microsoft.com (Postfix) with ESMTPSA id B74C42089C9B; Tue, 23 Feb 2021 07:47:27 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B74C42089C9B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1614095247; bh=CNobBivITyIZHfV9IIhBh12WyKXN0ArCPEmTlhSkQys=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=AnWeEW+Ah60JQOeGC0VbHERpDEPpLFss8vZ9u9f1/Zj/tWCEOvEaNwGrEJHsKUib8 k/IxJZVPeLBQm2ku7quSz0P7Fb1VzwXEeKzxkZNByyfl1VskznqcWyc8zLI7Xq8I2c pINtq091F6bkw43wY5mu0wF7wRD2HO3tzV4nUV10= Received: by mail-pf1-f178.google.com with SMTP id w18so9010011pfu.9; Tue, 23 Feb 2021 07:47:27 -0800 (PST) X-Gm-Message-State: AOAM530fb7kMUxO8Tah2WM4y+nDQwVed39m0t31rVu9g9MdNHb/5b5A/ DPNLqCZqfAgf2Pbci3HfoPvjny7V/DU74BHCaIc= X-Received: by 2002:a62:fc45:0:b029:1ed:bdd2:a07d with SMTP id e66-20020a62fc450000b02901edbdd2a07dmr2847913pfh.0.1614095247349; Tue, 23 Feb 2021 07:47:27 -0800 (PST) MIME-Version: 1.0 References: <20210206000903.215028-1-mcroce@linux.microsoft.com> In-Reply-To: <20210206000903.215028-1-mcroce@linux.microsoft.com> From: Matteo Croce Date: Tue, 23 Feb 2021 16:46:51 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/5] block: add a sequence number to disks 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 6, 2021 at 1:09 AM Matteo Croce wrote: > > 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 > > 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.29.2 > Hi, Did anyone have a chance to look at this series? Ideas or suggestions? Regards, -- per aspera ad upstream