From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A377AC10DCE for ; Fri, 13 Mar 2020 05:30:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7A5C920737 for ; Fri, 13 Mar 2020 05:30:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="QiGYZ6WD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726514AbgCMFam (ORCPT ); Fri, 13 Mar 2020 01:30:42 -0400 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]:46768 "EHLO smtp-fw-2101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725535AbgCMFal (ORCPT ); Fri, 13 Mar 2020 01:30:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1584077441; x=1615613441; h=from:to:cc:subject:date:message-id:mime-version; bh=REy7LBkdQ5MCy84KosSuZWNgbDSwbuHXvkOMZFApZ0g=; b=QiGYZ6WDYUTQ3B/GACRkWiFFU4Bh/Qo7Gn32oKWVlJ1m6qoVZtXvCNkj afyyF0Gv+UGa7KoJl3KUNaZNDBm0kZSWdeThlWIQ4La+Tl6SNZJl+b3tq ReTs89h65xAWhcGaFu+uGoNWHGDojYKrs0k10xCK2LmBAZLXX9Al3u0xG 4=; IronPort-SDR: BBxpNHEOWW1ENqqjyI1ueSy8wEtQCRVJhTMUDArhWjlmVcbDR3lUllZ4prigMjSQ6ncpcVpQDH I5KYk9VOYoPg== X-IronPort-AV: E=Sophos;i="5.70,547,1574121600"; d="scan'208";a="21324131" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1a-16acd5e0.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP; 13 Mar 2020 05:30:20 +0000 Received: from EX13MTAUWA001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1a-16acd5e0.us-east-1.amazon.com (Postfix) with ESMTPS id 8CE8CA2E2C; Fri, 13 Mar 2020 05:30:18 +0000 (UTC) Received: from EX13D01UWA002.ant.amazon.com (10.43.160.74) by EX13MTAUWA001.ant.amazon.com (10.43.160.118) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 13 Mar 2020 05:30:18 +0000 Received: from EX13MTAUWA001.ant.amazon.com (10.43.160.58) by EX13d01UWA002.ant.amazon.com (10.43.160.74) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 13 Mar 2020 05:30:17 +0000 Received: from localhost (10.2.75.237) by mail-relay.amazon.com (10.43.160.118) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Fri, 13 Mar 2020 05:30:18 +0000 From: Balbir Singh To: , , CC: , , , "Balbir Singh" Subject: [PATCH v3 0/5] Add support for block disk resize notification Date: Fri, 13 Mar 2020 05:30:04 +0000 Message-ID: <20200313053009.19866-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 v3: - Repost after rebasing - Trim details of the subsystem/files in the subject 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 virtio_blk.c: Convert to use set_capacity_revalidate_and_notify xen-blkfront.c: Convert to use set_capacity_revalidate_and_notify nvme: Convert to use set_capacity_revalidate_and_notify scsi: 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