From patchwork Wed Jul 8 12:25:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11651565 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 406466C1 for ; Wed, 8 Jul 2020 12:45:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2734420786 for ; Wed, 8 Jul 2020 12:45:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="YgPbqUBM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729230AbgGHMpZ (ORCPT ); Wed, 8 Jul 2020 08:45:25 -0400 Received: from casper.infradead.org ([90.155.50.34]:34136 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729087AbgGHMpZ (ORCPT ); Wed, 8 Jul 2020 08:45:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=ZXLwtXCaekMdRRvox5c6zlut8/iXO7Z0Y30xZewS4fE=; b=YgPbqUBMtF/cAfdylt5dwWUpDq MkqxxuE4lYsPtaKRbuKTUQNmsY07qp57mapw+GiFtslmQNXoeFtL9Icl+S9PoNEIItZTQebYYK49C uS5HWpbsrGuuhsgAj0WLGCOkJEh7juedqIc0xbKRS9FuMvOnjJOklPP6s0MAU1ejN1j1yjKO/KtEl h6bAthB5uIQOej0XPPEZ/8FyXPCOIjibhSAkEa8MGpVgwiCHgZ5ajtLVIi/SH8PBxp0MN++Z+kscc pmRqidAvIKX2EXfWy76D2A2YTCKb9XYNRO/V9g9m+JGyu0NcgIsVXF5EtgKPHRnLw3IOq7OPYGupf us7EAcgQ==; Received: from 213-225-32-40.nat.highway.a1.net ([213.225.32.40] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jt9DI-0001wu-FA; Wed, 08 Jul 2020 12:30:12 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Song Liu , Ulf Hansson , linux-kernel@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-block@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 1/6] md: switch to ->check_events for media change notifications Date: Wed, 8 Jul 2020 14:25:41 +0200 Message-Id: <20200708122546.214579-2-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708122546.214579-1-hch@lst.de> References: <20200708122546.214579-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org md is the last driver using the legacy media_changed method. Switch it over to (not so) new ->clear_events approach, which also removes the need for the ->revalidate_disk method. Signed-off-by: Christoph Hellwig --- Documentation/filesystems/locking.rst | 4 +--- block/genhd.c | 7 +------ drivers/md/md.c | 19 ++++++++----------- include/linux/blkdev.h | 2 -- 4 files changed, 10 insertions(+), 22 deletions(-) diff --git a/Documentation/filesystems/locking.rst b/Documentation/filesystems/locking.rst index 318605de83f33c..17bea12538c32d 100644 --- a/Documentation/filesystems/locking.rst +++ b/Documentation/filesystems/locking.rst @@ -467,7 +467,6 @@ prototypes:: int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); int (*direct_access) (struct block_device *, sector_t, void **, unsigned long *); - int (*media_changed) (struct gendisk *); void (*unlock_native_capacity) (struct gendisk *); int (*revalidate_disk) (struct gendisk *); int (*getgeo)(struct block_device *, struct hd_geometry *); @@ -483,14 +482,13 @@ release: yes ioctl: no compat_ioctl: no direct_access: no -media_changed: no unlock_native_capacity: no revalidate_disk: no getgeo: no swap_slot_free_notify: no (see below) ======================= =================== -media_changed, unlock_native_capacity and revalidate_disk are called only from +unlock_native_capacity and revalidate_disk are called only from check_disk_change(). swap_slot_free_notify is called with swap_lock and sometimes the page lock diff --git a/block/genhd.c b/block/genhd.c index 60ae4e1b4d3877..1070da9d4d9a77 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -2061,13 +2061,8 @@ unsigned int disk_clear_events(struct gendisk *disk, unsigned int mask) unsigned int pending; unsigned int clearing = mask; - if (!ev) { - /* for drivers still using the old ->media_changed method */ - if ((mask & DISK_EVENT_MEDIA_CHANGE) && - bdops->media_changed && bdops->media_changed(disk)) - return DISK_EVENT_MEDIA_CHANGE; + if (!ev) return 0; - } disk_block_events(disk); diff --git a/drivers/md/md.c b/drivers/md/md.c index 8bb69c61afe086..77dfe4765c3111 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -5670,6 +5670,7 @@ static int md_alloc(dev_t dev, char *name) * remove it now. */ disk->flags |= GENHD_FL_EXT_DEVT; + disk->events |= DISK_EVENT_MEDIA_CHANGE; mddev->gendisk = disk; /* As soon as we call add_disk(), another thread could get * through to md_open, so make sure it doesn't get too far @@ -7806,20 +7807,17 @@ static void md_release(struct gendisk *disk, fmode_t mode) mddev_put(mddev); } -static int md_media_changed(struct gendisk *disk) -{ - struct mddev *mddev = disk->private_data; - - return mddev->changed; -} - -static int md_revalidate(struct gendisk *disk) +static unsigned int md_check_events(struct gendisk *disk, unsigned int clearing) { struct mddev *mddev = disk->private_data; + unsigned int ret = 0; + if (mddev->changed) + ret = DISK_EVENT_MEDIA_CHANGE; mddev->changed = 0; - return 0; + return ret; } + static const struct block_device_operations md_fops = { .owner = THIS_MODULE, @@ -7831,8 +7829,7 @@ static const struct block_device_operations md_fops = .compat_ioctl = md_compat_ioctl, #endif .getgeo = md_getgeo, - .media_changed = md_media_changed, - .revalidate_disk= md_revalidate, + .check_events = md_check_events, }; static int md_thread(void *arg) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 408eb66a82fdc7..71173a1ffa8b87 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1781,8 +1781,6 @@ struct block_device_operations { int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); unsigned int (*check_events) (struct gendisk *disk, unsigned int clearing); - /* ->media_changed() is DEPRECATED, use ->check_events() instead */ - int (*media_changed) (struct gendisk *); void (*unlock_native_capacity) (struct gendisk *); int (*revalidate_disk) (struct gendisk *); int (*getgeo)(struct block_device *, struct hd_geometry *); From patchwork Wed Jul 8 12:25:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11651533 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A989A60D for ; Wed, 8 Jul 2020 12:35:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 90A0F207DF for ; Wed, 8 Jul 2020 12:35:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="O+ZGOc9R" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729174AbgGHMfI (ORCPT ); Wed, 8 Jul 2020 08:35:08 -0400 Received: from casper.infradead.org ([90.155.50.34]:33804 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728965AbgGHMfI (ORCPT ); Wed, 8 Jul 2020 08:35:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description; bh=JOdrvVBNvN427RftYiUMCKmaeWd1nQ0Dut+NXex+TSk=; b=O+ZGOc9RoTX2V/qcTsSPAokNRh d2pWbJc2ihWp7bGGU05Nr+Xvu3yG+tye8lm/g56o9IMBubnqURZyfdE1L3Ea1FNJjIEPLVdLYW9Iu tg6EZ8uN8RhremEP2JAqLUtt/CIg2EvVpFwGGtSeFvrRwl/H9zKhYo240mC+5jfIf5zDqCwYqvRcw M568Lm71gNygDTnqrTXHndVlI9TR5tfs3pgifNl0Ozoc/IjItelwK9iTlHPwNkyO8Tskux2MsTng2 d2dPoJQjzI/+P1DMdj140U6havH7n52zmK1onESgZre2EkP6t69hytcEzoL9Z/fdRKyQjjcAGB5Wq zxialUiA==; Received: from 213-225-32-40.nat.highway.a1.net ([213.225.32.40] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jt9FP-00021j-HP; Wed, 08 Jul 2020 12:32:26 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Song Liu , Ulf Hansson , linux-kernel@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-block@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 2/6] cdrom: remove the unused cdrom_media_changed function Date: Wed, 8 Jul 2020 14:25:42 +0200 Message-Id: <20200708122546.214579-3-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708122546.214579-1-hch@lst.de> References: <20200708122546.214579-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org As well as the ->media_changed method. All these are left over from before the drivers were switched over to the check_events scheme. Signed-off-by: Christoph Hellwig --- Documentation/cdrom/cdrom-standard.rst | 18 +---------------- drivers/cdrom/cdrom.c | 28 +++++--------------------- include/linux/cdrom.h | 2 -- 3 files changed, 6 insertions(+), 42 deletions(-) diff --git a/Documentation/cdrom/cdrom-standard.rst b/Documentation/cdrom/cdrom-standard.rst index dde4f7f7fdbf1c..2de90581059033 100644 --- a/Documentation/cdrom/cdrom-standard.rst +++ b/Documentation/cdrom/cdrom-standard.rst @@ -157,7 +157,6 @@ with the kernel as a block device by registering the following general cdrom_release, /∗ release ∗/ NULL, /∗ fsync ∗/ NULL, /∗ fasync ∗/ - cdrom_media_changed, /∗ media change ∗/ NULL /∗ revalidate ∗/ }; @@ -366,19 +365,6 @@ which may or may not be in the drive). If the drive is not a changer, CDS_DRIVE_NOT_READY /* something is wrong, tray is moving? */ CDS_DISC_OK /* a disc is loaded and everything is fine */ -:: - - int media_changed(struct cdrom_device_info *cdi, int disc_nr) - -This function is very similar to the original function in $struct -file_operations*. It returns 1 if the medium of the device *cdi->dev* -has changed since the last call, and 0 otherwise. The parameter -*disc_nr* identifies a specific slot in a juke-box, it should be -ignored for single-disc drives. Note that by `re-routing` this -function through *cdrom_media_changed()*, we can implement separate -queues for the VFS and a new *ioctl()* function that can report device -changes to software (e. g., an auto-mounting daemon). - :: int tray_move(struct cdrom_device_info *cdi, int position) @@ -917,9 +903,7 @@ commands can be identified by the underscores in their names. maximum number of discs in the juke-box found in the *cdrom_dops*. `CDROM_MEDIA_CHANGED` Returns 1 if a disc has been changed since the last call. - Note that calls to *cdrom_media_changed* by the VFS are treated - by an independent queue, so both mechanisms will detect a - media change once. For juke-boxes, an extra argument *arg* + For juke-boxes, an extra argument *arg* specifies the slot for which the information is given. The special value *CDSL_CURRENT* requests that information about the currently selected slot be returned. diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index d82b3b7658bddc..0c271b9e3c5b79 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c @@ -605,7 +605,7 @@ int register_cdrom(struct gendisk *disk, struct cdrom_device_info *cdi) disk->cdi = cdi; ENSURE(cdo, drive_status, CDC_DRIVE_STATUS); - if (cdo->check_events == NULL && cdo->media_changed == NULL) + if (cdo->check_events == NULL) WARN_ON_ONCE(cdo->capability & (CDC_MEDIA_CHANGED | CDC_SELECT_DISC)); ENSURE(cdo, tray_move, CDC_CLOSE_TRAY | CDC_OPEN_TRAY); ENSURE(cdo, lock_door, CDC_LOCK); @@ -1419,8 +1419,6 @@ static int cdrom_select_disc(struct cdrom_device_info *cdi, int slot) if (cdi->ops->check_events) cdi->ops->check_events(cdi, 0, slot); - else - cdi->ops->media_changed(cdi, slot); if (slot == CDSL_NONE) { /* set media changed bits, on both queues */ @@ -1517,13 +1515,10 @@ int media_changed(struct cdrom_device_info *cdi, int queue) return ret; /* changed since last call? */ - if (cdi->ops->check_events) { - BUG_ON(!queue); /* shouldn't be called from VFS path */ - cdrom_update_events(cdi, DISK_EVENT_MEDIA_CHANGE); - changed = cdi->ioctl_events & DISK_EVENT_MEDIA_CHANGE; - cdi->ioctl_events = 0; - } else - changed = cdi->ops->media_changed(cdi, CDSL_CURRENT); + BUG_ON(!queue); /* shouldn't be called from VFS path */ + cdrom_update_events(cdi, DISK_EVENT_MEDIA_CHANGE); + changed = cdi->ioctl_events & DISK_EVENT_MEDIA_CHANGE; + cdi->ioctl_events = 0; if (changed) { cdi->mc_flags = 0x3; /* set bit on both queues */ @@ -1535,18 +1530,6 @@ int media_changed(struct cdrom_device_info *cdi, int queue) return ret; } -int cdrom_media_changed(struct cdrom_device_info *cdi) -{ - /* This talks to the VFS, which doesn't like errors - just 1 or 0. - * Returning "0" is always safe (media hasn't been changed). Do that - * if the low-level cdrom driver dosn't support media changed. */ - if (cdi == NULL || cdi->ops->media_changed == NULL) - return 0; - if (!CDROM_CAN(CDC_MEDIA_CHANGED)) - return 0; - return media_changed(cdi, 0); -} - /* Requests to the low-level drivers will /always/ be done in the following format convention: @@ -3464,7 +3447,6 @@ EXPORT_SYMBOL(unregister_cdrom); EXPORT_SYMBOL(cdrom_open); EXPORT_SYMBOL(cdrom_release); EXPORT_SYMBOL(cdrom_ioctl); -EXPORT_SYMBOL(cdrom_media_changed); EXPORT_SYMBOL(cdrom_number_of_slots); EXPORT_SYMBOL(cdrom_mode_select); EXPORT_SYMBOL(cdrom_mode_sense); diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h index 8543fa59da7207..f48d0a31deaece 100644 --- a/include/linux/cdrom.h +++ b/include/linux/cdrom.h @@ -73,7 +73,6 @@ struct cdrom_device_ops { int (*drive_status) (struct cdrom_device_info *, int); unsigned int (*check_events) (struct cdrom_device_info *cdi, unsigned int clearing, int slot); - int (*media_changed) (struct cdrom_device_info *, int); int (*tray_move) (struct cdrom_device_info *, int); int (*lock_door) (struct cdrom_device_info *, int); int (*select_speed) (struct cdrom_device_info *, int); @@ -107,7 +106,6 @@ extern int cdrom_ioctl(struct cdrom_device_info *cdi, struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg); extern unsigned int cdrom_check_events(struct cdrom_device_info *cdi, unsigned int clearing); -extern int cdrom_media_changed(struct cdrom_device_info *); extern int register_cdrom(struct gendisk *disk, struct cdrom_device_info *cdi); extern void unregister_cdrom(struct cdrom_device_info *cdi); From patchwork Wed Jul 8 12:25:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11651523 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE71913B6 for ; Wed, 8 Jul 2020 12:34:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D5973207DF for ; Wed, 8 Jul 2020 12:34:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="OBEWlLAZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729006AbgGHMeu (ORCPT ); Wed, 8 Jul 2020 08:34:50 -0400 Received: from casper.infradead.org ([90.155.50.34]:33786 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728640AbgGHMet (ORCPT ); Wed, 8 Jul 2020 08:34:49 -0400 X-Greylist: delayed 388 seconds by postgrey-1.27 at vger.kernel.org; Wed, 08 Jul 2020 08:34:49 EDT DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=ZkV04PitK4z6d5CfWwL1ZjMYfYxppkuHiqkKWa0poRE=; b=OBEWlLAZdyoVGQ3F5UVsXk5uZw nMNE39D2XcSvos21kke5WovZt265gieLA72C1jKxq5BIqd2Lf6QNblmhffb4xcJr5B3BSpJPvOCfG z+At9jPRFrEOo7BAZ1UsaVAFQcP6Ln2qq3AXuoZLzjrhojdNKyheHXZTJEfcCS2pB53LQ6lNIwcam SQWOu7CXvq/VhMXVydmZ+d07/e7V/p13CKVbJ5NHC9hxPQJ1UEuAO6OZcAx6qlPuwHHaYPfLfSYoj u3t/+IEwSH375ANyPPVIDYjQAzvdC8z5Pez4lqVopg4f4MMTx3zYCtY6ntJ5mIqKrZAJmiSDOGbrY e57MQyAA==; Received: from 213-225-32-40.nat.highway.a1.net ([213.225.32.40] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jt9Ha-000280-NX; Wed, 08 Jul 2020 12:34:42 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Song Liu , Ulf Hansson , linux-kernel@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-block@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 3/6] block: remove flush_disk Date: Wed, 8 Jul 2020 14:25:43 +0200 Message-Id: <20200708122546.214579-4-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708122546.214579-1-hch@lst.de> References: <20200708122546.214579-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org flush_disk has only two callers, so open code it there. That also helps clarifying the error message for the particular case, and allows to remove setting bd_invalidated in check_disk_size_change, which will be cleared again instantly. Signed-off-by: Christoph Hellwig --- fs/block_dev.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 2d2fcb50e78eac..a36d5b6907ea4e 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1347,26 +1347,6 @@ void bd_unlink_disk_holder(struct block_device *bdev, struct gendisk *disk) EXPORT_SYMBOL_GPL(bd_unlink_disk_holder); #endif -/** - * flush_disk - invalidates all buffer-cache entries on a disk - * - * @bdev: struct block device to be flushed - * @kill_dirty: flag to guide handling of dirty inodes - * - * Invalidates all buffer-cache entries on a disk. It should be called - * when a disk has been changed -- either by a media change or online - * resize. - */ -static void flush_disk(struct block_device *bdev, bool kill_dirty) -{ - if (__invalidate_device(bdev, kill_dirty)) { - printk(KERN_WARNING "VFS: busy inodes on changed media or " - "resized disk %s\n", - bdev->bd_disk ? bdev->bd_disk->disk_name : ""); - } - bdev->bd_invalidated = 1; -} - /** * check_disk_size_change - checks for disk size change and adjusts bdev size. * @disk: struct gendisk to check @@ -1391,8 +1371,9 @@ static void check_disk_size_change(struct gendisk *disk, disk->disk_name, bdev_size, disk_size); } i_size_write(bdev->bd_inode, disk_size); - if (bdev_size > disk_size) - flush_disk(bdev, false); + if (bdev_size > disk_size && __invalidate_device(bdev, false)) + pr_warn("VFS: busy inodes on resized disk %s\n", + disk->disk_name); } bdev->bd_invalidated = 0; } @@ -1451,7 +1432,10 @@ int check_disk_change(struct block_device *bdev) if (!(events & DISK_EVENT_MEDIA_CHANGE)) return 0; - flush_disk(bdev, true); + if (__invalidate_device(bdev, true)) + pr_warn("VFS: busy inodes on changed media %s\n", + disk->disk_name); + bdev->bd_invalidated = 1; if (bdops->revalidate_disk) bdops->revalidate_disk(bdev->bd_disk); return 1; From patchwork Wed Jul 8 12:25:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11651537 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 892EC14B7 for ; Wed, 8 Jul 2020 12:37:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A5E220775 for ; Wed, 8 Jul 2020 12:37:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="cOohz1de" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729281AbgGHMht (ORCPT ); Wed, 8 Jul 2020 08:37:49 -0400 Received: from casper.infradead.org ([90.155.50.34]:33904 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728920AbgGHMhs (ORCPT ); Wed, 8 Jul 2020 08:37:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=eRYeofupNTAg/hMagEXpMB0U80BJt/uEJfgiybjPcNs=; b=cOohz1deWmiTukpTMOvRxjYkSC FlpE7v6s71YH+r89i7WhAB1eRC6X7Wyeu3vWEBebMxiDpVy4J/hwl7fjN3pMz+4NLAKBZSd4L8+Az bbw81HjNoRag9LCrtloVUR39LdORU9gy/0c6s5rbCjoWSDYA6Z9HM4tyE6BhNWXRlV5COxT19H7UW +zJgjE3ye8ekvfsAqy7m65No5mPVx9JNFTd7wdKktW35PU+qcPw0MHROFMcUVVNq069PQTZbchnLm WjS13dO3u4DM6Ky+9v1AbDaW+9lM3N6Y8GhAZLU66aKPYfeVJj3LBGabpR4KfGtc3JvQPANvFMBHQ LToSj//g==; Received: from 213-225-32-40.nat.highway.a1.net ([213.225.32.40] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jt9Jp-0002JP-Mv; Wed, 08 Jul 2020 12:37:14 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Song Liu , Ulf Hansson , linux-kernel@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-block@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 4/6] isofs: remove a stale comment Date: Wed, 8 Jul 2020 14:25:44 +0200 Message-Id: <20200708122546.214579-5-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708122546.214579-1-hch@lst.de> References: <20200708122546.214579-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org check_disk_change isn't for consumers of the block layer, so remove the comment mentioning it. Signed-off-by: Christoph Hellwig --- fs/isofs/inode.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index d634561f871a56..78f5c96c76f31e 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c @@ -612,9 +612,6 @@ static bool rootdir_empty(struct super_block *sb, unsigned long block) /* * Initialize the superblock and read the root inode. - * - * Note: a check_disk_change() has been done immediately prior - * to this call, so we don't need to check again. */ static int isofs_fill_super(struct super_block *s, void *data, int silent) { From patchwork Wed Jul 8 12:25:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11651547 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF3FB14DD for ; Wed, 8 Jul 2020 12:39:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BCDF520775 for ; Wed, 8 Jul 2020 12:39:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="gup3UjF+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728994AbgGHMjo (ORCPT ); Wed, 8 Jul 2020 08:39:44 -0400 Received: from casper.infradead.org ([90.155.50.34]:33940 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728759AbgGHMjo (ORCPT ); Wed, 8 Jul 2020 08:39:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=GkrkQYGdmQJutQEhdY7I3KafDobNvEk6jvWbehB6Yvo=; b=gup3UjF+a9lZXCFX1oFt0a0yT/ vOFSQWZPV7z0jSBaBnjGdFxv4Wp0R/VWpOardAZN6Du3P2Pn0a1PPkG4gASM9GFzSGF5qFMMEMx+a 7TDzUU2cSoMGOe0J1FIdKx4hyvINKP3Z2jQFmUr+5GkS79X+xFT/oM6QIGB2BVVOqB7x5vHl4MQGX lL/yyxMZA0NDJPm90i6e1lVgTqfgRqzZWB45IcpQ8cc4QXCqPLORbvXgXSmBtaZtEmBkSxl+tIH+r Hb12BFJuWwp14y4Pgt6c4qOqcs0fAf4zDFwYXU7hwD5FoxUpGPcIYDpJj+Q1r+klFjx/2ooMBZhci PL1pxk7A==; Received: from 213-225-32-40.nat.highway.a1.net ([213.225.32.40] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jt9MF-0002M4-QH; Wed, 08 Jul 2020 12:39:34 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Song Liu , Ulf Hansson , linux-kernel@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-block@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 5/6] xtensa/simdisk: remove the call to check_disk_change Date: Wed, 8 Jul 2020 14:25:45 +0200 Message-Id: <20200708122546.214579-6-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708122546.214579-1-hch@lst.de> References: <20200708122546.214579-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org The simdisk driver doesn't support event notifications, which means that check_disk_change is a no-op. Signed-off-by: Christoph Hellwig --- arch/xtensa/platforms/iss/simdisk.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/xtensa/platforms/iss/simdisk.c b/arch/xtensa/platforms/iss/simdisk.c index 5107140dbb7edc..3447556d276d32 100644 --- a/arch/xtensa/platforms/iss/simdisk.c +++ b/arch/xtensa/platforms/iss/simdisk.c @@ -127,8 +127,6 @@ static int simdisk_open(struct block_device *bdev, fmode_t mode) struct simdisk *dev = bdev->bd_disk->private_data; spin_lock(&dev->lock); - if (!dev->users) - check_disk_change(bdev); ++dev->users; spin_unlock(&dev->lock); return 0; From patchwork Wed Jul 8 12:25:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11651553 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 253C613BD for ; Wed, 8 Jul 2020 12:42:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0331420786 for ; Wed, 8 Jul 2020 12:42:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="FvJ4nHy+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729363AbgGHMl6 (ORCPT ); Wed, 8 Jul 2020 08:41:58 -0400 Received: from casper.infradead.org ([90.155.50.34]:34022 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728994AbgGHMl4 (ORCPT ); Wed, 8 Jul 2020 08:41:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=nCaWLKXo+tr/eEJ5CbH+6GpvCXBBLXFgjESqdoFH3tI=; b=FvJ4nHy+63Lc4RMGwVlRUdox0d YlekPZD8LYJe6Ih1OUzKrwioMvc3EBCIRgNTcqa7IBUnQUxmixBadyYV3MJwlxKaEWGbjq9K5JIpJ nHNMpxfjQR8plBv7w/Q67/CQHvXJymxziz8U7zPSFZJWTl63xZuUJ4T5GKBAJsZKu8+xIxeDLAeiM nnTUTCmVCyN9S7dq6I0h21Zr7dNkYdOQrVH+ccE5g8ilRES6fBmYUanRATFx9vXncd5Jc2sayMrQ9 TmdVl2fuFZWOoc5onK3a+p9qpGIm2C6yxeKF3kx6q+3GM/Ls+geotoOKf6nPC84Iub1YwTEqZ8tcJ Pf15sI7w==; Received: from 213-225-32-40.nat.highway.a1.net ([213.225.32.40] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jt9OU-0002XX-Mu; Wed, 08 Jul 2020 12:41:48 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Song Liu , Ulf Hansson , linux-kernel@vger.kernel.org, linux-xtensa@linux-xtensa.org, linux-block@vger.kernel.org, linux-raid@vger.kernel.org, linux-mmc@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 6/6] mmc: remove the call to check_disk_change Date: Wed, 8 Jul 2020 14:25:46 +0200 Message-Id: <20200708122546.214579-7-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200708122546.214579-1-hch@lst.de> References: <20200708122546.214579-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org The mmc driver doesn't support event notifications, which means that check_disk_change is a no-op. Signed-off-by: Christoph Hellwig Acked-by: Ulf Hansson --- drivers/mmc/core/block.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 4791c82f8f7c78..fa313b63413547 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -312,10 +312,7 @@ static int mmc_blk_open(struct block_device *bdev, fmode_t mode) mutex_lock(&block_mutex); if (md) { - if (md->usage == 2) - check_disk_change(bdev); ret = 0; - if ((mode & FMODE_WRITE) && md->read_only) { mmc_blk_put(md); ret = -EROFS;