Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3641761pxf; Mon, 15 Mar 2021 14:44:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhtr85cfYA/7fSDJdGztOGwNDEt0In+0tZ+DM5FF/1w4cOaC6J6OMMv4ESGnLeWM+yUOG7 X-Received: by 2002:a05:6402:26ce:: with SMTP id x14mr31891866edd.359.1615844652530; Mon, 15 Mar 2021 14:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615844652; cv=none; d=google.com; s=arc-20160816; b=RpHVfryQPCEHCGqIX1SXsTNXQdXodR40MPAYtq1myCd8hYWQilh1L/z7YCGRlUiZ9A akVn7pgb52khtu/D7o6jAdKFn79QL/Suv6adgvAbg5LAurQeUVdaFyM213dKB5ERu6GK jRfAiV9FL48X9+6SDmG8swqC5dHS1EYtBBJs//pMUNdM/H4BWJ0K8QasBx2MnFOpxxPP i+GWgTICwmqpDwEbqxA9axaQb3z2E4mizLvazZPISi8dYdbQmWKuO5P9AREdYDNSIU3c mBdNLdfX5f/V9Oo8LToFtHq1EsfLESCEwbrJs2kCmOqj33yxUzXz58Rzw2rMwLI2WbzI UORg== 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=PkEBTQQrAWt7QcNipJG5buCi2jRQQ6g6Fca4O51wY5Q=; b=s2ZlgBlPIc7HkXEwSH+nN/1/vFIVy8RWvieTS45k0o99ePmjDythKHmTgUK6rf6GA8 +weYWN66J3iWySQvVEyF1KLXBcwCZVlP+XVepXEGrjXQNmPO169bLuJJpo+y5UYrl/3w GCq0bUqWKhOUhrpRPgdCwvgk3lJJtSHCh9eku7Jmus1qk8lZy0OdeMjSbCzIgKm5dM13 Q1+XGGU5ob+XWhpAwDw3GNaR/lRgzmSQQ5tihqsiIkq0mCYRKErTvwTZ3B85udp1IhG2 d83e4dRrZmnQC2P+sp49Fq9PSkbDuZww9HwmlshsI6wWKJ8+Z4u2V19XF8cyNY8/IxiG mIUQ== 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 s17si12248888edx.88.2021.03.15.14.43.50; Mon, 15 Mar 2021 14:44: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 S234008AbhCOUDm (ORCPT + 99 others); Mon, 15 Mar 2021 16:03:42 -0400 Received: from mail-ed1-f43.google.com ([209.85.208.43]:39838 "EHLO mail-ed1-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233950AbhCOUDW (ORCPT ); Mon, 15 Mar 2021 16:03:22 -0400 Received: by mail-ed1-f43.google.com with SMTP id bf3so18797394edb.6; Mon, 15 Mar 2021 13:03:21 -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=PkEBTQQrAWt7QcNipJG5buCi2jRQQ6g6Fca4O51wY5Q=; b=fG3Vy5Siod/fTIZnl1KkrxS7Y/WkH2sixbBJprMjoT7CRCZNGq49awjcPx/i/x48KZ +4IwUGYM797ClgX0sB2ypracyR79R9w8vRf4P/7PVoInYlplTf4wemNtSr9ohBew33KW sPJrSNyfj/zS66rkT39V9PvraBHDlns8ZVtF8cGOPnvvthcMh5bj7sJ9XNqaUnEJZmTD BvUfZ0icTBE5Nvhb2wXYzVRqk3q5wpSBJMD/oOMeRarFKOUEyODfGDo29g+nU/yXk0hw 05njmdnNfZK6w5mucmOyuere3xBxxGunNOucS02t/mOyX0FglQCkRafBdDb/n2SHbd+R YnHg== X-Gm-Message-State: AOAM532/oWlnmmcokHx3D/cOOjgXI0Ep9WlxbXxBlNrnV3iXPGb7vXas qhQp3MPAjPISArAVYO6SMe3wbNPKS1uVjA== X-Received: by 2002:a05:6402:12cf:: with SMTP id k15mr31093245edx.192.1615838601126; Mon, 15 Mar 2021 13:03:21 -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.03.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 13:03:20 -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 2/5] block: add ioctl to read the disk sequence number Date: Mon, 15 Mar 2021 21:02:39 +0100 Message-Id: <20210315200242.67355-3-mcroce@linux.microsoft.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315200242.67355-1-mcroce@linux.microsoft.com> References: <20210315200242.67355-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 Add a new BLKGETDISKSEQ ioctl which retrieves the disk sequence number from the genhd structure. Signed-off-by: Matteo Croce --- block/ioctl.c | 2 ++ include/uapi/linux/fs.h | 1 + 2 files changed, 3 insertions(+) diff --git a/block/ioctl.c b/block/ioctl.c index ff241e663c01..266315d00942 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -467,6 +467,8 @@ static int blkdev_common_ioctl(struct block_device *bdev, fmode_t mode, BLKDEV_DISCARD_SECURE); case BLKZEROOUT: return blk_ioctl_zeroout(bdev, mode, arg); + case BLKGETDISKSEQ: + return put_u64(argp, bdev->bd_disk->diskseq); case BLKREPORTZONE: return blkdev_report_zones_ioctl(bdev, mode, cmd, arg); case BLKRESETZONE: diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index f44eb0a04afd..5dc72bbdd9b7 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -184,6 +184,7 @@ struct fsxattr { #define BLKSECDISCARD _IO(0x12,125) #define BLKROTATIONAL _IO(0x12,126) #define BLKZEROOUT _IO(0x12,127) +#define BLKGETDISKSEQ _IOR(0x12,128,__u64) /* * A jump here: 130-131 are reserved for zoned block devices * (see uapi/linux/blkzoned.h) -- 2.30.2