From patchwork Tue Feb 19 11:51:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 10819723 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CC3DA139A for ; Tue, 19 Feb 2019 11:51:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B73B72BA98 for ; Tue, 19 Feb 2019 11:51:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5B412BAA4; Tue, 19 Feb 2019 11:51:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC51D2BA98 for ; Tue, 19 Feb 2019 11:51:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726180AbfBSLvp (ORCPT ); Tue, 19 Feb 2019 06:51:45 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:40769 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725772AbfBSLvp (ORCPT ); Tue, 19 Feb 2019 06:51:45 -0500 Received: by mail-wm1-f68.google.com with SMTP id t15so2263401wmi.5 for ; Tue, 19 Feb 2019 03:51:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=plexistor-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MBejWD2Hjns8Gvmye5hi9m34TL699KIeFvv9VnsYx+A=; b=dby6206yutWM/vsB5VO/C3dvHAbs87TJ/n7EAVLuEuMKigd/6rqSSDG/TNusGyhNks amTTtzLAlXJimtS7/Xs/9jujOPtAf6BRq3nHNPU0JWiOIGmpbsX8qurbS7eNCVGzhkYL ul7wejTGOj5ikic4/iqHzdMZUcwf3pL4/GV1OpHk6is9Fi+B4Ys8e5Vp/F03/WS3jUU0 mBldeyXZWQ+bZCRA6V5fL29B6imt+RrgdMdib4FH2jfndlA2on8OUqKVcBrLMYGlMWNB dgWC0oaq7nLVZl1CMmYwAhpTF8eMcKwY6djGMCmj/OUpoMf0nVyeRQpOgDs6RR/PVxpO gvnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MBejWD2Hjns8Gvmye5hi9m34TL699KIeFvv9VnsYx+A=; b=Q7aBsJCtCOjcsSbdjQdbIvkXY5hGDsbwHWfHlFUw2pJAEfOBnAGfh95auwi4hE3aSD WH3mJwe6Rx+1aIXa+ysoWokXUFH3N3b3bfyD/kzyvsKyVnRFs8FRD49E2BT3Sx9A2ZE4 sdNqVWk1PIT6wKWCwROfVWBT+vN0x4xRm0HfUV98am3ztfxHMzQ6ffEoxkob55lVls3L 3KU3JyRMlhoIEkafxRu+qgbnkhdm+t3vNcDPRSD1NoJHtK1mKA0TEJBeR4u1lpeviJvX v/QcriD5iI34HzAPUF7h1B+F7FhDhOJe4kSoHcDxPNbTUfp6yZzonAwncqQ9Rl2MRG+f LGjw== X-Gm-Message-State: AHQUAuasxA67wih4Htyd0r9+xWrtpbF8lH6m+eVZYMi4w6CxPLaQNP9s nrjKms5r0vng/2a298+rfA9EcIgYEj4= X-Google-Smtp-Source: AHgI3IbjE/lwQpttUl5eVhnb6y1VP8AhXXYBkGWv2T26RhYKOl/lede2n+P3HLpr3IVlcZvFiTu1bQ== X-Received: by 2002:a1c:7809:: with SMTP id t9mr2533616wmc.78.1550577102091; Tue, 19 Feb 2019 03:51:42 -0800 (PST) Received: from Bfire.plexistor.com ([207.232.55.62]) by smtp.gmail.com with ESMTPSA id t18sm3605830wmt.8.2019.02.19.03.51.40 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 19 Feb 2019 03:51:41 -0800 (PST) From: Boaz harrosh To: linux-fsdevel , Anna Schumaker , Al Viro Cc: Ric Wheeler , Miklos Szeredi , Steven Whitehouse , Jefff moyer , Amir Goldstein , Amit Golander , Sagi Manole Subject: [RFC PATCH 01/17] fs: Add the ZUF filesystem to the build + License Date: Tue, 19 Feb 2019 13:51:20 +0200 Message-Id: <20190219115136.29952-2-boaz@plexistor.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190219115136.29952-1-boaz@plexistor.com> References: <20190219115136.29952-1-boaz@plexistor.com> MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Boaz Harrosh 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 --- 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 + 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 . + */ +#include + +#include "zus_api.h" + +MODULE_AUTHOR("Boaz Harrosh "); +MODULE_AUTHOR("Sagi Manole "); +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 + * Sagi Manole " + */ +#ifndef _LINUX_ZUFS_API_H +#define _LINUX_ZUFS_API_H + +#include +#include +#include +#include + +/* + * 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 + +#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 */