Skip to content

Commit

Permalink
fs: remove the special !CONFIG_BLOCK def_blk_fops
Browse files Browse the repository at this point in the history
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.

Fixes: 9361401 ("[PATCH] BLOCK: Make it possible to disable the block layer [try #6]")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20230508144405.41792-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed May 20, 2023
1 parent 3e49c1e commit bda2795
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 28 deletions.
10 changes: 2 additions & 8 deletions fs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,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
Expand Down
3 changes: 2 additions & 1 deletion fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2264,7 +2264,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;
Expand Down
19 changes: 0 additions & 19 deletions fs/no-block.c

This file was deleted.

0 comments on commit bda2795

Please sign in to comment.