Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4043414ybv; Tue, 25 Feb 2020 12:02:50 -0800 (PST) X-Google-Smtp-Source: APXvYqzS2eMSB01xWdqeX1GSfRl2077s2C736xnmt8omaKjrKvZsECKwP9SFIcoGcw1yxMSkRmaJ X-Received: by 2002:aca:4d06:: with SMTP id a6mr468733oib.27.1582660969996; Tue, 25 Feb 2020 12:02:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582660969; cv=none; d=google.com; s=arc-20160816; b=gH4kNJH//zbNAO1ylYpm564jLy6JdcMS5KxMdsVO+G4KxPnsA2Syb+o60I0clwScJj gFkQi0xzifRyxFF6InNjcn14W+JO3cGlQjSDu3yek01mxIxSD27KtFKulmsROMzKXEIT 2moa6C1OJaa58+w7cZhghvy2NigVSnfCCFNjaAishZCKH3lILRh6ZAvW1BhqC0YTfIgy 4KB6ZufQIBIvgZHBr8lyyPYKyaPNhEwvr9FltdVymR8NvfDZx+qWHvW3PhjKdpV4FqpD M2oEPH+1ADgh4XbSulF29DxW3u8JcKSrq6J/H4bXSzZ2kRrNiVS2rXSfo+pqkiatglN7 9xoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:ironport-sdr:dkim-signature; bh=MiZmJA9pUK0ijDarkYLGiDBqwKVr4yTOHuXUxcsXrBg=; b=ok+HMxtbGwWSjdo9adHEg08g/Bv2KHwu+73iBFmrKDo8fS1G2kHtTQRSV9jLAkOvxT mGhwEmUoYdhL/d2aNHOKoxL2qbqPWe/Neo8GoJrgvcUscCoYa6NeTW2CgAfbFPTc6MNJ LewQ9l+l97gztl0rNFDMRTGPbWMLrg6EfNRSEbP64s/ZLPggzioQneMIwzDrMalu1wV8 D2RHifaPCzZPK8QGb1mr3YuLs3dpnDu7JP9ouE7OSyGxEStQMOzyDoca/k7rtMeAheLc VuppA9EcDfHm9v8lS9miaRjupxNj7NUkVv2iudkR0dZAEfiJL9RMHBlWvcO2y62VIZBf v1mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=JiJBQZ+O; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w7si145697otq.250.2020.02.25.12.02.36; Tue, 25 Feb 2020 12:02:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=JiJBQZ+O; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731581AbgBYUCB (ORCPT + 99 others); Tue, 25 Feb 2020 15:02:01 -0500 Received: from smtp-fw-4101.amazon.com ([72.21.198.25]:17726 "EHLO smtp-fw-4101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731480AbgBYUB6 (ORCPT ); Tue, 25 Feb 2020 15:01:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1582660917; x=1614196917; h=from:to:cc:subject:date:message-id:mime-version; bh=MiZmJA9pUK0ijDarkYLGiDBqwKVr4yTOHuXUxcsXrBg=; b=JiJBQZ+O4SCPC85IVQKfZXX2kORvujEpbDbYEo/QBSvdXqxRmHvvsxIi 0dzKgDIzE2pvwUniwLAUyEgwq2Xa9qEvADy+Z9wLSGtj7TQw+mBCCjxyo Wj3/F+RvwOfku66tHBw4JlJX3ODadUbxUFabUJgQu3TXskTJRXZnhm1xI 4=; IronPort-SDR: sN/t/WJn64u0lZCt/DO/e1weHM2PLgt2TP5iya85xnAuukMZpJzpojl5JPgQLB/IleWexU2A2q KP+DmoyZ55sA== X-IronPort-AV: E=Sophos;i="5.70,485,1574121600"; d="scan'208";a="18550457" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1a-821c648d.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP; 25 Feb 2020 20:01:45 +0000 Received: from EX13MTAUWA001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1a-821c648d.us-east-1.amazon.com (Postfix) with ESMTPS id DB45EA18EF; Tue, 25 Feb 2020 20:01:42 +0000 (UTC) Received: from EX13D01UWA002.ant.amazon.com (10.43.160.74) by EX13MTAUWA001.ant.amazon.com (10.43.160.58) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 25 Feb 2020 20:01:41 +0000 Received: from EX13MTAUWC001.ant.amazon.com (10.43.162.135) by EX13d01UWA002.ant.amazon.com (10.43.160.74) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 25 Feb 2020 20:01:41 +0000 Received: from localhost (10.2.75.237) by mail-relay.amazon.com (10.43.162.232) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Tue, 25 Feb 2020 20:01:41 +0000 From: Balbir Singh To: , , CC: , , , , , Balbir Singh Subject: [PATCH v2 0/5] Add support for block disk resize notification Date: Tue, 25 Feb 2020 20:01:24 +0000 Message-ID: <20200225200129.6687-1-sblbir@amazon.com> X-Mailer: git-send-email 2.16.6 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow block/genhd to notify user space about disk size changes using a new helper set_capacity_revalidate_and_notify(), which is a wrapper on top of set_capacity(). set_capacity_revalidate_and_notify() will only notify iff the current capacity or the target capacity is not zero and the capacity really changes. Background: As a part of a patch to allow sending the RESIZE event on disk capacity change, Christoph (hch@lst.de) requested that the patch be made generic and the hacks for virtio block and xen block devices be removed and merged via a generic helper. This series consists of 5 changes. The first one adds the basic support for changing the size and notifying. The follow up patches are per block subsystem changes. Other block drivers can add their changes as necessary on top of this series. Since not all devices are resizable, the default was to add a new API and let users slowly convert over as needed. Testing: 1. I did some basic testing with an NVME device, by resizing it in the backend and ensured that udevd received the event. Changelog v2: - Rename disk_set_capacity to set_capacity_revalidate_and_notify - set_capacity_revalidate_and_notify can call revalidate disk if needed, a new bool parameter is passed (suggested by Bob Liu) Balbir Singh (5): block/genhd: Notify udev about capacity change drivers/block/virtio_blk.c: Convert to use set_capacity_revalidate_and_notify drivers/block/xen-blkfront.c: Convert to use set_capacity_revalidate_and_notify drivers/nvme/host/core.c: Convert to use set_capacity_revalidate_and_notify drivers/scsi/sd.c: Convert to use set_capacity_revalidate_and_notify block/genhd.c | 24 ++++++++++++++++++++++++ drivers/block/virtio_blk.c | 5 +---- drivers/block/xen-blkfront.c | 6 +----- drivers/nvme/host/core.c | 2 +- drivers/scsi/sd.c | 3 ++- include/linux/genhd.h | 2 ++ 6 files changed, 31 insertions(+), 11 deletions(-) -- 2.16.6