Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3377063pxv; Mon, 12 Jul 2021 16:09:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRrZtE9MsOBLcnJfUqOZvxs42mQGfZ343Fkf/VzPyFRadt4DVsGQmUaRvM9sO5YO4hXym+ X-Received: by 2002:aa7:db95:: with SMTP id u21mr1571103edt.152.1626131355575; Mon, 12 Jul 2021 16:09:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626131355; cv=none; d=google.com; s=arc-20160816; b=OEWM6EgS8qAJO4gxkPIoHS6CzIUx1Igva6NpOnlYjqWGaAeQGdvfOjxNv+ZUaIW8Wf 28fC/rqLXFtOfy9wNzTsbZKkAKRjZYgWWq8m+nX5JpjwBryx54cy5X/ZQSWMWcEP3bQ3 7a2NgI5tU4OMRUpyg7DVgEOtcmU5JUiuqPtlE3ocoO0+sxSATkhM8DbWBRgVRKABSuI8 IYBIOUN4AmykJCA1Lg/dRO/P1F/5o/I0Wwan1j5U122R/5Y+gWOJTxblNwyq2+28qyw/ KYPu1d0Qy5qWwhLnHumLiAXV1OPvJSp5zbSD7LAazYxEggEwGslhvtKDrwzTuj/DQCzz X5IA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=DWKRBp3AChwDUw/Y1iiOPEb3yfZHMHAFp5fo3Bbvlxw=; b=NFp+LdbwfPJgMlPq6FcTz2uVDa0drvmJwy89/J3/nEYsMdLE0TXCa42i2hnbrtI7wj 4tcK1BN0WNDs0goaHsyhKjo8vkiPuoqRKYwTPlOYlqRaAVmGt2rPC7zgklXRoj/zXiKu KUQ8cnsAYQ4viP4oMFrj2UhCOckcEiAwU5//wqBv8trN8pvexwyr9gv1oepxKisq8xOs iZi/UBFLdvRXgoDUVUpZCV07FCmBdldzD9wPCFod2J3Tv5SGtXtgcBD8vBtGJQM7gCIz RNX0lbJ96O5sLvLMHKUIlRwttEanQb4Pe/9zS4d1gG5U1VIqpaE7/SzJ0ieHWMnEppHF tL+Q== 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 n1si17780695ejx.353.2021.07.12.16.08.52; Mon, 12 Jul 2021 16:09:15 -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 S232912AbhGLXKd (ORCPT + 99 others); Mon, 12 Jul 2021 19:10:33 -0400 Received: from mail-ed1-f44.google.com ([209.85.208.44]:39901 "EHLO mail-ed1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232724AbhGLXKc (ORCPT ); Mon, 12 Jul 2021 19:10:32 -0400 Received: by mail-ed1-f44.google.com with SMTP id v1so30439901edt.6; Mon, 12 Jul 2021 16:07:41 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=DWKRBp3AChwDUw/Y1iiOPEb3yfZHMHAFp5fo3Bbvlxw=; b=uiFLVBKVC6AuAiVljPf3WoK2Oe5OJ54g0h8o4kkbfPy76BfDjqxR2k/rUAO8HtDvLu tcqLhr54Tzo09y7uSQkdgO9Kt++0O/ut34Ts6YM228k8I1KobbPJmq9ASIph+WncrzJZ B9OCJ2/BbfC0NUznx5wuslZD9jTVqlr4TWPBFxYDNalT1B27p+B5mmE7+YXjfc8i99iD /IFn8pNxM4LbnHWtJC/D7fnkbD6Ne+iSNUr2zMyDgnznM5CNKyrbK6DBMKdWXNd1eUNr +d6Jb4xVwTBuLk1o0LCvhXno91KEFrMcrSq1hu6sLpnsCZ8P4lewJSVC4W1Y7MkvM4vL Fo2Q== X-Gm-Message-State: AOAM5326ivdwZ8najb67YZdclfupOU5eCLv9WFpjJ9HfnPSfJ5LXDpfF XFcmRqX0ZiUhvW4H57HppdqfzNILv3c3PQ== X-Received: by 2002:a05:6402:2044:: with SMTP id bc4mr1568620edb.307.1626131260968; Mon, 12 Jul 2021 16:07:40 -0700 (PDT) Received: from msft-t490s.fritz.box (host-95-250-115-52.retail.telecomitalia.it. [95.250.115.52]) by smtp.gmail.com with ESMTPSA id h3sm5494111ejf.53.2021.07.12.16.07.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 16:07:40 -0700 (PDT) From: Matteo Croce To: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Jens Axboe , Christoph Hellwig 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 , JeffleXu Subject: [PATCH v5 2/6] block: export the diskseq in uevents Date: Tue, 13 Jul 2021 01:05:26 +0200 Message-Id: <20210712230530.29323-3-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712230530.29323-1-mcroce@linux.microsoft.com> References: <20210712230530.29323-1-mcroce@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matteo Croce Export the newly introduced diskseq in uevents: $ udevadm info /sys/class/block/* |grep -e DEVNAME -e DISKSEQ E: DEVNAME=/dev/loop0 E: DISKSEQ=1 E: DEVNAME=/dev/loop1 E: DISKSEQ=2 E: DEVNAME=/dev/loop2 E: DISKSEQ=3 E: DEVNAME=/dev/loop3 E: DISKSEQ=4 E: DEVNAME=/dev/loop4 E: DISKSEQ=5 E: DEVNAME=/dev/loop5 E: DISKSEQ=6 E: DEVNAME=/dev/loop6 E: DISKSEQ=7 E: DEVNAME=/dev/loop7 E: DISKSEQ=8 E: DEVNAME=/dev/nvme0n1 E: DISKSEQ=9 E: DEVNAME=/dev/nvme0n1p1 E: DISKSEQ=9 E: DEVNAME=/dev/nvme0n1p2 E: DISKSEQ=9 E: DEVNAME=/dev/nvme0n1p3 E: DISKSEQ=9 E: DEVNAME=/dev/nvme0n1p4 E: DISKSEQ=9 E: DEVNAME=/dev/nvme0n1p5 E: DISKSEQ=9 E: DEVNAME=/dev/sda E: DISKSEQ=10 E: DEVNAME=/dev/sda1 E: DISKSEQ=10 E: DEVNAME=/dev/sda2 E: DISKSEQ=10 Reviewed-by: Christoph Hellwig Signed-off-by: Matteo Croce --- block/genhd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/block/genhd.c b/block/genhd.c index 0be32dbe97bb..3126f8afe3b8 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -1101,8 +1101,17 @@ static void disk_release(struct device *dev) blk_put_queue(disk->queue); kfree(disk); } + +static int block_uevent(struct device *dev, struct kobj_uevent_env *env) +{ + struct gendisk *disk = dev_to_disk(dev); + + return add_uevent_var(env, "DISKSEQ=%llu", disk->diskseq); +} + struct class block_class = { .name = "block", + .dev_uevent = block_uevent, }; static char *block_devnode(struct device *dev, umode_t *mode, -- 2.31.1