fs/fuse kio: export fastpath protocol version

Submitted by Pavel Butsykin on April 11, 2019, 11:41 a.m.

Details

Message ID 20190411114152.29225-1-pbutsykin@virtuozzo.com
State New
Series "fs/fuse kio: export fastpath protocol version"
Headers show

Commit Message

Pavel Butsykin April 11, 2019, 11:41 a.m.
In order to transfer the logic of the fallback decision to user-space,
let's add export fastpath version.

#PSBM-93637

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 6 ++++++
 fs/fuse/kio/pcs/pcs_ioctl.h        | 2 +-
 fs/fuse/kio/pcs/pcs_prot_types.h   | 9 ++++++---
 3 files changed, 13 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
index 3b1d819792b2..002eaae18687 100644
--- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
+++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
@@ -31,6 +31,10 @@  unsigned int pcs_loglevel = LOG_TRACE;
 module_param(pcs_loglevel, uint, 0644);
 MODULE_PARM_DESC(pcs_loglevel, "Trace level");
 
+u64 fast_path_version;
+module_param(fast_path_version, ullong, 0444);
+MODULE_PARM_DESC(fast_path_version, "Fast path protocol version");
+
 #ifdef CONFIG_DEBUG_KERNEL
 static int set_sockio_fail_percent(const char *val, struct kernel_param *kp)
 {
@@ -1509,6 +1513,8 @@  static int __init kpcs_mod_init(void)
 	if (!pcs_cleanup_wq)
 		goto free_wq;
 
+	fast_path_version = PCS_FAST_PATH_VERSION.full;
+
 	if (fuse_register_kio(&kio_pcs_ops))
 		goto free_cleanup_wq;
 
diff --git a/fs/fuse/kio/pcs/pcs_ioctl.h b/fs/fuse/kio/pcs/pcs_ioctl.h
index 5cf40e35f881..6da5ceb03122 100644
--- a/fs/fuse/kio/pcs/pcs_ioctl.h
+++ b/fs/fuse/kio/pcs/pcs_ioctl.h
@@ -10,7 +10,7 @@ 
 #include "pcs_map.h"
 #include "pcs_rpc.h"
 
-#define PCS_FAST_PATH_VERSION ((PCS_FAST_PATH_VERSION_T){1, 2})
+#define PCS_FAST_PATH_VERSION ((PCS_FAST_PATH_VERSION_T){{1, 2}})
 
 #define PCS_FUSE_INO_SPECIAL_ ((unsigned long long)-0x1000)
 
diff --git a/fs/fuse/kio/pcs/pcs_prot_types.h b/fs/fuse/kio/pcs/pcs_prot_types.h
index 9db4516824aa..268701511457 100644
--- a/fs/fuse/kio/pcs/pcs_prot_types.h
+++ b/fs/fuse/kio/pcs/pcs_prot_types.h
@@ -73,9 +73,12 @@  typedef u64 PCS_CHUNK_UID_T;
 typedef u64 PCS_LEASE_GEN_T;
 typedef u32 PCS_POLICY_GEN_T;
 
-typedef struct {
-	u32 major;
-	u32 minor;
+typedef union {
+	struct {
+		u32 major;
+		u32 minor;
+	};
+	u64 full;
 } PCS_FAST_PATH_VERSION_T;
 
 /*

Comments

Andrey Zaitsev April 11, 2019, 12:24 p.m.
ok for me
11.04.2019 14:41, Pavel Butsykin пишет:
> In order to transfer the logic of the fallback decision to user-space,
> let's add export fastpath version.
>
> #PSBM-93637
>
> Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
> ---
>   fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 6 ++++++
>   fs/fuse/kio/pcs/pcs_ioctl.h        | 2 +-
>   fs/fuse/kio/pcs/pcs_prot_types.h   | 9 ++++++---
>   3 files changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
> index 3b1d819792b2..002eaae18687 100644
> --- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
> +++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
> @@ -31,6 +31,10 @@ unsigned int pcs_loglevel = LOG_TRACE;
>   module_param(pcs_loglevel, uint, 0644);
>   MODULE_PARM_DESC(pcs_loglevel, "Trace level");
>   
> +u64 fast_path_version;
> +module_param(fast_path_version, ullong, 0444);
> +MODULE_PARM_DESC(fast_path_version, "Fast path protocol version");
> +
>   #ifdef CONFIG_DEBUG_KERNEL
>   static int set_sockio_fail_percent(const char *val, struct kernel_param *kp)
>   {
> @@ -1509,6 +1513,8 @@ static int __init kpcs_mod_init(void)
>   	if (!pcs_cleanup_wq)
>   		goto free_wq;
>   
> +	fast_path_version = PCS_FAST_PATH_VERSION.full;
> +
>   	if (fuse_register_kio(&kio_pcs_ops))
>   		goto free_cleanup_wq;
>   
> diff --git a/fs/fuse/kio/pcs/pcs_ioctl.h b/fs/fuse/kio/pcs/pcs_ioctl.h
> index 5cf40e35f881..6da5ceb03122 100644
> --- a/fs/fuse/kio/pcs/pcs_ioctl.h
> +++ b/fs/fuse/kio/pcs/pcs_ioctl.h
> @@ -10,7 +10,7 @@
>   #include "pcs_map.h"
>   #include "pcs_rpc.h"
>   
> -#define PCS_FAST_PATH_VERSION ((PCS_FAST_PATH_VERSION_T){1, 2})
> +#define PCS_FAST_PATH_VERSION ((PCS_FAST_PATH_VERSION_T){{1, 2}})
>   
>   #define PCS_FUSE_INO_SPECIAL_ ((unsigned long long)-0x1000)
>   
> diff --git a/fs/fuse/kio/pcs/pcs_prot_types.h b/fs/fuse/kio/pcs/pcs_prot_types.h
> index 9db4516824aa..268701511457 100644
> --- a/fs/fuse/kio/pcs/pcs_prot_types.h
> +++ b/fs/fuse/kio/pcs/pcs_prot_types.h
> @@ -73,9 +73,12 @@ typedef u64 PCS_CHUNK_UID_T;
>   typedef u64 PCS_LEASE_GEN_T;
>   typedef u32 PCS_POLICY_GEN_T;
>   
> -typedef struct {
> -	u32 major;
> -	u32 minor;
> +typedef union {
> +	struct {
> +		u32 major;
> +		u32 minor;
> +	};
> +	u64 full;
>   } PCS_FAST_PATH_VERSION_T;
>   
>   /*