Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2935122pxk; Mon, 21 Sep 2020 00:22:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCFtO6VACbFDoOi7SWZJ74l6hA+/9DyvJXYyh2ERpqJ9QmjguNVXTYQfl9ciJ0Xv42zhPt X-Received: by 2002:aa7:d593:: with SMTP id r19mr32669553edq.331.1600672945372; Mon, 21 Sep 2020 00:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600672945; cv=none; d=google.com; s=arc-20160816; b=NwXkbypKuqoqNr7lJSsGGl2NlUT8Pv5ML06V/qzWtoOc/auN3+14jutXjKsQMPH+WR MZCAyTDd/PvpuIAm+sZAl0Uvp+jHnosSdjF7HVp5GMUmzEdiaguxDRN+yDsPF/9fJ++C SrJH9zJ3YZ6a0z+w6WictCKLN5DUeWIHP91GLinOkOeB/qY6RbjBbLTzHhFKhamksesw VfXS7KABwmVxI4ag8DhpMmqQA9Dz5fVIGHQeTC5h6r8SwM8JIr+xJPZ9PCmX/8MJLZ+w ipAsmLGpAwXm1byaBESSNXYzLWdUtdcsOTpH0VnfVL15HaGI6jNcf2xmes8TBTI4zH4B L+2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=uiln3MtorCIt+OqTbXUWnLiMXWC8lUgm2hs2JozLc28=; b=A7SzPiatVl3OjHegUhcwCJWQpAoibyPOeMtD80IJw3rRRRftitpfSlQex+o7/C+/HX hm7jk/0jCf2sTI9+wQbdrT5YE7s1MhJQZaKATADRQMYBqkpPmYiuZcYYK4EEBz5xuHP7 seTKob+89qAsQZzQuiqO0V3QFYDX3szVqsl1KHjIrCN70vnl2pr2pRFtAyjlShIZSnKU GstFi3Wp2dYn6FPHjSDGY+30PlhnZpyR0vwE0stFW0h8KFjmNymHaGeTJIjg+qN0XDh6 hraCs8ng5h87bqJtESUijJ7z7TgTm/9FRX83demkFRN82UQ5i4JQZkjU37tsJKq8iSAB s+Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=WlAvqo0P; 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 r21si5781229eda.589.2020.09.21.00.22.02; Mon, 21 Sep 2020 00:22:25 -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=pass header.i=@infradead.org header.s=casper.20170209 header.b=WlAvqo0P; 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 S1726599AbgIUHUT (ORCPT + 99 others); Mon, 21 Sep 2020 03:20:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726492AbgIUHUI (ORCPT ); Mon, 21 Sep 2020 03:20:08 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA5E8C0613D1; Mon, 21 Sep 2020 00:20:07 -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: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=uiln3MtorCIt+OqTbXUWnLiMXWC8lUgm2hs2JozLc28=; b=WlAvqo0PcB605+Hw0QLRuD1pQx BdyYtsNFPR3wMN5n8f93MPj6oeQPqy60GRR7KR8bYAlYCuZAV8luCL8w+E8yqR9ni0BMRscRRY/iW BUZ16kWwXlC+tHFzJzi9sWaMYwaug6V8SIOW0b0kfNVKHHE181qPrix3SHrySoGyTgz1fO3D0O/W9 eeIwVaKs6zgWS3g2U3WN1SDQBNkp6w54ecHbNf+X36dRXVbSVKkTJOoOuUWusZDlmIpfwewvJnGpm EjjwNpfnPKmsjgRiOI+gFhBvsYdAesrUy9JAiGqPs0teXQE5Ceg8fqbMPBSPgzUQ8Sy1TQ1zYmQyy CsavluHw==; Received: from p4fdb0c34.dip0.t-ipconnect.de ([79.219.12.52] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKG73-0003Dm-IT; Mon, 21 Sep 2020 07:19:49 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Josef Bacik , Minchan Kim , Stefan Haberland , Jan Hoeppner , Joseph Qi , "Rafael J. Wysocki" , Pavel Machek , Len Brown , Andrew Morton , linux-kernel@vger.kernel.org, nbd@other.debian.org, linux-ide@vger.kernel.org, linux-s390@vger.kernel.org, linux-fsdevel@vger.kernel.org, ocfs2-devel@oss.oracle.com, linux-pm@vger.kernel.org, linux-mm@kvack.org, linux-block@vger.kernel.org Subject: remove blkdev_get as a public API v2 Date: Mon, 21 Sep 2020 09:19:44 +0200 Message-Id: <20200921071958.307589-1-hch@lst.de> X-Mailer: git-send-email 2.28.0 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jens, this series removes blkdev_get as a public API, leaving it as just an implementation detail of blkdev_get_by_path and blkdev_get_by_dev. The reason for that is that blkdev_get is a very confusing API that requires a struct block_device to be fed in, but then actually consumes the reference. And it turns out just using the two above mentioned APIs actually significantly simplifies the code as well. Changes since v1: - fix a mismerged that left a stray bdget_disk around - factour the partition scan at registration time code into a new helper. Diffstat: block/genhd.c | 35 ++++++--------- block/ioctl.c | 13 ++--- drivers/block/nbd.c | 8 +-- drivers/block/pktcdvd.c | 92 +++++----------------------------------- drivers/block/zram/zram_drv.c | 7 +-- drivers/char/raw.c | 51 ++++++++-------------- drivers/ide/ide-gd.c | 2 drivers/s390/block/dasd_genhd.c | 15 +----- fs/block_dev.c | 12 ++--- fs/ocfs2/cluster/heartbeat.c | 28 ++++-------- include/linux/blk_types.h | 4 - include/linux/blkdev.h | 1 include/linux/genhd.h | 2 include/linux/suspend.h | 4 - include/linux/swap.h | 3 - kernel/power/swap.c | 21 +++------ kernel/power/user.c | 26 +++-------- mm/swapfile.c | 45 ++++++++++--------- 18 files changed, 130 insertions(+), 239 deletions(-)