Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp503765pxk; Wed, 2 Sep 2020 07:28:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQOCmsFWP9WxmQrvN/6IPY0S9gn2/Z1a9raYRwuRq3H1+AjoRxo1HsovnCQboMDc6c09Ug X-Received: by 2002:a17:907:72c5:: with SMTP id du5mr247939ejc.469.1599056928011; Wed, 02 Sep 2020 07:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599056928; cv=none; d=google.com; s=arc-20160816; b=O3jqt5YApsqk6uqhii04iitRZrYCKBRBTC5PucVogNg4CfMNK6TNApElZNiw1H4hd9 TGfVjIohvDi54f01RqvmQw9tIJkUXkSTUlD6a1nZHSD7UoD9p7U4QYdmw2pG8JI61ol9 R06KALAh1rGyrB4y12+wKkUpJPjBfxSsqYtBHcnH6WbWT5pZtWxDfiRIuSWuwu2MH/ID 7wFcOzmFgJNw298lY7hvM1r0KwUxaYDc/3B3eY7TAtysbnpZ+TkHJLoW8eg1PxXV1d51 fdBrvjrAVr910Z6K46ZT1vCLT3ovr1aJ9z7ioum8UH72itKfqowPYbxkAa1hwObEdi15 D00g== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ufs4jqrq2CjjNQvDZ6kR6VBVekEg4Xvc6ncOR2IVqF0=; b=HISd1EpeQmXwGSkRn8guXQ1/33r/KxU7lLdtAuNBTA130apEKRZog/9esiDl9HKL4H jcgr4in9f2l82MQ4RU8e44HNC5aUI1A9Mo0wQuCSeWxwxh2FQBnkXFlbGjYp1Z78qP2u kRZL18PZRg7E8Ycon9lcvnNkpm9Rb1nvbIjiAvRru/8aO/cxNJ2iMnWpgiBoyU9Jdm4J lO5X4WIdtxeyCNYPRQLK0muQPfcLHznXUnzCijepoY4qzlMWehFRwlSSl0iXu5/NRFjC OnhYEarjgWWA3hePnyL3QIK0ivdJ3BBVSBFAWKjB4gAxAft4++5mQiPpzMP7APYuwJ1T iRmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=ITty+HZw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx10si1253037edb.383.2020.09.02.07.28.25; Wed, 02 Sep 2020 07:28:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=ITty+HZw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726657AbgIBO1q (ORCPT + 99 others); Wed, 2 Sep 2020 10:27:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726967AbgIBONl (ORCPT ); Wed, 2 Sep 2020 10:13:41 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B2F1C06123B; Wed, 2 Sep 2020 07:13:01 -0700 (PDT) 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=Ufs4jqrq2CjjNQvDZ6kR6VBVekEg4Xvc6ncOR2IVqF0=; b=ITty+HZwZMS3zp0/fym+fo7jey NxrNIF6rwUyyue6j5V1YYbYZWUGNJASJ6i5+gw3N93c2GwQeqAOBfbz3YaZB3b7TlPD2r3BAElZ7Z +Whek0B0aASyCuHi2aMs/vo97lGhVUoDMSzRQ/Y/+viuXFh1zj/lDkgvShxh+FDLlmPmT24Nq4wJI 0MNL6Q0upqhWjl9G1mG+TdHH4Z/OCg6I7DV1HYkiFPLTmkj8RA32tn6pWWEsg3GoEoTvZKQ5ZzjAG Q33OKseKi1KpzripqiqZCDGi4ktnB4yXMgQCiximn0syUsFP8YSA45NpFiinClAbBlU7fzlcA+BZO OEp8+hOA==; Received: from [2001:4bb8:184:af1:6a63:7fdb:a80e:3b0b] (helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDTVC-0005g0-6p; Wed, 02 Sep 2020 14:12:42 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Denis Efremov , Tim Waugh , Michal Simek , Borislav Petkov , "David S. Miller" , Song Liu , "Martin K. Petersen" , Finn Thain , Michael Schmitz , linux-m68k@lists.linux-m68k.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, linux-raid@vger.kernel.org, linux-scsi@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 16/19] sd: use bdev_check_media_change Date: Wed, 2 Sep 2020 16:12:15 +0200 Message-Id: <20200902141218.212614-17-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200902141218.212614-1-hch@lst.de> References: <20200902141218.212614-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Switch to use bdev_check_media_change instead of check_disk_change and call cd_revalidate_disk manually. As sd also calls sd_revalidate_disk manually during probe and open, , the extra call into ->revalidate_disk from bdev_disk_changed is not required either, so stop wiring up the method. Signed-off-by: Christoph Hellwig --- drivers/scsi/sd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 2bec8cd526164d..d020639c28c6ca 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1381,8 +1381,10 @@ static int sd_open(struct block_device *bdev, fmode_t mode) if (!scsi_block_when_processing_errors(sdev)) goto error_out; - if (sdev->removable || sdkp->write_prot) - check_disk_change(bdev); + if (sdev->removable || sdkp->write_prot) { + if (bdev_check_media_change(bdev)) + sd_revalidate_disk(bdev->bd_disk); + } /* * If the drive is empty, just let the open fail. @@ -1843,7 +1845,6 @@ static const struct block_device_operations sd_fops = { .compat_ioctl = sd_compat_ioctl, #endif .check_events = sd_check_events, - .revalidate_disk = sd_revalidate_disk, .unlock_native_capacity = sd_unlock_native_capacity, .report_zones = sd_zbc_report_zones, .pr_ops = &sd_pr_ops, -- 2.28.0