On Tue, 2019-02-19 at 13:51 +0200, Boaz harrosh wrote: > NetApp Security WARNING: This is an external email. Do not click links or open > attachments unless you recognize the sender and know the content is safe. > > > > > From: Boaz Harrosh <boazh@xxxxxxxxxx> > > This adds the ZUF filesystem-in-user_mode module to the > fs/ build system. > > Also added: > * fs/zuf/Kconfig > * fs/zuf/module.c - This file contains the LICENCE > of zuf code base > * fs/zuf/Makefile - Rather empty Makefile with only > module.c above > > I add the fs/zuf/Makefile to demonstrate that at every > patchset stage code still compiles and there are no external > references outside of the code already submitted. > > Off course only at the very last patch we have a working > ZUF feeder > > [LICENCE] > > zuf.ko is a GPLv2 licensed project. > > However the ZUS user mode Server is a BSD-3-Clause licensed > project. > Therefor you will see that: > zus_api.h > md_def.h > md.h > These are common files with ZUS project are separately Licensed as > BSD-3-Clause. Any contributor to these files should note that his > code for these files is submitted as BSD-3-Clause. > This is for the obvious reasons as these define the API between Kernel > an user-mode Server. It is the opinion of this project authors, as is > of Linus that a pure API header is not governed by ANY license. But > to make it clear. > > Signed-off-by: Boaz Harrosh <boazh@xxxxxxxxxx> > --- > fs/Kconfig | 1 + > fs/Makefile | 1 + > fs/zuf/Kconfig | 28 ++++++++++++++++++++ > fs/zuf/Makefile | 14 ++++++++++ > fs/zuf/module.c | 28 ++++++++++++++++++++ > fs/zuf/zus_api.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ > 6 files changed, 141 insertions(+) > create mode 100644 fs/zuf/Kconfig > create mode 100644 fs/zuf/Makefile > create mode 100644 fs/zuf/module.c > create mode 100644 fs/zuf/zus_api.h > > diff --git a/fs/Kconfig b/fs/Kconfig > index ac474a61be37..5b23bb58e902 100644 > --- a/fs/Kconfig > +++ b/fs/Kconfig > @@ -254,6 +254,7 @@ source "fs/romfs/Kconfig" > source "fs/pstore/Kconfig" > source "fs/sysv/Kconfig" > source "fs/ufs/Kconfig" > +source "fs/zuf/Kconfig" > source "fs/exofs/Kconfig" > > endif # MISC_FILESYSTEMS > diff --git a/fs/Makefile b/fs/Makefile > index 293733f61594..168f178a7c89 100644 > --- a/fs/Makefile > +++ b/fs/Makefile > @@ -128,3 +128,4 @@ obj-y += exofs/ # Multiple > modules > obj-$(CONFIG_CEPH_FS) += ceph/ > obj-$(CONFIG_PSTORE) += pstore/ > obj-$(CONFIG_EFIVAR_FS) += efivarfs/ > +obj-$(CONFIG_ZUF) += zuf/ > diff --git a/fs/zuf/Kconfig b/fs/zuf/Kconfig > new file mode 100644 > index 000000000000..19fff3b75b69 > --- /dev/null > +++ b/fs/zuf/Kconfig > @@ -0,0 +1,28 @@ > +menuconfig ZUF Shouldn't this be "CONFIG_ZUF_FS" to stay consistent with other filesystems? > + tristate "ZUF - Zero-copy User-mode Feeder" > + depends on BLOCK > + depends on ZONE_DEVICE > + select CRC16 > + select MEMCG > + help > + ZUFS Kernel part. > + To enable say Y here. > + > + To compile this as a module, choose M here: the module will be > + called zuf.ko > + > +if ZUF > + > +config ZUF_DEBUG > + bool "ZUF: enable debug subsystems use" > + depends on ZUF > + default n > + help > + INTERNAL QA USE ONLY!!! DO NOT USE!!! > + Please leave as N here > + > + This option adds some extra code that helps > + in QA testing of the code. It may slow the > + operation and produce bigger code > + > +endif > diff --git a/fs/zuf/Makefile b/fs/zuf/Makefile > new file mode 100644 > index 000000000000..e75ba8a77974 > --- /dev/null > +++ b/fs/zuf/Makefile > @@ -0,0 +1,14 @@ > +# > +# ZUF: Zero-copy User-mode Feeder > +# > +# Copyright (c) 2018 NetApp Inc. All rights reserved. > +# > +# ZUFS-License: GPL-2.0. See module.c for LICENSE details. > +# > +# Makefile for the Linux zufs Kernel Feeder. > +# > + > +obj-$(CONFIG_ZUF) += zuf.o > + > +# Main FS > +zuf-y += module.o > diff --git a/fs/zuf/module.c b/fs/zuf/module.c > new file mode 100644 > index 000000000000..523633c1bf9d > --- /dev/null > +++ b/fs/zuf/module.c > @@ -0,0 +1,28 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * zuf - Zero-copy User-mode Feeder > + * > + * Copyright (c) 2018 NetApp Inc. All rights reserved. > + * > + * This program is free software; you may redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; version 2 of the License. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program. If not, see <https://www.gnu.org/licenses/>;. > + */ > +#include <linux/module.h> > + > +#include "zus_api.h" > + > +MODULE_AUTHOR("Boaz Harrosh <boazh@xxxxxxxxxx>"); > +MODULE_AUTHOR("Sagi Manole <sagim@xxxxxxxxxx>"); > +MODULE_DESCRIPTION("Zero-copy User-mode Feeder"); > +MODULE_LICENSE("GPL"); > +MODULE_VERSION(__stringify(ZUFS_MAJOR_VERSION) "." > + __stringify(ZUFS_MINOR_VERSION)); > diff --git a/fs/zuf/zus_api.h b/fs/zuf/zus_api.h > new file mode 100644 > index 000000000000..f01db11721f4 > --- /dev/null > +++ b/fs/zuf/zus_api.h > @@ -0,0 +1,69 @@ > +/* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */ > +/* > + * zufs_api.h: > + * ZUFS (Zero-copy User-mode File System) is: > + * zuf (Zero-copy User-mode Feeder (Kernel)) + > + * zus (Zero-copy User-mode Server (daemon)) > + * > + * Copyright (c) 2018 NetApp Inc. All rights reserved. > + * > + * Authors: > + * Boaz Harrosh <boazh@xxxxxxxxxx> > + * Sagi Manole <sagim@xxxxxxxxxx>" > + */ > +#ifndef _LINUX_ZUFS_API_H > +#define _LINUX_ZUFS_API_H > + > +#include <linux/types.h> > +#include <linux/uuid.h> > +#include <stddef.h> > +#include <linux/statfs.h> > + > +/* > + * Version rules: > + * This is the zus-to-zuf API version. And not the Filesystem > + * on disk structures versions. These are left to the FS-plugging > + * to supply and check. > + * Specifically any of the API structures and constants found in this > + * file. > + * If the changes are made in a way backward compatible with old > + * user-space, MINOR is incremented. Else MAJOR is incremented. > + * > + * We believe that the zus Server application comes with the > + * Distro and should be dependent on the Kernel package. > + * (In rhel they are both in the same package) > + * > + * The more stable ABI is between the zus Server and its FS plugins. > + */ > +#define ZUFS_MINORS_PER_MAJOR 1024 > +#define ZUFS_MAJOR_VERSION 1 > +#define ZUFS_MINOR_VERSION 0 > + > +/* User space compatibility definitions */ > +#ifndef __KERNEL__ > + > +#include <string.h> > + > +#define u8 uint8_t > +#define umode_t uint16_t > + > +#define PAGE_SHIFT 12 > +#define PAGE_SIZE (1 << PAGE_SHIFT) > + > +#ifndef __packed > +# define __packed __attribute__((packed)) > +#endif > + > +#ifndef ALIGN > +#define ALIGN(x, a) ALIGN_MASK(x, (typeof(x))(a) - 1) > +#define ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) > +#endif > + > +/* RHEL/CentOS7 specifics */ > +#ifndef FALLOC_FL_UNSHARE_RANGE > +#define FALLOC_FL_UNSHARE_RANGE 0x40 > +#endif > + > +#endif /* ndef __KERNEL__ */ > + > +#endif /* _LINUX_ZUFS_API_H */ > -- > 2.20.1 >