Commit 3325b4d8 authored by Heiko Carstens's avatar Heiko Carstens
Browse files

s390/hypfs: factor out filesystem code



The s390_hypfs filesystem is deprecated and shouldn't be used due to its
rather odd semantics. It creates a whole directory structure with static
file contents so a user can read a consistent state while within that
directory.
Writing to its update attribute will remove and rebuild nearly the whole
filesystem, so that again a user can read a consistent state, even if
multiple files need to be read.

Given that this wastes a lot of CPU cycles, and involves a lot of code,
binary interfaces have been added quite a couple of years ago, which simply
pass the binary data to user space, and let user space decode the data.
This is the preferred and only way how the data should be retrieved.

The assumption is that there are no users of the s390_hypfs filesystem.
However instead of just removing the code, and having to revert in case
there are actually users, factor the filesystem code out and make it only
available via a new config option.

This config option is supposed to be disabled. If it turns out there are no
complaints the filesystem code can be removed probably in a couple of
years.

Acked-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent b7857acc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ obj-y += kernel/
obj-y				+= mm/
obj-$(CONFIG_KVM)		+= kvm/
obj-y				+= crypto/
obj-$(CONFIG_S390_HYPFS_FS)	+= hypfs/
obj-$(CONFIG_S390_HYPFS)	+= hypfs/
obj-$(CONFIG_APPLDATA_BASE)	+= appldata/
obj-y				+= net/
obj-$(CONFIG_PCI)		+= pci/
+13 −2
Original line number Diff line number Diff line
@@ -877,13 +877,24 @@ config APPLDATA_NET_SUM
	  This can also be compiled as a module, which will be called
	  appldata_net_sum.o.

config S390_HYPFS_FS
config S390_HYPFS
	def_bool y
	prompt "s390 hypervisor information"
	help
	  This provides several binary files at (debugfs)/s390_hypfs/ to
	  provide accounting information in an s390 hypervisor environment.

config S390_HYPFS_FS
	def_bool n
	prompt "s390 hypervisor file system support"
	select SYS_HYPERVISOR
	depends on S390_HYPFS
	help
	  This is a virtual file system intended to provide accounting
	  information in an s390 hypervisor environment.
	  information in an s390 hypervisor environment. This file system
	  is deprecated and should not be used.

	  Say N if you are unsure.

source "arch/s390/kvm/Kconfig"

+8 −3
Original line number Diff line number Diff line
@@ -3,7 +3,12 @@
# Makefile for the linux hypfs filesystem routines.
#

obj-$(CONFIG_S390_HYPFS_FS) += s390_hypfs.o
obj-$(CONFIG_S390_HYPFS)	+= hypfs_dbfs.o
obj-$(CONFIG_S390_HYPFS)	+= hypfs_diag.o
obj-$(CONFIG_S390_HYPFS)	+= hypfs_diag0c.o
obj-$(CONFIG_S390_HYPFS)	+= hypfs_sprp.o
obj-$(CONFIG_S390_HYPFS)	+= hypfs_vm.o

s390_hypfs-objs := inode.o hypfs_diag.o hypfs_vm.o hypfs_dbfs.o hypfs_sprp.o
s390_hypfs-objs += hypfs_diag0c.o
obj-$(CONFIG_S390_HYPFS_FS)	+= hypfs_diag_fs.o
obj-$(CONFIG_S390_HYPFS_FS)	+= hypfs_vm_fs.o
obj-$(CONFIG_S390_HYPFS_FS)	+= inode.o
+9 −1
Original line number Diff line number Diff line
@@ -46,6 +46,15 @@ void hypfs_diag0c_exit(void);
void hypfs_sprp_init(void);
void hypfs_sprp_exit(void);

int __hypfs_fs_init(void);

static inline int hypfs_fs_init(void)
{
	if (IS_ENABLED(CONFIG_S390_HYPFS_FS))
		return __hypfs_fs_init();
	return 0;
}

/* debugfs interface */
struct hypfs_dbfs_file;

@@ -69,7 +78,6 @@ struct hypfs_dbfs_file {
	struct dentry		*dentry;
};

extern void hypfs_dbfs_init(void);
extern void hypfs_dbfs_exit(void);
extern void hypfs_dbfs_create_file(struct hypfs_dbfs_file *df);
extern void hypfs_dbfs_remove_file(struct hypfs_dbfs_file *df);
+26 −5
Original line number Diff line number Diff line
@@ -90,12 +90,33 @@ void hypfs_dbfs_remove_file(struct hypfs_dbfs_file *df)
	debugfs_remove(df->dentry);
}

void hypfs_dbfs_init(void)
static int __init hypfs_dbfs_init(void)
{
	int rc = -ENODATA;

	dbfs_dir = debugfs_create_dir("s390_hypfs", NULL);
}
	if (hypfs_diag_init())
		goto fail_dbfs_exit;
	if (hypfs_vm_init())
		goto fail_hypfs_diag_exit;
	hypfs_sprp_init();
	if (hypfs_diag0c_init())
		goto fail_hypfs_sprp_exit;
	rc = hypfs_fs_init();
	if (rc)
		goto fail_hypfs_diag0c_exit;
	return 0;

void hypfs_dbfs_exit(void)
{
fail_hypfs_diag0c_exit:
	hypfs_diag0c_exit();
fail_hypfs_sprp_exit:
	hypfs_sprp_exit();
	hypfs_vm_exit();
fail_hypfs_diag_exit:
	hypfs_diag_exit();
	pr_err("Initialization of hypfs failed with rc=%i\n", rc);
fail_dbfs_exit:
	debugfs_remove(dbfs_dir);
	return rc;
}
device_initcall(hypfs_dbfs_init)
Loading