diff mbox series

[RFC,01/17] fs: Add the ZUF filesystem to the build + License

Message ID 20190219115136.29952-2-boaz@plexistor.com (mailing list archive)
State New, archived
Headers show
Series zuf: ZUFS Zero-copy User-mode FileSystem | expand

Commit Message

Boaz Harrosh Feb. 19, 2019, 11:51 a.m. UTC
From: Boaz Harrosh <boazh@netapp.com>

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@netapp.com>
---
 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

Comments

Greg Kroah-Hartman Feb. 20, 2019, 11:03 a.m. UTC | #1
On Tue, Feb 19, 2019 at 01:51:20PM +0200, Boaz harrosh wrote:
>   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.

No, that is not true, the files do have a license.  Please see the
proper SPDX text that we use for kernel api .h files for what that is,
and what you should also use for yours, if you go through with this.

thanks,

greg k-h
Boaz Harrosh Feb. 20, 2019, 2:55 p.m. UTC | #2
On 20/02/19 13:03, Greg KH wrote:
> On Tue, Feb 19, 2019 at 01:51:20PM +0200, Boaz harrosh wrote:
>>   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.
> 
> No, that is not true, the files do have a license.  Please see the
> proper SPDX text that we use for kernel api .h files for what that is,
> and what you should also use for yours, if you go through with this.
> 

OK Good I understand more now. I looked at UAPI/ headers and read the
docs you mentioned.

Please help me nail this properly. I will change these headers to be:

/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note AND BSD-3-Clause */
(I will also change the message text to reflect this conversation)

My motivation is that those Interface HEADERS can also be used in proprietary
OSs as Macosx and Windows. To compile the ZUS Server application project which
is licensed as SPDX BSD-3-Clause.

So I changed the OR to an AND right? Is it now clear that anyone adding
new API interface like new operations. Understand that this applies also
to BSD-3-Clause projects?

> thanks,
> greg k-h

Thanks very much for looking
Boaz
Greg Kroah-Hartman Feb. 20, 2019, 7:40 p.m. UTC | #3
On Wed, Feb 20, 2019 at 04:55:19PM +0200, Boaz Harrosh wrote:
> On 20/02/19 13:03, Greg KH wrote:
> > On Tue, Feb 19, 2019 at 01:51:20PM +0200, Boaz harrosh wrote:
> >>   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.
> > 
> > No, that is not true, the files do have a license.  Please see the
> > proper SPDX text that we use for kernel api .h files for what that is,
> > and what you should also use for yours, if you go through with this.
> > 
> 
> OK Good I understand more now. I looked at UAPI/ headers and read the
> docs you mentioned.
> 
> Please help me nail this properly. I will change these headers to be:
> 
> /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note AND BSD-3-Clause */
> (I will also change the message text to reflect this conversation)
> 
> My motivation is that those Interface HEADERS can also be used in proprietary
> OSs as Macosx and Windows. To compile the ZUS Server application project which
> is licensed as SPDX BSD-3-Clause.

You are asking legal questions to a technical person?  Would you ask
medical questions to a lawyer?

Consult your lawyers please, they know the answers to this.

And if they do not, go find your corporate lawyers who do.

Hint, as a test, ask them why what you wrote as a suggested SPDX line
above makes no sense :)

good luck!

greg k-h
Schumaker, Anna Feb. 26, 2019, 5:55 p.m. UTC | #4
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@netapp.com>
> 
> 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@netapp.com>
> ---
>  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@netapp.com>");
> +MODULE_AUTHOR("Sagi Manole <sagim@netapp.com>");
> +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@netapp.com>
> + *     Sagi Manole <sagim@netapp.com>"
> + */
> +#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
>
Boaz Harrosh Feb. 28, 2019, 4:42 p.m. UTC | #5
On 26/02/19 19:55, Schumaker, Anna wrote:
> On Tue, 2019-02-19 at 13:51 +0200, Boaz harrosh wrote:
<>
>> 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?
> 

Totally sure will change maybe ZUFS though? I'll look what's common

>> +       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
>> +
<>
diff mbox series

Patch

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
+	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@netapp.com>");
+MODULE_AUTHOR("Sagi Manole <sagim@netapp.com>");
+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@netapp.com>
+ *	Sagi Manole <sagim@netapp.com>"
+ */
+#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 */