relay: Migrate from relayfs to a generic relay API.
Subsystems (3)
cover relay: Migrate from relayfs to a generic relay API.
This is a small patch set for getting rid of relayfs, and moving the core of its functionality to kernel/relay.c. The API is kept consistent for everything but the relayfs-specific bits, meaning people will have to use other file systems to implement relay channel buffers.
There's support for a sysfs relay attribute (resent with a signed-off-by tag and cleaned up description), and it's also trivial to do via debugfs.
Patches are ordered by invasiveness, the first few start out relatively harmless, with the later ones removing relayfs entirely. There's definitely room for cleanup and improvement in the new relay.c, but one thing at a time..
Tested with sysfs. Against current git.
To get an idea of the total amount of changes:
---
fs/relayfs/Makefile | 4 fs/relayfs/buffers.c | 190 --------- fs/relayfs/buffers.h | 12 fs/relayfs/inode.c | 581 ---------------------------- fs/relayfs/relay.c | 482 ----------------------- fs/relayfs/relay.h | 9 include/linux/relayfs_fs.h | 290 -------------- fs/Kconfig | 12 fs/Makefile | 1 fs/sysfs/Makefile | 3 fs/sysfs/dir.c | 28 + fs/sysfs/inode.c | 5 fs/sysfs/relay.c | 72 +++ include/linux/relay.h | 281 +++++++++++++ include/linux/relayfs_fs.h | 3 include/linux/sysfs.h | 33 + init/Kconfig | 11 kernel/Makefile | 1 kernel/relay.c | 923 ++++++++++++++++++++++++++++++++++++++++++++- 19 files changed, 1349 insertions(+), 1592 deletions(-)
PATCH 1/5 sysfs: relay channel buffers as sysfs attributes
Now with relayfs integrated and the relay_file_operations exported for use by other file systems, add a sysfs attribute for setting up channel buffers.
The conventional relayfs doesn't make a lot of sense for the use cases where there are multiple devices to stream data from, particularly if they're already mapped out through the driver model. Rather than duplicating device enumeration, simply adding this as an attribute seems to work reasonably well.
Tom did some work on the rchan_callbacks for more easily implementing relay files in other file systems, and it would be nice to use this in a non-debug context, without duplicating device enumeration in multiple locations.
---
fs/sysfs/Makefile | 1 + fs/sysfs/dir.c | 26 ++++++++++++++++++ fs/sysfs/inode.c | 5 ++++ fs/sysfs/relay.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ include/linux/sysfs.h | 27 ++++++++++++++++++- 5 files changed, 128 insertions(+), 1 deletions(-) create mode 100644 fs/sysfs/relay.c
0bb45834cda629d913c1d83039f9320162412bd3
fs/sysfs/Makefile +1 -0
@@ -4,3 +4,4 @@ obj-y := inode.o file.o dir.o symlink.o mount.o bin.o \ group.o +obj-$(CONFIG_RELAYFS_FS) += relay.o
fs/sysfs/dir.c +26 -0
@@ -87,6 +87,20 @@ static int init_file(struct inode * inodreturn 0 ; } +#ifdef CONFIG_RELAYFS_FS +static int init_relay_file (struct inode * inode) +{ +extern struct file_operations relay_file_operations; + inode->i_fop = &relay_file_operations; +return 0 ; +} +#else +static int init_relay_file (struct inode * inode) +{ +return -EINVAL ; +} +#endif +static int init_symlink (struct inode * inode) { inode->i_op = &sysfs_symlink_inode_operations;
@@ -165,6 +179,7 @@ int sysfs_create_dir(struct kobject * kostatic int sysfs_attach_attr (struct sysfs_dirent * sd,struct dentry * dentry) {struct attribute * attr =NULL ; +struct relay_attribute * rel_attr =NULL ;struct bin_attribute * bin_attr =NULL ;int (* init) (struct inode *) =NULL ;int error =0 ;
@@ -172,6 +187,10 @@ static int sysfs_attach_attr(struct sysfif (sd->s_type &SYSFS_KOBJ_BIN_ATTR ) { bin_attr = sd->s_element; attr = &bin_attr->attr; + }else if (sd->s_type &SYSFS_KOBJ_RELAY_ATTR ) { + rel_attr = sd->s_element; + attr = &rel_attr->attr; + init = init_relay_file; }else { attr = sd->s_element; init = init_file;
@@ -189,6 +208,13 @@ static int sysfs_attach_attr(struct sysf dentry->d_inode->i_size = bin_attr->size; dentry->d_inode->i_fop = &bin_fops; } + +if (rel_attr) { +unsigned int size = rel_attr->subbuf_size * rel_attr->n_subbufs; + dentry->d_inode->i_size = ((size -1 ) &PAGE_MASK ) +PAGE_SIZE ; + dentry->d_inode->u.generic_ip = rel_attr->rchan_buf; + } + dentry->d_op = &sysfs_dentry_ops;d_rehash (dentry);
fs/sysfs/inode.c +5 -0
@@ -174,6 +174,7 @@ const unsigned char * sysfs_get_name(str {struct attribute * attr;struct bin_attribute * bin_attr; +struct relay_attribute * rel_attr;struct sysfs_symlink * sl;if (!sd || !sd->s_element)
@@ -192,6 +193,10 @@ const unsigned char * sysfs_get_name(str bin_attr = sd->s_element;return bin_attr->attr.name; +case SYSFS_KOBJ_RELAY_ATTR : + rel_attr = sd->s_element; +return rel_attr->attr.name; +case SYSFS_KOBJ_LINK : sl = sd->s_element;return sl->link_name;
fs/sysfs/relay.c new file +70 -0
70 lines not on this page · raw message
include/linux/sysfs.h +26 -1
@@ -60,6 +60,15 @@ struct bin_attribute { struct vm_area_struct *vma); }; +struct relay_attribute { +struct attribute attr; +struct rchan *rchan; +struct rchan_buf *rchan_buf; +struct kobject *kobj; +size_t subbuf_size; +size_t n_subbufs; +}; +struct sysfs_ops {ssize_t (*show)(struct kobject *,struct attribute *,char *);ssize_t (*store)(struct kobject *,struct attribute *,const char *,size_t );
@@ -81,7 +90,23 @@ struct sysfs_dirent {#define SYSFS_KOBJ_ATTR 0x0004#define SYSFS_KOBJ_BIN_ATTR 0x0008#define SYSFS_KOBJ_LINK 0x0020 -#define SYSFS_NOT_PINNED (SYSFS_KOBJ_ATTR | SYSFS_KOBJ_BIN_ATTR | SYSFS_KOBJ_LINK) +#define SYSFS_KOBJ_RELAY_ATTR 0x0040 +#define SYSFS_NOT_PINNED (SYSFS_KOBJ_ATTR | SYSFS_KOBJ_BIN_ATTR | \ + SYSFS_KOBJ_LINK | SYSFS_KOBJ_RELAY_ATTR) + +#if defined(CONFIG_RELAYFS_FS ) && defined(CONFIG_SYSFS ) +int sysfs_create_relay_file (struct kobject *,struct relay_attribute *); +void sysfs_remove_relay_file (struct kobject *,struct relay_attribute *); +#else +static inline int sysfs_create_relay_file (struct kobject *kobj,struct relay_attribute *attr) +{ +return 0 ; +} + +static inline void sysfs_remove_relay_file (struct kobject *kobj,struct relay_attribute *attr) +{ +} +#endif /* CONFIG_RELAYFS_FS && CONFIG_SYSFS */ #ifdef CONFIG_SYSFS
Signature · 1 line
1.2.0.geb68
Re: [PATCH 1/5] sysfs: relay channel buffers as sysfs attributes
Quoted 7 lines · Paul Mundt
fs/sysfs/relay.c new file +7
-0+ +static struct dentry * +sysfs_create_buf_file (const char *filename,struct dentry *dentry,int mode, +struct rchan_buf *buf,int *is_global) +{ +struct relay_attribute *attr = (struct relay_attribute *)dentry; +struct dentry *parent = attr->kobj->dentry;
fs/sysfs/relay.c line 30
Quoted 10 lines
fs/sysfs/relay.c new file +10
-0+int ret; + + attr->attr.mode = mode; + attr->rchan_buf = buf; + + ret =sysfs_add_file (parent, &attr->attr,SYSFS_KOBJ_RELAY_ATTR ); +if (unlikely (ret !=0 )) +return NULL ; + + dentry =lookup_one_len (filename, parent,strlen (filename));
lookup_one_len() needs parent's i_mutex.
fs/sysfs/relay.c line 32
Quoted 2 lines
fs/sysfs/relay.c new file +2
-0+if (IS_ERR (dentry)) +sysfs_hash_and_remove (parent, filename);
Also wondering if you have considered the case of -EEXIST?
fs/sysfs/relay.c line 35
Quoted 3 lines
fs/sysfs/relay.c new file +3
-0+ +return dentry; +}
Thanks
Maneesh
Signature · 6 lines
Maneesh Soni Linux Technology Center, IBM India Software Labs, Bangalore, India email: [email protected] Phone: 91-80-25044990
Re: [PATCH 1/5] sysfs: relay channel buffers as sysfs attributes
Quoted 5 lines · Maneesh Soni
fs/sysfs/relay.c line 30
Quoted 1 line · Paul Mundt
fs/sysfs/relay.c new file +1
-0+ dentry =lookup_one_len (filename, parent,strlen (filename));
lookup_one_len()needs parent'si_mutex.
Good catch, thanks.
Quoted 5 lines
fs/sysfs/relay.c line 32
Quoted 2 lines
fs/sysfs/relay.c new file +2
-0+if (IS_ERR (dentry)) +sysfs_hash_and_remove (parent, filename);Also wondering if you have considered the case of
-EEXIST?
How is that going to happen? The line before we do sysfs_add_file(), and if that errors out, then we never make it to lookup_one_len().
The IS_ERR() check is pretty superfluous anyways, perhaps it makes more sense just to remove it and the sysfs_hash_and_remove() reference entirely.
Re: [PATCH 1/5] sysfs: relay channel buffers as sysfs attributes
Quoting Paul Mundt <[email protected]>:
Quoted 8 lines · Maneesh Soni
Quoted 5 lines · Paul Mundt
fs/sysfs/relay.c line 30
Quoted 1 line
fs/sysfs/relay.c new file +1
-0+ dentry =lookup_one_len (filename, parent,strlen (filename));
lookup_one_len()needs parent'si_mutex.Good catch, thanks.
Quoted 8 lines
Quoted 5 lines
fs/sysfs/relay.c line 32
Quoted 2 lines
fs/sysfs/relay.c new file +2
-0+if (IS_ERR (dentry)) +sysfs_hash_and_remove (parent, filename);Also wondering if you have considered the case of
-EEXIST?How is that going to happen? The line before we do
sysfs_add_file(), and if that errors out, then we never make it tolookup_one_len().
well, there is no check in sysfs_add_file() (probably it should have?) for -EEXIST. Till now, the dentry/inode for sysfs files are allocated only when
the file is looked up at the first instance. Where here (for relay files) dentry/inodes are being allocated at the time of creation.
IOW, the check for existing files is being done at the time of
assigning the inode (as in fs/sysfs/inode.c:sysfs_create()) when someone looks for the file.
->sysfs_lookup()-->sysfs_attach_attr()-->sysfs_create()
Quoted 4 lines
The
IS_ERR()check is pretty superfluous anyways, perhaps it makes more sense just to remove it and thesysfs_hash_and_remove()reference entirely.
hmm.. probably not, looks like it is needed. The extra sysfs_dirent which got added in sysfs_add_file() will be removed by sysfs_hash_and_remove() in case of -EEXIST.
Thanks
Maneesh
PS: Sorry for previous message with incorrect reply-to address.
PATCH 2/5 relay: Consolidate relayfs core into kernel/relay.c.
In reply to Paul MundtThis abstracts the core parts needed for relay channel buffer management out of relayfs. With relay_file_operations exported, we can trivially support relay channels through other file systems (like sysfs and debugfs).
While we're at it, get rid of some of the outstanding relayfs references from the code, as there's nothing file system dependent in the new relay abstraction.
---
include/linux/relayfs_fs.h | 3 init/Kconfig | 11 + kernel/Makefile | 1 kernel/relay.c | 919 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 934 insertions(+), 0 deletions(-) create mode 100644 kernel/relay.c
7bf637f67e20f807d5c7ee42390a12bee64b6273
include/linux/relayfs_fs.h +3 -0
@@ -19,6 +19,9 @@#include <linux/poll.h> #include <linux/kref.h> +/* Needs a _much_ better name... */ +#define FIX_SIZE (x) ((((x) - 1) & PAGE_MASK) + PAGE_SIZE) +/* * Tracks changes to rchan/rchan_buf structs */
init/Kconfig +11 -0
@@ -214,6 +214,17 @@ config CPUSETS Say N if unsure. +config RELAY + bool "Kernel->user space relay support (formerly relayfs)" + help + This option enables support for relay interface support in + certain file systems (such as sysfs, and trivially debugfs). + It is designed to provide an efficient mechanism for tools and + facilities to relay large amounts of data from kernel space to + user space. + + If unsure, say N. + source "usr/Kconfig" config UID16
kernel/Makefile +1 -0
@@ -34,6 +34,7 @@ obj-$(CONFIG_DETECT_SOFTLOCKUP) += softl obj-$(CONFIG_GENERIC_HARDIRQS) += irq/ obj-$(CONFIG_SECCOMP) += seccomp.o obj-$(CONFIG_RCU_TORTURE_TEST) += rcutorture.o +obj-$(CONFIG_RELAY) += relay.o ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y) # According to Alan Modra <[email protected]>, the -fno-omit-frame-pointer is
kernel/relay.c new file +919 -0
919 lines not on this page · raw message
Signature · 1 line
1.2.0.geb68
PATCH 3/5 sysfs: Update relay file support for generic relay API.
In reply to Paul MundtNow with the introduction of CONFIG_REPLAY, switch to using that instead of CONFIG_REPLAYFS_FS.
---
fs/sysfs/Makefile | 2 +- fs/sysfs/dir.c | 2 +- include/linux/sysfs.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
299b10030cd85eb20daa5d14cc549cf4902eb372
fs/sysfs/Makefile +1 -1
@@ -4,4 +4,4 @@ obj-y := inode.o file.o dir.o symlink.o mount.o bin.o \ group.o -obj-$(CONFIG_RELAYFS_FS) += relay.o +obj-$(CONFIG_RELAY) += relay.o
fs/sysfs/dir.c +1 -1
@@ -87,7 +87,7 @@ static int init_file(struct inode * inodreturn 0 ; } -#ifdef CONFIG_RELAYFS_FS +#ifdef CONFIG_RELAY static int init_relay_file (struct inode * inode) {extern struct file_operations relay_file_operations;
include/linux/sysfs.h +2 -2
@@ -94,7 +94,7 @@ struct sysfs_dirent {#define SYSFS_NOT_PINNED (SYSFS_KOBJ_ATTR | SYSFS_KOBJ_BIN_ATTR | \ SYSFS_KOBJ_LINK | SYSFS_KOBJ_RELAY_ATTR) -#if defined(CONFIG_RELAYFS_FS ) && defined(CONFIG_SYSFS ) +#if defined(CONFIG_RELAY ) && defined(CONFIG_SYSFS )int sysfs_create_relay_file (struct kobject *,struct relay_attribute *);void sysfs_remove_relay_file (struct kobject *,struct relay_attribute *);#else
@@ -106,7 +106,7 @@ static inline int sysfs_create_relay_filstatic inline void sysfs_remove_relay_file (struct kobject *kobj,struct relay_attribute *attr) { } -#endif /* CONFIG_RELAYFS_FS && CONFIG_SYSFS */ +#endif /* CONFIG_RELAY && CONFIG_SYSFS */ #ifdef CONFIG_SYSFS
Signature · 1 line
1.2.0.geb68
PATCH 4/5 relayfs: Remove relayfs in favour of CONFIG_RELAY.
In reply to Paul MundtNow that the relayfs core is abstracted as CONFIG_RELAY, and sysfs has a method for creating relay channel buffers as an attribute, relayfs can go away.
---
fs/Kconfig | 12 - fs/Makefile | 1 fs/relayfs/Makefile | 4 fs/relayfs/buffers.c | 190 ---------------- fs/relayfs/buffers.h | 12 - fs/relayfs/inode.c | 581 -------------------------------------------------- fs/relayfs/relay.c | 482 ----------------------------------------- fs/relayfs/relay.h | 8 - 8 files changed, 0 insertions(+), 1290 deletions(-) delete mode 100644 fs/relayfs/Makefile delete mode 100644 fs/relayfs/buffers.c delete mode 100644 fs/relayfs/buffers.h delete mode 100644 fs/relayfs/inode.c delete mode 100644 fs/relayfs/relay.c delete mode 100644 fs/relayfs/relay.h
b8eb78a1eee443771abb84e9195a4bc247e29e21
fs/Kconfig +0 -12
@@ -859,18 +859,6 @@ config RAMFS To compile this as a module, choose M here: the module will be called ramfs. -config RELAYFS_FS - tristate "Relayfs file system support" - ---help--- - Relayfs is a high-speed data relay filesystem designed to provide - an efficient mechanism for tools and facilities to relay large - amounts of data from kernel space to user space. - - To compile this code as a module, choose M here: the module will be - called relayfs. - - If unsure, say N. - config CONFIGFS_FS tristate "Userspace-driven configuration filesystem (EXPERIMENTAL)" depends on EXPERIMENTAL
fs/Makefile +0 -1
@@ -91,7 +91,6 @@ obj-$(CONFIG_AUTOFS4_FS) += autofs4/ obj-$(CONFIG_ADFS_FS) += adfs/ obj-$(CONFIG_FUSE_FS) += fuse/ obj-$(CONFIG_UDF_FS) += udf/ -obj-$(CONFIG_RELAYFS_FS) += relayfs/ obj-$(CONFIG_SUN_OPENPROMFS) += openpromfs/ obj-$(CONFIG_JFS_FS) += jfs/ obj-$(CONFIG_XFS_FS) += xfs/
fs/relayfs/Makefile deleted +0 -4
@@ -1,4 +0,0 @@ -obj-$(CONFIG_RELAYFS_FS) += relayfs.o - -relayfs-y := relay.o inode.o buffers.o -
fs/relayfs/buffers.c deleted +0 -190
190 lines not on this page · raw message
fs/relayfs/buffers.h deleted +0 -12
@@ -1,12 +0,0 @@ -#ifndef _BUFFERS_H -#define _BUFFERS_H - -/* This inspired by rtai/shmem */ -#define FIX_SIZE (x) (((x) - 1) & PAGE_MASK) + PAGE_SIZE - -extern int relay_mmap_buf (struct rchan_buf *buf,struct vm_area_struct *vma); -extern struct rchan_buf *relay_create_buf (struct rchan *chan); -extern void relay_destroy_buf (struct rchan_buf *buf); -extern void relay_remove_buf (struct kref *kref); - -#endif /* _BUFFERS_H */
fs/relayfs/inode.c deleted +0 -581
581 lines not on this page · raw message
fs/relayfs/relay.c deleted +0 -482
482 lines not on this page · raw message
fs/relayfs/relay.h deleted +0 -8
@@ -1,8 +0,0 @@ -#ifndef _RELAY_H -#define _RELAY_H - -extern int relayfs_remove (struct dentry *dentry); -extern int relay_buf_empty (struct rchan_buf *buf); -extern void relay_destroy_channel (struct kref *kref); - -#endif /* _RELAY_H */
Signature · 1 line
1.2.0.geb68
PATCH 5/5 relay: relay header cleanup.
In reply to Paul MundtRename relayfs_fs.h to relay.h, drop some left over relayfs cruft, and update the various users of it.
---
fs/sysfs/relay.c | 2 include/linux/relay.h | 281 +++++++++++++++++++++++++++++++++++++++++++ include/linux/relayfs_fs.h | 290 -------------------------------------------- kernel/relay.c | 2 4 files changed, 283 insertions(+), 292 deletions(-) create mode 100644 include/linux/relay.h delete mode 100644 include/linux/relayfs_fs.h
0d40ecc14733fa6f46dd4aa7f9de4e5a9a484d0e
fs/sysfs/relay.c +1 -1
@@ -7,7 +7,7 @@* License. See the file "COPYING" in the main directory of this archive * for more details. */ -#include <linux/relayfs_fs.h> +#include <linux/relay.h> #include <linux/namei.h> #include <linux/module.h> #include "sysfs.h"
include/linux/relay.h new file +281 -0
281 lines not on this page · raw message
include/linux/relayfs_fs.h deleted +0 -290
290 lines not on this page · raw message
kernel/relay.c +1 -1
@@ -15,7 +15,7 @@#include <linux/slab.h> #include <linux/module.h> #include <linux/string.h> -#include <linux/relayfs_fs.h> +#include <linux/relay.h> #include <linux/vmalloc.h> #include <linux/mm.h>
Signature · 1 line
1.2.0.geb68
Quoted 4 lines · Paul Mundt
This is a small patch set for getting rid of relayfs, and moving the core of its functionality to
kernel/relay.c. The API is kept consistent for everything but the relayfs-specific bits, meaning people will have to use other file systems to implement relay channel buffers.
What about the userspace visible API for things already using relayfs, like systemtap ? Whilst technically these patches may make sense, yanking the rug underneath applications as soon as they've started using it without warning or a migration period doesn't sound too good an idea.
It's taken us *years* to try and get rid of devfs, why should relayfs get ripped out any quicker, when it has valid users?
Dave
Quoted 11 lines · Dave Jones
Quoted 4 lines · Paul Mundt
This is a small patch set for getting rid of relayfs, and moving the core of its functionality to
kernel/relay.c. The API is kept consistent for everything but the relayfs-specific bits, meaning people will have to use other file systems to implement relay channel buffers.What about the userspace visible API for things already using relayfs, like systemtap ? Whilst technically these patches may make sense, yanking the rug underneath applications as soon as they've started using it without warning or a migration period doesn't sound too good an idea.
Yes, that's why this is only done in the last two patches. The rest are completely independent and don't interfere with the API (well, ok, FIX_SIZE() needs to be dropped in fs/relayfs if it's fetching it from the header, but that's it).
Quoted 3 lines
It's taken us *years* to try and get rid of devfs, why should relayfs get ripped out any quicker, when it has valid users?
I'm not advocating its removal, I'm more interested in using it from sysfs and debugfs where it makes more sense. Splitting up CONFIG_RELAY and CONFIG_RELAYFS_FS will allow for both, and it'll also be possible to migrate the existing CONFIG_RELAYFS_FS code to use CONFIG_RELAY without breaking the userspace APIs if we want to get rid of the duplication. The only issue will be wrapping up the default callbacks, but that's a trivial ifdef.
PATCH 1/1 relayfs: Convert to generic relay API.
Quoted 20 lines · Paul Mundt
Quoted 11 lines · Dave Jones
Quoted 4 lines · Paul Mundt
This is a small patch set for getting rid of relayfs, and moving the core of its functionality to
kernel/relay.c. The API is kept consistent for everything but the relayfs-specific bits, meaning people will have to use other file systems to implement relay channel buffers.What about the userspace visible API for things already using relayfs, like systemtap ? Whilst technically these patches may make sense, yanking the rug underneath applications as soon as they've started using it without warning or a migration period doesn't sound too good an idea.
Yes, that's why this is only done in the last two patches. The rest are completely independent and don't interfere with the API (well, ok,
FIX_SIZE()needs to be dropped in fs/relayfs if it's fetching it from the header, but that's it).Quoted 3 lines
It's taken us *years* to try and get rid of devfs, why should relayfs get ripped out any quicker, when it has valid users?
Quoted 7 lines
I'm not advocating its removal, I'm more interested in using it from sysfs and debugfs where it makes more sense. Splitting up
CONFIG_RELAYandCONFIG_RELAYFS_FSwill allow for both, and it'll also be possible to migrate the existingCONFIG_RELAYFS_FScode to useCONFIG_RELAYwithout breaking the userspace APIs if we want to get rid of the duplication. The only issue will be wrapping up the default callbacks, but that's a trivial ifdef.
And here's a patch doing that.. any other objections?
This strips down relayfs to a minimum, removing everything already provided by CONFIG_RELAY. This leaves a userspace API compatible implementation on top of the new framework.
---
fs/Kconfig | 1 fs/relayfs/Makefile | 3 fs/relayfs/buffers.c | 190 ----------------- fs/relayfs/buffers.h | 12 - fs/relayfs/inode.c | 269 ------------------------- fs/relayfs/relay.c | 482 -------------------------------------------- fs/relayfs/relay.h | 8 - include/linux/relayfs_fs.h | 1 kernel/relay.c | 9 + 9 files changed, 12 insertions(+), 963 deletions(-) delete mode 100644 fs/relayfs/buffers.c delete mode 100644 fs/relayfs/buffers.h delete mode 100644 fs/relayfs/relay.c delete mode 100644 fs/relayfs/relay.h
51d322e2944117ed6c01b79b73e18f15c2b8d09e
fs/Kconfig +1 -0
@@ -861,6 +861,7 @@ config RAMFS config RELAYFS_FS tristate "Relayfs file system support" + select RELAY ---help--- Relayfs is a high-speed data relay filesystem designed to provide an efficient mechanism for tools and facilities to relay large
fs/relayfs/Makefile +1 -2
@@ -1,4 +1,3 @@ obj-$(CONFIG_RELAYFS_FS) += relayfs.o -relayfs-y := relay.o inode.o buffers.o - +relayfs-y := inode.o
fs/relayfs/buffers.c deleted +0 -190
190 lines not on this page · raw message
fs/relayfs/buffers.h deleted +0 -12
@@ -1,12 +0,0 @@ -#ifndef _BUFFERS_H -#define _BUFFERS_H - -/* This inspired by rtai/shmem */ -#define FIX_SIZE (x) (((x) - 1) & PAGE_MASK) + PAGE_SIZE - -extern int relay_mmap_buf (struct rchan_buf *buf,struct vm_area_struct *vma); -extern struct rchan_buf *relay_create_buf (struct rchan *chan); -extern void relay_destroy_buf (struct rchan_buf *buf); -extern void relay_remove_buf (struct kref *kref); - -#endif /* _BUFFERS_H */
fs/relayfs/inode.c +0 -269
293 lines not on this page · raw message
fs/relayfs/relay.c deleted +0 -482
482 lines not on this page · raw message
fs/relayfs/relay.h deleted +0 -8
@@ -1,8 +0,0 @@ -#ifndef _RELAY_H -#define _RELAY_H - -extern int relayfs_remove (struct dentry *dentry); -extern int relay_buf_empty (struct rchan_buf *buf); -extern void relay_destroy_channel (struct kref *kref); - -#endif /* _RELAY_H */
include/linux/relayfs_fs.h +1 -0
@@ -183,6 +183,7 @@ extern struct dentry *relayfs_create_filstruct file_operations *fops, void *data);extern int relayfs_remove_file (struct dentry *dentry); +extern int relayfs_remove (struct dentry *dentry);/** * relay_write - write data into the channel
kernel/relay.c +9 -0
@@ -278,7 +278,12 @@ static struct dentry *create_buf_file_destruct rchan_buf *buf, int *is_global) { +#ifdef CONFIG_RELAYFS_FS + return relayfs_create_file(filename, parent, mode, + &relay_file_operations, buf); +#else return NULL ; +#endif }/*
@@ -286,7 +291,11 @@ static struct dentry *create_buf_file_de*/ static int remove_buf_file_default_callback (struct dentry *dentry) { +#ifdef CONFIG_RELAYFS_FS +return relayfs_remove (dentry); +#else return -EINVAL ; +#endif }/* relay channel default callbacks */
Signature · 1 line
1.0.GIT
Re: [PATCH] relayfs: Convert to generic relay API.
Quoted 3 lines · Paul Mundt
This strips down relayfs to a minimum, removing everything already provided by
CONFIG_RELAY. This leaves a userspace API compatible implementation on top of the new framework.
not needed given there's no user yet.
Quoted 7 lines · Dave Jones
Quoted 4 lines · Paul Mundt
This is a small patch set for getting rid of relayfs, and moving the core of its functionality to
kernel/relay.c. The API is kept consistent for everything but the relayfs-specific bits, meaning people will have to use other file systems to implement relay channel buffers.What about the userspace visible API for things already using relayfs,
There's no existing in-tree user of relayfs.
Quoted 2 lines · Christoph Hellwig
Quoted 1 line
What about the userspace visible API for things already using relayfs,
There's no existing in-tree user of relayfs.
wtf ? since when has userspace been 'in-tree' ?
Dave
Quoted 6 lines · Dave Jones
Quoted 2 lines · Christoph Hellwig
Quoted 1 line
What about the userspace visible API for things already using relayfs,
There's no existing in-tree user of relayfs.
wtf ? since when has userspace been 'in-tree' ?
relayfs is a kernel component. to create any user-visible thing in relayfs
some kernel components needs to use it. no single kernel component does currently, and the we've only put it in after Andrew agreed that this won't stop us fixing things in just because it's in yet in the long discussion we had
before merging it.
Quoted 11 lines · Christoph Hellwig
Quoted 6 lines · Dave Jones
Quoted 2 lines · Christoph Hellwig
Quoted 1 line
What about the userspace visible API for things already using relayfs,
There's no existing in-tree user of relayfs.
wtf ? since when has userspace been 'in-tree' ?
relayfs is a kernel component. to create any user-visible thing in relayfs some kernel components needs to use it. no single kernel component does currently
systemtap uses kprobes to export data through relayfs.
Dave
Quoted 1 line · Dave Jones
systemtap uses kprobes to export data through relayfs.
systemtap has never been anywhere near mainline despit me telling the ibm folks to get the non-braindead parts in, so it simply doesn't matter.
Quoted 5 lines · Christoph Hellwig
Quoted 1 line · Dave Jones
systemtap uses kprobes to export data through relayfs.
systemtap has never been anywhere near mainline despit me telling the ibm folks to get the non-braindead parts in, so it simply doesn't matter.
the kernel bits that matter are generated at runtime. I don't see anything particularly interesting in the source tree that is worthwhile submitting.
Dave
Quoted 10 lines · Dave Jones
Quoted 5 lines · Christoph Hellwig
Quoted 1 line · Dave Jones
systemtap uses kprobes to export data through relayfs.
systemtap has never been anywhere near mainline despit me telling the ibm folks to get the non-braindead parts in, so it simply doesn't matter.
the kernel bits that matter are generated at runtime. I don't see anything particularly interesting in the source tree that is worthwhile submitting.
Various helpers to write kprobes in C, instead of the funky limited functionality scripting language of the day.
But anyway, if systemtap folks really need a relayfs filesystem type they're totally free under the gpl to grab the code Paul posted to recreate relayfs ontop of kernel/relay.c and include it in their codebase, no need to bloat the kernel tree with unused code.
Quoted 7 lines · Christoph Hellwig
[...]
Quoted 3 lines
the kernel bits that matter are generated at runtime. I don't see anything particularly interesting in the [systemtap] source tree that is worthwhile submitting.
Various helpers to write kprobes in C, instead of the funky limited functionality scripting language of the day. [...]
The point of the scripting language is to be safe yet expressive. If you or others have any specific criticisms or ideas, they are welcome over on the [email protected] mailing list.
- FChE