Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp801752pxj; Thu, 20 May 2021 22:53:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXQHqEjJxiyKN7fe2RRtWVyw8hjg1JXkSp6dNvvtWf+cQeCgexFN2VgCcSl0onc4a30BW3 X-Received: by 2002:a05:6402:749:: with SMTP id p9mr9361894edy.149.1621576415572; Thu, 20 May 2021 22:53:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621576415; cv=none; d=google.com; s=arc-20160816; b=i/kQsLtwUTLPJMYj2jLAaOV9lVnm2PzuKQMEPoRiAWpcei03C9M8g4iJwUy4gIRuXi rpysJlVi6AM0yuBZcEWv9+H5urfx6yQbcM8ElMDzayT+Xt/djojJFMX5IBB+M6BOLr8E 2Ix6yH3WjAzf8F39YSeGWWXKUDQT40j2FAJIzSx+sC22wes4e4hel3FvVFFRs4N2JVeo tmkD7sFtFa/8lzP90nnEzyytcKlRQfJdBFXs3U+1fB1O5cnQhGSVHPJ73C1EfQDtYVhz tZ16YrtrWIQyfll7lTmPO2AOR1YVUZIecsZwifSuKZKoyc5PRWbxvncHGIRlz7mwVzT6 Q/Cw== 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=3cCjGAR1fwsHjmVjT+mJq9iT2Slj8TG7dawqGnOR4Jg=; b=LmlkBnSlgx7rDOOdMm5UlB7G8DN21Fgm0hRY+Q8yeYt9HSDfLyQpmVx0wDLSpSETSd QMdq1NQPxqFt89/aNLrJ3uCWIcONnl2TSgmT9uCBpM4GObwOl+/MDpBiPrEmlD0ei4C2 v7xyFeii+SlBqlCiuj7f8oaTjZC66h0kmgtfnOT4b7OwQU3/kgOC7Wm2zd05qaei+ur0 MiOd2nJvxCO6whWHZlCwBQasTjT3jTp9jc0dAZq0DsBDHb+UUdtoCHutB+E62vBfLjI9 8jYwVPDjBPAJorQtWeX56hqKyqJ+8pY5Z+hcTTzdbQOhCs+EYTF720cRLusih1QpBK1A rb7A== 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 n10si4380007edv.436.2021.05.20.22.53.11; Thu, 20 May 2021 22:53:35 -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 S237921AbhETN6W (ORCPT + 99 others); Thu, 20 May 2021 09:58:22 -0400 Received: from mail-ej1-f44.google.com ([209.85.218.44]:37855 "EHLO mail-ej1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232178AbhETN6J (ORCPT ); Thu, 20 May 2021 09:58:09 -0400 Received: by mail-ej1-f44.google.com with SMTP id et19so18391830ejc.4; Thu, 20 May 2021 06:56:47 -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=3cCjGAR1fwsHjmVjT+mJq9iT2Slj8TG7dawqGnOR4Jg=; b=QcqnpNiJQVNSChWMYorJtidlN4+o15TpvmLpV6nkGXEmj7g18gKvtz6Qkgb938YXEk NN53X1JNIOsn1Mi8yw3BE1N25+LkCic3GECgG2k/p+jzQVRZL23r+HvJAoFW0YS7X4vX pQI79COzui6zym1juK2PW6k0jiRPLEAEwOvI7Cm5ygpSTg9cxZlttdZORREBkVu7w2TI FiPVUUvgSbiGEMHcsPjx7+Y6RsOoHna0jPqNCgHRNfFDcpW156KIN1+LQd2Fk9LYrfNB nMnPyjTP2L17jXKoIrd3p41BElrvhByqaY0oi4nIBkZZI5KLdaGgju/kMkNqQ/bqyQ+f FrVw== X-Gm-Message-State: AOAM530DmeNzry3stKBxnyIDZbRl0zUEdygi8NVgrAASEXZZRLXmiChj kDQUmRTvgS2N/3A1dOqsnuT860kYrmWgbFQn X-Received: by 2002:a17:907:a06d:: with SMTP id ia13mr4935283ejc.484.1621519006413; Thu, 20 May 2021 06:56:46 -0700 (PDT) Received: from msft-t490s.teknoraver.net (net-5-94-253-60.cust.vodafonedsl.it. [5.94.253.60]) by smtp.gmail.com with ESMTPSA id 9sm1434492ejv.73.2021.05.20.06.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 06:56:45 -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 , Matthew Wilcox , Christoph Hellwig , JeffleXu Subject: [PATCH v2 0/6] block: add a sequence number to disks Date: Thu, 20 May 2021 15:56:16 +0200 Message-Id: <20210520135622.44625-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 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