Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5553259pxj; Wed, 23 Jun 2021 04:00:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDoY0BeWRgvDdEZjQCtMdTihOZGnaOZLfYhQzmz/eDYaymgrSVEhv/2ku1ItrNfr1cS/0l X-Received: by 2002:a17:906:8495:: with SMTP id m21mr9340603ejx.181.1624446038883; Wed, 23 Jun 2021 04:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624446038; cv=none; d=google.com; s=arc-20160816; b=eI+/b5MKOVRH5YPiKep54m+XWQWlyYzsdvr1tXrilpqiFy9sEa95SGnKoQ7N4Cwxkl rf6bJBZayZGE9h6gx2zFxHZpG9olpTIytVUFJNN60WsmGVmvVlS5KjRuDfANAyDb3msD /yLobFWgRrmZI/lnANcSGMhpGig2nnvPf4iORfpj8OIRWKd9V2eSvNglTVi6TQR5ITNL nNs5AXkGGUBAGdLq3ndkAYVJwACNnxacsX8Ss+lsbTi5BSdpLHrUfwccOAigSHcUlorq B+NV7QKP5ywon+CgjumPziZ8Mxxx9sqVN0Bcz3gUfALO9nzN+jzfMUGYS838LXo4+5Tp C7Jw== 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=9AlY4fiYgbrXorQsx3xst03zsKqKyrjxSHIbQdEZSgE=; b=GB74EtKeVt3KiG78X62PsTmHfWyv+Ix/lyv1djAdXgxeui4uA2QcdAbLTNElrJ/csD RbPgvQV5i0n2jPixRPMlfUVf1xQPLRuCpq4Mw4g9kEVbiPdySBEHH1hoqRXOhOoycoFk Li2MOBmk/dX3r98kQS8StCf/MSzIopSV58VBgUa5rOQKKWkB5byNANid/bZ3nBuwb8hu UM183BPUayjJul2OgKnQbmNb4pOolTYgeY4SXQyJ3muyjOWeRiAkVnGygau6ziJjlFQC L+tzmzVjM1Dh+sz5ByktAHc8Y8Bj6dWf3aAwfDewmcTS7cOYLpy4FKn1rfbjhAdNcZe7 SOjQ== 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 ay17si3739814ejb.438.2021.06.23.04.00.16; Wed, 23 Jun 2021 04:00:38 -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 S230061AbhFWLBg (ORCPT + 99 others); Wed, 23 Jun 2021 07:01:36 -0400 Received: from mail-wr1-f44.google.com ([209.85.221.44]:37683 "EHLO mail-wr1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230030AbhFWLBg (ORCPT ); Wed, 23 Jun 2021 07:01:36 -0400 Received: by mail-wr1-f44.google.com with SMTP id i94so2149443wri.4; Wed, 23 Jun 2021 03:59:17 -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=9AlY4fiYgbrXorQsx3xst03zsKqKyrjxSHIbQdEZSgE=; b=EPVJbEpjPZM9ePdJqCAfBXfKlWHOFI99qegabS4EiLfOPGiYLvS+zZVw5fOENkhCGp 4Ys0B5QlSYgIo5pJ61tTaf8SfJkfxxPT8hl98Pj6ADTEfnBJLhwUxBuK/jNqRLC5LPDE JrcX5kv5Ufclvu30jm/MT9Vn8VM6hTGThanxjsNQTdYDstXLbZAJ8kYCUdZ7TgTkrkWf /UHtjvZQHtsd9hWYyHuma8EWvuIXr4NmEzMG5h0ZJwYk8SJuj/S27GqRe+6HSR2XmdzB WOSMDxKuR3CfqlvWxLRjZbsLvgZckmGmBpuWBFYbed+I0d7fR1UPT4xJJ+pA7zlv189w 5Y5w== X-Gm-Message-State: AOAM530G5ILl/QHVlNOfQZBE1+ukCZmEMUiT+MRhLfQ3UfIAJ+7vHtPl ucr59KQ9Ii8vsM0faQWBf2wj6cT1V3xhOw== X-Received: by 2002:a05:6000:2:: with SMTP id h2mr10621296wrx.347.1624445956594; Wed, 23 Jun 2021 03:59:16 -0700 (PDT) Received: from msft-t490s.. (mob-176-246-29-26.net.vodafone.it. [176.246.29.26]) by smtp.gmail.com with ESMTPSA id r2sm2659458wrv.39.2021.06.23.03.59.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 03:59:16 -0700 (PDT) From: Matteo Croce To: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Jens Axboe Cc: linux-kernel@vger.kernel.org, Lennart Poettering , Luca Boccassi , Alexander Viro , Damien Le Moal , Tejun Heo , =?UTF-8?q?Javier=20Gonz=C3=A1lez?= , Niklas Cassel , Johannes Thumshirn , Hannes Reinecke , Matthew Wilcox , Christoph Hellwig , JeffleXu Subject: [PATCH v3 0/6] block: add a sequence number to disks Date: Wed, 23 Jun 2021 12:58:52 +0200 Message-Id: <20210623105858.6978-1-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.31.1 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, the 5th increases the seqnum on media change and the last one increases the sequence number for loop devices upon attach, detach or reconfigure. If merged, this feature will immediately used by the userspace: https://github.com/systemd/systemd/issues/17469#issuecomment-762919781 v2 -> v3: - rebased on top of 5.13-rc7 - resend because it appeared archived on patchwork v1 -> v2: - increase seqnum on media change - increase on loop detach Matteo Croce (6): block: add disk sequence number block: add ioctl to read the disk sequence number block: refactor sysfs code block: export diskseq in sysfs block: increment sequence number loop: increment sequence number Documentation/ABI/testing/sysfs-block | 12 +++++++ block/genhd.c | 46 ++++++++++++++++++++++++--- block/ioctl.c | 2 ++ drivers/block/loop.c | 5 +++ include/linux/genhd.h | 2 ++ include/uapi/linux/fs.h | 1 + 6 files changed, 64 insertions(+), 4 deletions(-) -- 2.31.1