From patchwork Mon Mar 8 07:45:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12121733 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 1FC9DC433E9 for ; Mon, 8 Mar 2021 07:47:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3D51651E6 for ; Mon, 8 Mar 2021 07:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232158AbhCHHq2 (ORCPT ); Mon, 8 Mar 2021 02:46:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231987AbhCHHqI (ORCPT ); Mon, 8 Mar 2021 02:46:08 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F217C06174A for ; Sun, 7 Mar 2021 23:46:08 -0800 (PST) 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=WAZmR7IvxS8sB9w1a8MZLOHfY6g7zP9/lNuLwV8XQxA=; b=vrbdfhFGIOFzOhbEjsDN+XbkTA QMYnIz446uW3ITWfOCU4/jem0z7wkSyVW3H3MMbXl6YAWQo40RNzfWwOGRODDYLJMOdAgZSdoR85r 74dKht/IjddLI1ZPImJZaFypGK3LbEiI5TtBLb2Z9aMqg2OScGoPLr7hyTQFGOPiRGKV8kdAi/kUr VVIFbwzHPeGHhGdGr0vVr3qeClV/L8yX8OJ6KhI2+MATrRGgvXIFCzWlCyHL0SaXLcV1it2/3mwGv BwiCGVEFetMb1bz1ztcUjAyk2J+tFssxBzV1dC9lwAc49DFeTG5S/2zmIqHkcWLnH5MOdwlnOk9g7 8Zh8V2NQ==; Received: from [2001:4bb8:180:9884:c70:4a89:bc61:3] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lJAaS-00FBq1-Uu; Mon, 08 Mar 2021 07:45:58 +0000 From: Christoph Hellwig To: Jens Axboe , Tim Waugh Cc: linux-block@vger.kernel.org Subject: [PATCH 1/3] paride/pd: remove ->revalidate_disk Date: Mon, 8 Mar 2021 08:45:48 +0100 Message-Id: <20210308074550.422714-2-hch@lst.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210308074550.422714-1-hch@lst.de> References: <20210308074550.422714-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 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org ->revalidate_disk is only called during add_disk for pd, but at that point the driver has already set the capacity to the one returned from Identify a little earlier, so this additional update is entirely superflous. Signed-off-by: Christoph Hellwig --- drivers/block/paride/pd.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index 897acda20ac85a..828a45ffe0e7d8 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c @@ -859,16 +859,6 @@ static unsigned int pd_check_events(struct gendisk *p, unsigned int clearing) return r ? DISK_EVENT_MEDIA_CHANGE : 0; } -static int pd_revalidate(struct gendisk *p) -{ - struct pd_unit *disk = p->private_data; - if (pd_special_command(disk, pd_identify) == 0) - set_capacity(p, disk->capacity); - else - set_capacity(p, 0); - return 0; -} - static const struct block_device_operations pd_fops = { .owner = THIS_MODULE, .open = pd_open, @@ -877,7 +867,6 @@ static const struct block_device_operations pd_fops = { .compat_ioctl = pd_ioctl, .getgeo = pd_getgeo, .check_events = pd_check_events, - .revalidate_disk= pd_revalidate }; /* probing */ From patchwork Mon Mar 8 07:45:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12121729 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 0ED3BC433E0 for ; Mon, 8 Mar 2021 07:47:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9E9626513A for ; Mon, 8 Mar 2021 07:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231987AbhCHHq3 (ORCPT ); Mon, 8 Mar 2021 02:46:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232096AbhCHHqJ (ORCPT ); Mon, 8 Mar 2021 02:46:09 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DAA8C06174A for ; Sun, 7 Mar 2021 23:46:09 -0800 (PST) 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=KvvVKL5yYTWIbgugXKJBcDwWaMRqskGEcVfDiHCc12k=; b=G3IVGMSoYEyTDZ8yRL6Jt+5g33 SDd0+MgQjjvsKoANSIu2A8vsnZm1mcWVUWG7LnG+pLFFi570TuZwTPHPsyFpQm/MjiQrShFHG1XyW J4h054u28smrhfqVSWqBqW5ug4l3T+t43+hEvRafvqiHE/KpWzdi2CHPAjW2pUKyJsXD7/VIh5kAO e8o+IG5kGXmvCjQ5NUsJHj8d+BeysG4MvXxpohEZpYxTht/hk5J0Vzo6auDgjqHwuzrJI9mLbtbKU PIqbi450eR+fHK93z5Rxv7gus73/aVWSjFbC0wG6qTy/5dG2bsPAOj5/UY0QPYEqdUACRqH3c/lvR 1L+mZkkw==; Received: from [2001:4bb8:180:9884:c70:4a89:bc61:3] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lJAaX-00FBq7-Vw; Mon, 08 Mar 2021 07:46:03 +0000 From: Christoph Hellwig To: Jens Axboe , Tim Waugh Cc: linux-block@vger.kernel.org Subject: [PATCH 2/3] umem: remove ->revalidate_disk Date: Mon, 8 Mar 2021 08:45:49 +0100 Message-Id: <20210308074550.422714-3-hch@lst.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210308074550.422714-1-hch@lst.de> References: <20210308074550.422714-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 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org ->revalidate_disk is only called during add_disk for pd, but at that point the driver has already set the capacity to the same value a little earlier, so this additional update is entirely superflous. Signed-off-by: Christoph Hellwig --- drivers/block/umem.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/drivers/block/umem.c b/drivers/block/umem.c index 982732dbe82e69..4c8320bfc46b5c 100644 --- a/drivers/block/umem.c +++ b/drivers/block/umem.c @@ -746,21 +746,6 @@ static void del_battery_timer(void) del_timer(&battery_timer); } -/* - * Note no locks taken out here. In a worst case scenario, we could drop - * a chunk of system memory. But that should never happen, since validation - * happens at open or mount time, when locks are held. - * - * That's crap, since doing that while some partitions are opened - * or mounted will give you really nasty results. - */ -static int mm_revalidate(struct gendisk *disk) -{ - struct cardinfo *card = disk->private_data; - set_capacity(disk, card->mm_size << 1); - return 0; -} - static int mm_getgeo(struct block_device *bdev, struct hd_geometry *geo) { struct cardinfo *card = bdev->bd_disk->private_data; @@ -781,7 +766,6 @@ static const struct block_device_operations mm_fops = { .owner = THIS_MODULE, .submit_bio = mm_submit_bio, .getgeo = mm_getgeo, - .revalidate_disk = mm_revalidate, }; static int mm_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) From patchwork Mon Mar 8 07:45:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 12121731 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 D2EE9C433DB for ; Mon, 8 Mar 2021 07:47:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 80A246512F for ; Mon, 8 Mar 2021 07:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232096AbhCHHq3 (ORCPT ); Mon, 8 Mar 2021 02:46:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232114AbhCHHqM (ORCPT ); Mon, 8 Mar 2021 02:46:12 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8398CC06174A for ; Sun, 7 Mar 2021 23:46:12 -0800 (PST) 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=c7sb+A4wHTchgvyY+VHcVt1ZX/G2Fcwphae/YqoQRwQ=; b=H5nj9+OZ5MgwmIWWBiY92Nb9Ou b8E7w8rPZtKwWcyOzfiVyJIVw9qpYZcNF79oGErqQ+9WuBF0mT9lFsxQ58LrTTUAbwR+NmaktheSh cy2nayWmN6Cu/sjBr/rRoMsv+ctQFCDVjnPTEKopLya5TP5jNgIynv3o2Cy2dZR2OrZtHw7UAcxu3 ZaZr50tgyI62ezZUHWcjwa+kV/5TLnQ1L2wnrwKapRiN5rBOHtEDC0dvUBNRBQuUiHalQVHonfB0L LhBmFd6+9LfYBs4FWrdro4e9aKAmgy+4GctXfyCcZpd/7KStc9HiB6mNSH6o7vq9O5w8ohpy7iUtm 8hCl/tTA==; Received: from [2001:4bb8:180:9884:c70:4a89:bc61:3] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lJAad-00FBqK-NY; Mon, 08 Mar 2021 07:46:08 +0000 From: Christoph Hellwig To: Jens Axboe , Tim Waugh Cc: linux-block@vger.kernel.org Subject: [PATCH 3/3] block: remove the revalidate_disk method Date: Mon, 8 Mar 2021 08:45:50 +0100 Message-Id: <20210308074550.422714-4-hch@lst.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210308074550.422714-1-hch@lst.de> References: <20210308074550.422714-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 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org No implementations left. Signed-off-by: Christoph Hellwig --- Documentation/filesystems/locking.rst | 2 -- fs/block_dev.c | 3 --- include/linux/blkdev.h | 1 - 3 files changed, 6 deletions(-) diff --git a/Documentation/filesystems/locking.rst b/Documentation/filesystems/locking.rst index b7dcc86c92a45f..9774e92e449fbd 100644 --- a/Documentation/filesystems/locking.rst +++ b/Documentation/filesystems/locking.rst @@ -469,7 +469,6 @@ prototypes:: int (*direct_access) (struct block_device *, sector_t, void **, unsigned long *); void (*unlock_native_capacity) (struct gendisk *); - int (*revalidate_disk) (struct gendisk *); int (*getgeo)(struct block_device *, struct hd_geometry *); void (*swap_slot_free_notify) (struct block_device *, unsigned long); @@ -484,7 +483,6 @@ ioctl: no compat_ioctl: no direct_access: no unlock_native_capacity: no -revalidate_disk: no getgeo: no swap_slot_free_notify: no (see below) ======================= =================== diff --git a/fs/block_dev.c b/fs/block_dev.c index 4aa1f88d5bf8b3..422d088ac7dbaa 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1250,9 +1250,6 @@ int bdev_disk_changed(struct block_device *bdev, bool invalidate) if (disk_part_scan_enabled(disk) || !(disk->flags & GENHD_FL_REMOVABLE)) set_capacity(disk, 0); - } else { - if (disk->fops->revalidate_disk) - disk->fops->revalidate_disk(disk); } if (get_capacity(disk)) { diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index bc6bc8383b434e..b4241f73f7a89c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1870,7 +1870,6 @@ struct block_device_operations { unsigned int (*check_events) (struct gendisk *disk, unsigned int clearing); void (*unlock_native_capacity) (struct gendisk *); - int (*revalidate_disk) (struct gendisk *); int (*getgeo)(struct block_device *, struct hd_geometry *); int (*set_read_only)(struct block_device *bdev, bool ro); /* this callback is with swap_lock and sometimes page table lock held */