From patchwork Mon Apr 24 05:49:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13221655 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59796C7618E for ; Mon, 24 Apr 2023 05:49:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 33A406B0075; Mon, 24 Apr 2023 01:49:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 227576B0078; Mon, 24 Apr 2023 01:49:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0027C6B007B; Mon, 24 Apr 2023 01:49:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id E5D036B0075 for ; Mon, 24 Apr 2023 01:49:50 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id B45351A010F for ; Mon, 24 Apr 2023 05:49:50 +0000 (UTC) X-FDA: 80715208140.13.05CC4C7 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf20.hostedemail.com (Postfix) with ESMTP id 1F1661C000C for ; Mon, 24 Apr 2023 05:49:48 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=BVLdIyeC; spf=none (imf20.hostedemail.com: domain of BATV+e16e2fc4419b117693a1+7183+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+e16e2fc4419b117693a1+7183+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1682315389; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=V5nklQoA9f4p457fAmSLCbWYVHcQ95Tr9Yi93vZ1hXQ=; b=kY9W+CC8DsHYJlL1ylmuLx0PUjvqJXxo2Pi4obF+P3t/Xb1mwQVPuy567pwj6Ou+0X32Fx KEVbBgezYBrdURnxBxB7PkMlhCZniDfHNeY0ZF3wjhM34R1XM4wQyU+x8dVDnX1GQDEC9D RIWUjpt64R/QnK8o+FCcQoNSRdwmW+g= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=BVLdIyeC; spf=none (imf20.hostedemail.com: domain of BATV+e16e2fc4419b117693a1+7183+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+e16e2fc4419b117693a1+7183+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1682315389; a=rsa-sha256; cv=none; b=cjwk3/WLs5rkU1nPPJ0Q+RRCVOC8Gs124UlMudbcstubDSqlwMn2nNnvapfyL42loakn4Q QfBHZ+Gm0TJgRIAFC+7x8speOWoonsqPCyK54Mi3zn8bS+n88e1sqRHMsH52WlTxEtQdQR 7LHvVgn+ehygspzf5OsTCLO82/t8ZQg= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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=V5nklQoA9f4p457fAmSLCbWYVHcQ95Tr9Yi93vZ1hXQ=; b=BVLdIyeC9XyB883rbVnHnnshYb v9MBAr9Kui06l3iqsHsxD6wr7hDLJughW5sYL6bLE4MMi2NT4MojE/Kqi+QP5twRZ+EZc4+pHQm3S kcN/fEcPtZ2XKOf2kEcveCPw4THCw9R3Vp3FTaYaHC5Q6XyN/KDa1LZrslZMBHL8ouAUMCh+sbtnt jGhkPdK1bf1+RRVNAAo7uctMzy3iud0d3e4hNElvjoV0xaEA7vu/iU7cwGxhgjr4qByRCVU5CGTNI M7ydlMTMwaIbWoe21seFAlCC/o0TZc5ZPNp4ELlK9gRxqfYBpHM10qTh06+1CPkGzgFFFvJGUiBet OQvgwjkg==; Received: from [2001:4bb8:189:a74f:e8a5:5f73:6d2:23b8] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pqp4y-00FOuS-1q; Mon, 24 Apr 2023 05:49:37 +0000 From: Christoph Hellwig To: Jens Axboe Cc: Miklos Szeredi , "Darrick J. Wong" , Andrew Morton , David Howells , Matthew Wilcox , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, ceph-devel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-xfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/17] fs: remove the special !CONFIG_BLOCK def_blk_fops Date: Mon, 24 Apr 2023 07:49:11 +0200 Message-Id: <20230424054926.26927-3-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230424054926.26927-1-hch@lst.de> References: <20230424054926.26927-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 1F1661C000C X-Rspam-User: X-Stat-Signature: yu641rm3cu3zarz9xcr5uqmmg8wmyt4n X-HE-Tag: 1682315388-54766 X-HE-Meta: U2FsdGVkX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jCKo3HAGI7XvRV67E4OcghuuAgd4o43TJrOOhb6CPBrcfVDx5wn18qTj0nDOLuybM9n/V+YzkBkJU0efD8J7ge0SnpYLYR3vOsKyU5MkNkRGq2cSy+FhwysCXVFKNwwHpujpE8hEOgOJldpIV1PG6Pk+J8uQqVbnQVdwrZ7NI4FkoGsirGGFMI+W/k250ZtCXehlgM+rvpbAMkOJzsU0/PBh+wI9+uuTjPKzpI+xWmV54VqihLH5l3XftErS6moUvrzlC3Muk5Flk4cpdB/As0vxl3B9/g0P7TtmVV2KaKRtTyNR5iwDyt4kfEy2TMCAzSEFjLrTw0Xuz7Z2HJ1S7vxX7WcUPU2iNbAlbSWLUCKTny7Wbxo0dRdkhm1mxnW1g6zbGpasBCxMNgNFujVoFrsk3HH2hG4g== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: def_blk_fops always returns -ENODEV, which dosn't match the return value of a non-existing block device with CONFIG_BLOCK, which is -ENXIO. Just remove the extra implementation and fall back to the default no_open_fops that always returns -ENXIO. Signed-off-by: Christoph Hellwig --- fs/Makefile | 10 ++-------- fs/inode.c | 3 ++- fs/no-block.c | 19 ------------------- 3 files changed, 4 insertions(+), 28 deletions(-) delete mode 100644 fs/no-block.c diff --git a/fs/Makefile b/fs/Makefile index 05f89b5c962f88..da21e7d0a1cf37 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -18,14 +18,8 @@ obj-y := open.o read_write.o file_table.o super.o \ fs_types.o fs_context.o fs_parser.o fsopen.o init.o \ kernel_read_file.o mnt_idmapping.o remap_range.o -ifeq ($(CONFIG_BLOCK),y) -obj-y += buffer.o mpage.o -else -obj-y += no-block.o -endif - -obj-$(CONFIG_PROC_FS) += proc_namespace.o - +obj-$(CONFIG_BLOCK) += buffer.o mpage.o +obj-$(CONFIG_PROC_FS) += proc_namespace.o obj-$(CONFIG_LEGACY_DIRECT_IO) += direct-io.o obj-y += notify/ obj-$(CONFIG_EPOLL) += eventpoll.o diff --git a/fs/inode.c b/fs/inode.c index 4558dc2f135573..d43f07f146eb73 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -2265,7 +2265,8 @@ void init_special_inode(struct inode *inode, umode_t mode, dev_t rdev) inode->i_fop = &def_chr_fops; inode->i_rdev = rdev; } else if (S_ISBLK(mode)) { - inode->i_fop = &def_blk_fops; + if (IS_ENABLED(CONFIG_BLOCK)) + inode->i_fop = &def_blk_fops; inode->i_rdev = rdev; } else if (S_ISFIFO(mode)) inode->i_fop = &pipefifo_fops; diff --git a/fs/no-block.c b/fs/no-block.c deleted file mode 100644 index 481c0f0ab4bd2c..00000000000000 --- a/fs/no-block.c +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* no-block.c: implementation of routines required for non-BLOCK configuration - * - * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - */ - -#include -#include - -static int no_blkdev_open(struct inode * inode, struct file * filp) -{ - return -ENODEV; -} - -const struct file_operations def_blk_fops = { - .open = no_blkdev_open, - .llseek = noop_llseek, -};