From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by mail19.linbit.com (LINBIT Mail Daemon) with ESMTP id BD4E84205F3 for ; Tue, 16 Feb 2021 12:46:26 +0100 (CET) Date: Tue, 16 Feb 2021 12:46:24 +0100 From: Christoph Hellwig To: Mike Snitzer Message-ID: <20210216114624.GA1221@lst.de> References: <20201116145809.410558-1-hch@lst.de> <20201116145809.410558-13-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: Justin Sanders , "Michael S. Tsirkin" , Jason Wang , linux-nvme@lists.infradead.org, Song Liu , device-mapper development , Christoph Hellwig , drbd-dev@lists.linbit.com, "linux-scsi@vger.kernel.org" , xen-devel@lists.xenproject.org, Ilya Dryomov , Jack Wang , Konrad Rzeszutek Wilk , Josef Bacik , nbd@other.debian.org, "linux-raid@vger.kernel.org" , Hannes Reinecke , Stefan Hajnoczi , ceph-devel@vger.kernel.org, Jens Axboe , linux-block , "Martin K. Petersen" , Minchan Kim , linux-fsdevel , Paolo Bonzini , Roger Pau =?iso-8859-1?Q?Monn=E9?= Subject: Re: [Drbd-dev] [PATCH 12/78] dm: use set_capacity_and_notify List-Id: "*Coordination* of development, patches, contributions -- *Questions* \(even to developers\) go to drbd-user, please." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Fri, Feb 12, 2021 at 10:45:32AM -0500, Mike Snitzer wrote: > On Mon, Nov 16, 2020 at 10:05 AM Christoph Hellwig wrote: > > > > Use set_capacity_and_notify to set the size of both the disk and block > > device. This also gets the uevent notifications for the resize for free. > > > > Signed-off-by: Christoph Hellwig > > Reviewed-by: Hannes Reinecke > > --- > > drivers/md/dm.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/drivers/md/dm.c b/drivers/md/dm.c > > index c18fc25485186d..62ad44925e73ec 100644 > > --- a/drivers/md/dm.c > > +++ b/drivers/md/dm.c > > @@ -1971,8 +1971,7 @@ static struct dm_table *__bind(struct mapped_device *md, struct dm_table *t, > > if (size != dm_get_size(md)) > > memset(&md->geometry, 0, sizeof(md->geometry)); > > > > - set_capacity(md->disk, size); > > - bd_set_nr_sectors(md->bdev, size); > > + set_capacity_and_notify(md->disk, size); > > > > dm_table_event_callback(t, event_callback, md); > > > > Not yet pinned down _why_ DM is calling set_capacity_and_notify() with > a size of 0 but, when running various DM regression tests, I'm seeing > a lot of noise like: > > [ 689.240037] dm-2: detected capacity change from 2097152 to 0 > > Is this pr_info really useful? Should it be moved to below: if > (!capacity || !size) so that it only prints if a uevent is sent? In general I suspect such a size change might be interesting to users if it e.g. comes from a remote event. So I'd be curious why this happens with DM, and if we can detect some higher level gendisk state to supress it if it is indeed spurious.