From 6eaff8c7775abcdff5ba7c9f0305f4ccdca57ba5 Mon Sep 17 00:00:00 2001 From: Martin Brandenburg Date: Tue, 2 Aug 2016 14:31:05 -0400 Subject: orangefs: rename remaining bits of mmap readahead cache This has been dormant code for many years. Parts of it were removed from the OrangeFS kernel code when it went into mainline. These bits were missed. Now the readahead cache has been resurrected in the OrangeFS userspace portions. It was renamed there, since it doesn't really have anything to do with mmap specifically, so it will be renamed here. Signed-off-by: Martin Brandenburg --- fs/orangefs/upcall.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fs/orangefs/upcall.h') diff --git a/fs/orangefs/upcall.h b/fs/orangefs/upcall.h index 001b20239407..93965fb484e9 100644 --- a/fs/orangefs/upcall.h +++ b/fs/orangefs/upcall.h @@ -98,7 +98,7 @@ struct orangefs_truncate_request_s { __s64 size; }; -struct orangefs_mmap_ra_cache_flush_request_s { +struct orangefs_ra_cache_flush_request_s { struct orangefs_object_kref refn; }; @@ -228,7 +228,7 @@ struct orangefs_upcall_s { struct orangefs_rename_request_s rename; struct orangefs_statfs_request_s statfs; struct orangefs_truncate_request_s truncate; - struct orangefs_mmap_ra_cache_flush_request_s ra_cache_flush; + struct orangefs_ra_cache_flush_request_s ra_cache_flush; struct orangefs_fs_mount_request_s fs_mount; struct orangefs_fs_umount_request_s fs_umount; struct orangefs_getxattr_request_s getxattr; -- cgit v1.2.3 From a6dff80a964176daca0d41492a6ca280d2246324 Mon Sep 17 00:00:00 2001 From: Martin Brandenburg Date: Tue, 2 Aug 2016 16:33:00 -0400 Subject: orangefs: add missing param request ops Signed-off-by: Martin Brandenburg --- fs/orangefs/upcall.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'fs/orangefs/upcall.h') diff --git a/fs/orangefs/upcall.h b/fs/orangefs/upcall.h index 93965fb484e9..03a4360dcd38 100644 --- a/fs/orangefs/upcall.h +++ b/fs/orangefs/upcall.h @@ -179,6 +179,9 @@ enum orangefs_param_request_op { ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT = 23, ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_RECLAIM_PERCENTAGE = 24, ORANGEFS_PARAM_REQUEST_OP_TWO_MASK_VALUES = 25, + ORANGEFS_PARAM_REQUEST_OP_READAHEAD_SIZE = 26, + ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT = 27, + ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE = 28, }; struct orangefs_param_request_s { -- cgit v1.2.3 From 680908e5046bdd37a678691d881d98486c3e9a53 Mon Sep 17 00:00:00 2001 From: Martin Brandenburg Date: Tue, 2 Aug 2016 16:33:34 -0400 Subject: orangefs: turn param response value into union This will support a upcoming request where two related values need to be updated atomically. This was done without a union in the OrangeFS server source already. Since that will break the kernel protocol, it has been fixed there and done here in a way that does not break the kernel protocol. Signed-off-by: Martin Brandenburg --- fs/orangefs/downcall.h | 5 ++++- fs/orangefs/orangefs-sysfs.c | 8 +++----- fs/orangefs/upcall.h | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-) (limited to 'fs/orangefs/upcall.h') diff --git a/fs/orangefs/downcall.h b/fs/orangefs/downcall.h index 66b99210f1f9..db6e8722a89e 100644 --- a/fs/orangefs/downcall.h +++ b/fs/orangefs/downcall.h @@ -83,7 +83,10 @@ struct orangefs_listxattr_response { }; struct orangefs_param_response { - __s64 value; + union { + __s64 value64; + __s32 value32[2]; + } u; }; #define PERF_COUNT_BUF_SIZE 4096 diff --git a/fs/orangefs/orangefs-sysfs.c b/fs/orangefs/orangefs-sysfs.c index 375708c2db87..044ca6506775 100644 --- a/fs/orangefs/orangefs-sysfs.c +++ b/fs/orangefs/orangefs-sysfs.c @@ -949,10 +949,8 @@ static int sysfs_service_op_show(char *kobj_id, char *buf, void *attr) out: if (!rc) { if (strcmp(kobj_id, PC_KOBJ_ID)) { - rc = scnprintf(buf, - PAGE_SIZE, - "%d\n", - (int)new_op->downcall.resp.param.value); + rc = scnprintf(buf, PAGE_SIZE, "%d\n", + (int)new_op->downcall.resp.param.u.value64); } else { rc = scnprintf( buf, @@ -1277,7 +1275,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_SET; - new_op->upcall.req.param.value = val; + new_op->upcall.req.param.u.value64 = val; /* * The service_operation will return a errno return code on diff --git a/fs/orangefs/upcall.h b/fs/orangefs/upcall.h index 03a4360dcd38..7c29fdf08ec5 100644 --- a/fs/orangefs/upcall.h +++ b/fs/orangefs/upcall.h @@ -187,7 +187,10 @@ enum orangefs_param_request_op { struct orangefs_param_request_s { enum orangefs_param_request_type type; enum orangefs_param_request_op op; - __s64 value; + union { + __s64 value64; + __s32 value32[2]; + } u; char s_value[ORANGEFS_MAX_DEBUG_STRING_LEN]; }; -- cgit v1.2.3 From 482664ddba81b3a5404fd083bb9697dfffc0b6a4 Mon Sep 17 00:00:00 2001 From: Martin Brandenburg Date: Fri, 12 Aug 2016 12:02:31 -0400 Subject: orangefs: add features op This is a new userspace operation, which will be done if the client-core version is greater than or equal to 2.9.6. This will provide a way to implement optional features and to determine which features are supported by the client-core. If the client-core version is older than 2.9.6, no optional features are supported and the op will not be done. The intent is to allow protocol extensions without relying on the client-core's current behavior of ignoring what it doesn't understand. Signed-off-by: Martin Brandenburg --- fs/orangefs/devorangefs-req.c | 10 +++++----- fs/orangefs/downcall.h | 6 ++++++ fs/orangefs/orangefs-cache.c | 2 ++ fs/orangefs/orangefs-dev-proto.h | 4 ++++ fs/orangefs/orangefs-kernel.h | 4 +++- fs/orangefs/super.c | 27 +++++++++++++++++++++++++++ fs/orangefs/upcall.h | 6 ++++++ 7 files changed, 53 insertions(+), 6 deletions(-) (limited to 'fs/orangefs/upcall.h') diff --git a/fs/orangefs/devorangefs-req.c b/fs/orangefs/devorangefs-req.c index 7c40e653e526..ec1a5ff1d843 100644 --- a/fs/orangefs/devorangefs-req.c +++ b/fs/orangefs/devorangefs-req.c @@ -17,7 +17,7 @@ /* this file implements the /dev/pvfs2-req device node */ -uint32_t userspace_version; +uint32_t orangefs_userspace_version; static int open_access_count; @@ -389,9 +389,9 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb, return -EPROTO; } - if (!userspace_version) { - userspace_version = head.version; - } else if (userspace_version != head.version) { + if (!orangefs_userspace_version) { + orangefs_userspace_version = head.version; + } else if (orangefs_userspace_version != head.version) { gossip_err("Error: userspace version changes\n"); return -EPROTO; } @@ -536,7 +536,7 @@ static int orangefs_devreq_release(struct inode *inode, struct file *file) gossip_debug(GOSSIP_DEV_DEBUG, "pvfs2-client-core: device close complete\n"); open_access_count = 0; - userspace_version = 0; + orangefs_userspace_version = 0; mutex_unlock(&devreq_mutex); return 0; } diff --git a/fs/orangefs/downcall.h b/fs/orangefs/downcall.h index db6e8722a89e..3b8923f8bf21 100644 --- a/fs/orangefs/downcall.h +++ b/fs/orangefs/downcall.h @@ -101,6 +101,11 @@ struct orangefs_fs_key_response { char fs_key[FS_KEY_BUF_SIZE]; }; +/* 2.9.6 */ +struct orangefs_features_response { + __u64 features; +}; + struct orangefs_downcall_s { __s32 type; __s32 status; @@ -122,6 +127,7 @@ struct orangefs_downcall_s { struct orangefs_param_response param; struct orangefs_perf_count_response perf_count; struct orangefs_fs_key_response fs_key; + struct orangefs_features_response features; } resp; }; diff --git a/fs/orangefs/orangefs-cache.c b/fs/orangefs/orangefs-cache.c index eb0b6e00b519..aa3830b741c7 100644 --- a/fs/orangefs/orangefs-cache.c +++ b/fs/orangefs/orangefs-cache.c @@ -97,6 +97,8 @@ char *get_opname_string(struct orangefs_kernel_op_s *new_op) return "OP_FSYNC"; else if (type == ORANGEFS_VFS_OP_FSKEY) return "OP_FSKEY"; + else if (type == ORANGEFS_VFS_OP_FEATURES) + return "OP_FEATURES"; } return "OP_UNKNOWN?"; } diff --git a/fs/orangefs/orangefs-dev-proto.h b/fs/orangefs/orangefs-dev-proto.h index 71902899b1da..a3d84ffee905 100644 --- a/fs/orangefs/orangefs-dev-proto.h +++ b/fs/orangefs/orangefs-dev-proto.h @@ -41,6 +41,10 @@ #define ORANGEFS_VFS_OP_FSYNC 0xFF00EE01 #define ORANGEFS_VFS_OP_FSKEY 0xFF00EE02 #define ORANGEFS_VFS_OP_READDIRPLUS 0xFF00EE03 +#define ORANGEFS_VFS_OP_FEATURES 0xFF00EE05 /* 2.9.6 */ + +/* features is a 64-bit unsigned bitmask */ +#define ORANGEFS_FEATURE_READAHEAD 1 /* * Misc constants. Please retain them as multiples of 8! diff --git a/fs/orangefs/orangefs-kernel.h b/fs/orangefs/orangefs-kernel.h index ff3566a8388f..6cf3f467fd89 100644 --- a/fs/orangefs/orangefs-kernel.h +++ b/fs/orangefs/orangefs-kernel.h @@ -447,6 +447,8 @@ void purge_waiting_ops(void); /* * defined in super.c */ +extern uint64_t orangefs_features; + struct dentry *orangefs_mount(struct file_system_type *fst, int flags, const char *devname, @@ -506,7 +508,7 @@ ssize_t orangefs_inode_read(struct inode *inode, /* * defined in devorangefs-req.c */ -extern uint32_t userspace_version; +extern uint32_t orangefs_userspace_version; int orangefs_dev_init(void); void orangefs_dev_cleanup(void); diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c index b9da9a0281c9..3e484a667340 100644 --- a/fs/orangefs/super.c +++ b/fs/orangefs/super.c @@ -33,6 +33,7 @@ static const match_table_t tokens = { { Opt_err, NULL } }; +uint64_t orangefs_features; static int parse_mount_options(struct super_block *sb, char *options, int silent) @@ -249,6 +250,19 @@ int orangefs_remount(struct orangefs_sb_info_s *orangefs_sb) } op_release(new_op); + + if (orangefs_userspace_version >= 20906) { + new_op = op_alloc(ORANGEFS_VFS_OP_FEATURES); + if (!new_op) + return -ENOMEM; + new_op->upcall.req.features.features = 0; + ret = service_operation(new_op, "orangefs_features", 0); + orangefs_features = new_op->downcall.resp.features.features; + op_release(new_op); + } else { + orangefs_features = 0; + } + return ret; } @@ -492,6 +506,19 @@ struct dentry *orangefs_mount(struct file_system_type *fst, list_add_tail(&ORANGEFS_SB(sb)->list, &orangefs_superblocks); spin_unlock(&orangefs_superblocks_lock); op_release(new_op); + + if (orangefs_userspace_version >= 20906) { + new_op = op_alloc(ORANGEFS_VFS_OP_FEATURES); + if (!new_op) + return ERR_PTR(-ENOMEM); + new_op->upcall.req.features.features = 0; + ret = service_operation(new_op, "orangefs_features", 0); + orangefs_features = new_op->downcall.resp.features.features; + op_release(new_op); + } else { + orangefs_features = 0; + } + return dget(sb->s_root); free_op: diff --git a/fs/orangefs/upcall.h b/fs/orangefs/upcall.h index 7c29fdf08ec5..af0b0e36d559 100644 --- a/fs/orangefs/upcall.h +++ b/fs/orangefs/upcall.h @@ -210,6 +210,11 @@ struct orangefs_fs_key_request_s { __s32 __pad1; }; +/* 2.9.6 */ +struct orangefs_features_request_s { + __u64 features; +}; + struct orangefs_upcall_s { __s32 type; __u32 uid; @@ -246,6 +251,7 @@ struct orangefs_upcall_s { struct orangefs_param_request_s param; struct orangefs_perf_count_request_s perf_count; struct orangefs_fs_key_request_s fs_key; + struct orangefs_features_request_s features; } req; }; -- cgit v1.2.3