Commit f808e138 authored by Martin Brandenburg's avatar Martin Brandenburg

Merge branch 'features' into for-next

Pull in an OrangeFS branch containing improvements which the userspace
component and the kernel to negotiate mutually supported features.
parents a21aae3b 0c95ad76
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
/* this file implements the /dev/pvfs2-req device node */ /* this file implements the /dev/pvfs2-req device node */
uint32_t orangefs_userspace_version;
static int open_access_count; static int open_access_count;
#define DUMP_DEVICE_ERROR() \ #define DUMP_DEVICE_ERROR() \
...@@ -387,6 +389,13 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb, ...@@ -387,6 +389,13 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb,
return -EPROTO; return -EPROTO;
} }
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;
}
/* remove the op from the in progress hash table */ /* remove the op from the in progress hash table */
op = orangefs_devreq_remove_op(head.tag); op = orangefs_devreq_remove_op(head.tag);
if (!op) { if (!op) {
...@@ -527,6 +536,7 @@ static int orangefs_devreq_release(struct inode *inode, struct file *file) ...@@ -527,6 +536,7 @@ static int orangefs_devreq_release(struct inode *inode, struct file *file)
gossip_debug(GOSSIP_DEV_DEBUG, gossip_debug(GOSSIP_DEV_DEBUG,
"pvfs2-client-core: device close complete\n"); "pvfs2-client-core: device close complete\n");
open_access_count = 0; open_access_count = 0;
orangefs_userspace_version = 0;
mutex_unlock(&devreq_mutex); mutex_unlock(&devreq_mutex);
return 0; return 0;
} }
......
...@@ -101,6 +101,11 @@ struct orangefs_fs_key_response { ...@@ -101,6 +101,11 @@ struct orangefs_fs_key_response {
char fs_key[FS_KEY_BUF_SIZE]; char fs_key[FS_KEY_BUF_SIZE];
}; };
/* 2.9.6 */
struct orangefs_features_response {
__u64 features;
};
struct orangefs_downcall_s { struct orangefs_downcall_s {
__s32 type; __s32 type;
__s32 status; __s32 status;
...@@ -122,6 +127,7 @@ struct orangefs_downcall_s { ...@@ -122,6 +127,7 @@ struct orangefs_downcall_s {
struct orangefs_param_response param; struct orangefs_param_response param;
struct orangefs_perf_count_response perf_count; struct orangefs_perf_count_response perf_count;
struct orangefs_fs_key_response fs_key; struct orangefs_fs_key_response fs_key;
struct orangefs_features_response features;
} resp; } resp;
}; };
......
...@@ -624,11 +624,14 @@ static int orangefs_file_release(struct inode *inode, struct file *file) ...@@ -624,11 +624,14 @@ static int orangefs_file_release(struct inode *inode, struct file *file)
if (file->f_path.dentry->d_inode && if (file->f_path.dentry->d_inode &&
file->f_path.dentry->d_inode->i_mapping && file->f_path.dentry->d_inode->i_mapping &&
mapping_nrpages(&file->f_path.dentry->d_inode->i_data)) { mapping_nrpages(&file->f_path.dentry->d_inode->i_data)) {
gossip_debug(GOSSIP_INODE_DEBUG, if (orangefs_features & ORANGEFS_FEATURE_READAHEAD) {
"calling flush_racache on %pU\n", gossip_debug(GOSSIP_INODE_DEBUG,
get_khandle_from_ino(inode)); "calling flush_racache on %pU\n",
flush_racache(inode); get_khandle_from_ino(inode));
gossip_debug(GOSSIP_INODE_DEBUG, "flush_racache finished\n"); flush_racache(inode);
gossip_debug(GOSSIP_INODE_DEBUG,
"flush_racache finished\n");
}
truncate_inode_pages(file->f_path.dentry->d_inode->i_mapping, truncate_inode_pages(file->f_path.dentry->d_inode->i_mapping,
0); 0);
} }
......
...@@ -97,6 +97,8 @@ char *get_opname_string(struct orangefs_kernel_op_s *new_op) ...@@ -97,6 +97,8 @@ char *get_opname_string(struct orangefs_kernel_op_s *new_op)
return "OP_FSYNC"; return "OP_FSYNC";
else if (type == ORANGEFS_VFS_OP_FSKEY) else if (type == ORANGEFS_VFS_OP_FSKEY)
return "OP_FSKEY"; return "OP_FSKEY";
else if (type == ORANGEFS_VFS_OP_FEATURES)
return "OP_FEATURES";
} }
return "OP_UNKNOWN?"; return "OP_UNKNOWN?";
} }
......
...@@ -41,6 +41,10 @@ ...@@ -41,6 +41,10 @@
#define ORANGEFS_VFS_OP_FSYNC 0xFF00EE01 #define ORANGEFS_VFS_OP_FSYNC 0xFF00EE01
#define ORANGEFS_VFS_OP_FSKEY 0xFF00EE02 #define ORANGEFS_VFS_OP_FSKEY 0xFF00EE02
#define ORANGEFS_VFS_OP_READDIRPLUS 0xFF00EE03 #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! * Misc constants. Please retain them as multiples of 8!
......
...@@ -447,6 +447,8 @@ void purge_waiting_ops(void); ...@@ -447,6 +447,8 @@ void purge_waiting_ops(void);
/* /*
* defined in super.c * defined in super.c
*/ */
extern uint64_t orangefs_features;
struct dentry *orangefs_mount(struct file_system_type *fst, struct dentry *orangefs_mount(struct file_system_type *fst,
int flags, int flags,
const char *devname, const char *devname,
...@@ -506,6 +508,8 @@ ssize_t orangefs_inode_read(struct inode *inode, ...@@ -506,6 +508,8 @@ ssize_t orangefs_inode_read(struct inode *inode,
/* /*
* defined in devorangefs-req.c * defined in devorangefs-req.c
*/ */
extern uint32_t orangefs_userspace_version;
int orangefs_dev_init(void); int orangefs_dev_init(void);
void orangefs_dev_cleanup(void); void orangefs_dev_cleanup(void);
int is_daemon_in_service(void); int is_daemon_in_service(void);
......
...@@ -842,6 +842,16 @@ static int sysfs_service_op_show(char *kobj_id, char *buf, void *attr) ...@@ -842,6 +842,16 @@ static int sysfs_service_op_show(char *kobj_id, char *buf, void *attr)
if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) { if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) {
orangefs_attr = (struct orangefs_attribute *)attr; orangefs_attr = (struct orangefs_attribute *)attr;
/* Drop unsupported requests first. */
if (!(orangefs_features & ORANGEFS_FEATURE_READAHEAD) &&
(!strcmp(orangefs_attr->attr.name, "readahead_count") ||
!strcmp(orangefs_attr->attr.name, "readahead_size") ||
!strcmp(orangefs_attr->attr.name,
"readahead_count_size"))) {
rc = -EINVAL;
goto out;
}
if (!strcmp(orangefs_attr->attr.name, "perf_history_size")) if (!strcmp(orangefs_attr->attr.name, "perf_history_size"))
new_op->upcall.req.param.op = new_op->upcall.req.param.op =
ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE; ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE;
...@@ -1133,6 +1143,15 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) ...@@ -1133,6 +1143,15 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr)
if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) { if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) {
orangefs_attr = (struct orangefs_attribute *)attr; orangefs_attr = (struct orangefs_attribute *)attr;
/* Drop unsupported requests first. */
if (!(orangefs_features & ORANGEFS_FEATURE_READAHEAD) &&
(!strcmp(orangefs_attr->attr.name, "readahead_count") ||
!strcmp(orangefs_attr->attr.name, "readahead_size") ||
!strcmp(orangefs_attr->attr.name,
"readahead_count_size"))) {
rc = -EINVAL;
goto out;
}
if (!strcmp(orangefs_attr->attr.name, "perf_history_size")) { if (!strcmp(orangefs_attr->attr.name, "perf_history_size")) {
if (val > 0) { if (val > 0) {
......
...@@ -33,6 +33,7 @@ static const match_table_t tokens = { ...@@ -33,6 +33,7 @@ static const match_table_t tokens = {
{ Opt_err, NULL } { Opt_err, NULL }
}; };
uint64_t orangefs_features;
static int parse_mount_options(struct super_block *sb, char *options, static int parse_mount_options(struct super_block *sb, char *options,
int silent) int silent)
...@@ -249,6 +250,19 @@ int orangefs_remount(struct orangefs_sb_info_s *orangefs_sb) ...@@ -249,6 +250,19 @@ int orangefs_remount(struct orangefs_sb_info_s *orangefs_sb)
} }
op_release(new_op); op_release(new_op);
if (orangefs_userspace_version >= 20907) {
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; return ret;
} }
...@@ -492,6 +506,19 @@ struct dentry *orangefs_mount(struct file_system_type *fst, ...@@ -492,6 +506,19 @@ struct dentry *orangefs_mount(struct file_system_type *fst,
list_add_tail(&ORANGEFS_SB(sb)->list, &orangefs_superblocks); list_add_tail(&ORANGEFS_SB(sb)->list, &orangefs_superblocks);
spin_unlock(&orangefs_superblocks_lock); spin_unlock(&orangefs_superblocks_lock);
op_release(new_op); op_release(new_op);
if (orangefs_userspace_version >= 20907) {
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); return dget(sb->s_root);
free_op: free_op:
......
...@@ -210,6 +210,11 @@ struct orangefs_fs_key_request_s { ...@@ -210,6 +210,11 @@ struct orangefs_fs_key_request_s {
__s32 __pad1; __s32 __pad1;
}; };
/* 2.9.6 */
struct orangefs_features_request_s {
__u64 features;
};
struct orangefs_upcall_s { struct orangefs_upcall_s {
__s32 type; __s32 type;
__u32 uid; __u32 uid;
...@@ -246,6 +251,7 @@ struct orangefs_upcall_s { ...@@ -246,6 +251,7 @@ struct orangefs_upcall_s {
struct orangefs_param_request_s param; struct orangefs_param_request_s param;
struct orangefs_perf_count_request_s perf_count; struct orangefs_perf_count_request_s perf_count;
struct orangefs_fs_key_request_s fs_key; struct orangefs_fs_key_request_s fs_key;
struct orangefs_features_request_s features;
} req; } req;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment