Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21275230ybl; Mon, 6 Jan 2020 01:11:05 -0800 (PST) X-Google-Smtp-Source: APXvYqz6FJiwadhAHfzJnzCr32VAeHcsI+zXKO5XXlCRH8NjeL4v+983P3ZpZK9+yaXU2CYV/U0b X-Received: by 2002:a9d:6045:: with SMTP id v5mr106857577otj.252.1578301865164; Mon, 06 Jan 2020 01:11:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578301865; cv=none; d=google.com; s=arc-20160816; b=t2qiunskGMFiGW2pexdtnEOg7Saziaah3EO4cI6VbmEW+a2vPvqXkWb/UwRZDNBCKW O31mQk5dAjxQBcMO0Uh+21GH1KZq5IPuyGhtun70aoYDxZC3wvMXv676GsLQsVcF42vc BkkUptISPjIsr8/sIGn7GTWuEpRHTMUA8rrK26k2jCX4eUWBC6tag+owpveNBYnX/oE0 BQH1mjB3n276aL9FSwq7uJv+oARrGeuIFUGNvz1GlMxVa2RFBr7bDvBiHMl5wpsxaa0p NhY85k8kzS0HCZAH4V7SznhtHU2SVjQbEIdhkV1KHBrWHNErMLaejDqAs2eu6Me2dTW4 sg3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=2XXWSUP1BjpVGTmZ+2CsgK5T/L+9UoxH989PAMTTewQ=; b=mrr6Ymkqc8veKHQq151h/sK5RifPHXNwBIXx5XtAl8W8ZBvYB4atDIHCOkrFytGFoa sjX5uiay3/v/utzdl1uQYVd7+DrDQTpzBzIzKdNIgfU3iHtsJCeAhzkLTebGVZbdYkcw NtBE8koEOA/jIMaSqS8n/dLgrjqapJqHctlBX9FU0QN93uen/IuxbZzw+C6IFrriDxki r5Su2aDeQmIAyIQvKbIhfwiN1qdRQf2v5JvKlAUP7YynBAWNL08o7UxnJrHjfJvEXS1S BFx4YhnL0gEtMaHpqk4r5eXQ4ft34GsI4jEr9Ww0Wwwa+03R3wjmww2XCWlV5NzXv8EQ 9OVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=i3FuJlen; 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=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8si24496261oia.262.2020.01.06.01.10.52; Mon, 06 Jan 2020 01:11:05 -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=@oracle.com header.s=corp-2019-08-05 header.b=i3FuJlen; 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=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726173AbgAFJKJ (ORCPT + 99 others); Mon, 6 Jan 2020 04:10:09 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:34796 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725821AbgAFJKJ (ORCPT ); Mon, 6 Jan 2020 04:10:09 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00699SJd164287; Mon, 6 Jan 2020 09:09:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=2XXWSUP1BjpVGTmZ+2CsgK5T/L+9UoxH989PAMTTewQ=; b=i3FuJlenU+Q3KZxLkfH8pZDQJf17bClyQVzh/zeQOdvRQumxQtgV9ik5VCe6ybpxq1uV TdeESViMJivYzap1LRiYqSnjEXTN1XR2PB9ZOeEFaweUpJSBe0D3RlTlwtPWl8yBZKET dao+7kQaRPtNIQKEZn5CNHXnunCYciDlDBdGhailorLhnvFkVErHYo8wF1Pyd95RHyUI xIxoe14WLIQhnXoT69Xf7muWdTzfxF38Vdzt89cFEcOFCicXx/fVHG5rUUaKtVCJm5Tj zkhKQsBFujxiorynothHr+xiNR7fjt7wmPa0eHxFjGLS+rJ17eBc/O+Qser9LmpbnagT Ag== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 2xakbqdvkw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 06 Jan 2020 09:09:54 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00699af6020933; Mon, 6 Jan 2020 09:09:53 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 2xb4unf3b0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 06 Jan 2020 09:09:53 +0000 Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0069978Y000590; Mon, 6 Jan 2020 09:09:07 GMT Received: from [192.168.1.14] (/114.88.246.185) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 06 Jan 2020 01:09:07 -0800 Subject: Re: [resend v1 0/5] Add support for block disk resize notification To: "Singh, Balbir" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-nvme@lists.infradead.org" Cc: "hch@lst.de" , "jejb@linux.ibm.com" , "Chaitanya.Kulkarni@wdc.com" , "mst@redhat.com" , "axboe@kernel.dk" , "Sangaraju, Someswarudu" References: <20200102075315.22652-1-sblbir@amazon.com> <62ef2cd2-42a2-6117-155d-ed052a136c5c@oracle.com> From: Bob Liu Message-ID: <77a665c6-1409-3dd0-2fde-221a00e04b3c@oracle.com> Date: Mon, 6 Jan 2020 17:08:49 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9491 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001060084 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9491 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001060084 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/6/20 4:47 PM, Singh, Balbir wrote: > On Mon, 2020-01-06 at 13:59 +0800, Bob Liu wrote: >> On 1/2/20 3:53 PM, Balbir Singh wrote: >>> Allow block/genhd to notify user space about disk size changes >>> using a new helper disk_set_capacity(), which is a wrapper on top >>> of set_capacity(). disk_set_capacity() will only notify if >>> the current capacity or the target capacity is not zero. >>> >> >> set_capacity_and_notify() may be a more straightforward name. >> > > Yes, agreed. > >>> 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. >>> >>> Testing: >>> 1. I did some basic testing with an NVME device, by resizing it in >>> the backend and ensured that udevd received the event. >>> >>> NOTE: After these changes, the notification might happen before >>> revalidate disk, where as it occured later before. >>> >> >> It's better not to change original behavior. >> How about something like: >> >> +void set_capacity_and_notify(struct gendisk *disk, sector_t size, bool >> revalidate) >> { >> sector_t capacity = get_capacity(disk); >> >> set_capacity(disk, size); >> >> + if (revalidate) >> + revalidate_disk(disk); > > Do you see a concern with the notification going out before revalidate_disk? Not aware any, but keep the original behavior is safer especial when not must change.. > I could keep the behaviour and come up with a suitable name > > revalidate_disk_and_notify() (set_capacity is a part of the revalidation > process), or feel free to suggest a better name > Feel free to add my reviewed-by next version in this series. Reviewed-by: Bob Liu > Thanks, > Balbir Singh >