Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1324452ybh; Thu, 12 Mar 2020 22:31:18 -0700 (PDT) X-Google-Smtp-Source: ADFU+vunVUV6Dy3T7Ahnw4LkrkN/aBXvUc8c6DG9u8gsa9BBpdLTXW1fdMymZB5zcjIlq+J3fmjE X-Received: by 2002:a9d:7857:: with SMTP id c23mr3471842otm.288.1584077478129; Thu, 12 Mar 2020 22:31:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584077478; cv=none; d=google.com; s=arc-20160816; b=ZAX1JTT3Mc5MkkA23o1BqgtzB5VQwcYqo+Hqh0xJOTVj2z+XetyF52ez/U441nuYpH rmwNQaZi6qgoE85eTonTU1JMQO82K63BKnVtPueHxPp+z6f+6VmGlDZQrOalcLOL5f7r tuoLUY7dkkSUCJKiW95fU/GP0xkbbrsHn1Mm5XrDpps9LkZnoO8VPxsT3Or6srVCiSdy qwmt3ZXGSYZ8WoabFSc8br5f9XfGlKAzevmLjOqzfni+lIVhbzFa4EX5XUTZ90/tO1wA Rfb84mOWo7YyplyVoJI37llqnPTVAkJkFWNx1AeCqUBbzx8Vohb0cORQOWkWyW/XRGzn 2oRg== 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=REy7LBkdQ5MCy84KosSuZWNgbDSwbuHXvkOMZFApZ0g=; b=ukt6dE7cq+U0n0ZUSE6ILokKsvHNaIIIDYwpm8GB1x61AvbtGNJvAxIIGcA6HImm/s rSAvVnGMAv8tuJPoXljDTc60riMA1/+app2hndKgw3c9icRtYyxoM6KGJsNwmN7XWFY6 uJcJA5KxZtSt6vNd6+QTL9MLzc/qegBD22LYvnUa1Ygx/r3n16g7jlP7OrlArxL6Kim7 058Lr5jvP8Gpbn+at5BUJv1NOVTDI+QslJntCHIDHinf5usLBhgWuNDDb/HMt8hQNp8r RF5tsHv3cAIwtFUB09BIBYMkjilxwUo/TTq2Q1B5gGGZMQqoF240I/83CJ5NOuqQJwkQ a7Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=QiGYZ6WD; 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 l9si4047002oie.230.2020.03.12.22.31.06; Thu, 12 Mar 2020 22:31:18 -0700 (PDT) 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=QiGYZ6WD; 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 S1726508AbgCMFal (ORCPT + 99 others); Fri, 13 Mar 2020 01:30:41 -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