Commit 3940ee36 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus-4.9-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux

Pull orangefs updates from Mike Marshall:
 "Miscellaneous improvements:
   - clean up debugfs globals
   - remove dead code in sysfs
   - reorganize duplicated sysfs attribute structs
   - consolidate sysfs show and store functions
   - remove duplicated sysfs_ops structures
   - describe organization of sysfs
   - make devreq_mutex static
   - g_orangefs_stats -> orangefs_stats for consistency
   - rename most remaining global variables

  Feature negotiation:
   - enable Orangefs userspace and kernel module to negotiate mutually
     supported features"

* tag 'for-linus-4.9-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux:
  Revert "orangefs: bump minimum userspace version"
  orangefs: bump minimum userspace version
  orangefs: rename most remaining global variables
  orangefs: g_orangefs_stats -> orangefs_stats for consistency
  orangefs: make devreq_mutex static
  orangefs: describe organization of sysfs
  orangefs: remove duplicated sysfs_ops structures
  orangefs: consolidate sysfs show and store functions
  orangefs: reorganize duplicated sysfs attribute structs
  orangefs: remove dead code in sysfs
  orangefs: clean up debugfs globals
  orangefs: do not allow client readahead cache without feature bit
  orangefs: add features op
  orangefs: record userspace version for feature compatbility
  orangefs: add readahead count and size to sysfs
  orangefs: re-add flush_racache from out-of-tree
  orangefs: turn param response value into union
  orangefs: add missing param request ops
  orangefs: rename remaining bits of mmap readahead cache
parents 95107b30 f60fbdbf
......@@ -73,7 +73,7 @@ static int orangefs_revalidate_lookup(struct dentry *dentry)
}
}
dentry->d_time = jiffies + dcache_timeout_msecs*HZ/1000;
dentry->d_time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000;
ret = 1;
out_release_op:
op_release(new_op);
......
......@@ -11,14 +11,19 @@
#include "orangefs-kernel.h"
#include "orangefs-dev-proto.h"
#include "orangefs-bufmap.h"
#include "orangefs-debugfs.h"
#include <linux/debugfs.h>
#include <linux/slab.h>
/* this file implements the /dev/pvfs2-req device node */
uint32_t orangefs_userspace_version;
static int open_access_count;
static DEFINE_MUTEX(devreq_mutex);
#define DUMP_DEVICE_ERROR() \
do { \
gossip_err("*****************************************************\n");\
......@@ -43,7 +48,7 @@ static void orangefs_devreq_add_op(struct orangefs_kernel_op_s *op)
{
int index = hash_func(op->tag, hash_table_size);
list_add_tail(&op->list, &htable_ops_in_progress[index]);
list_add_tail(&op->list, &orangefs_htable_ops_in_progress[index]);
}
/*
......@@ -57,20 +62,20 @@ static struct orangefs_kernel_op_s *orangefs_devreq_remove_op(__u64 tag)
index = hash_func(tag, hash_table_size);
spin_lock(&htable_ops_in_progress_lock);
spin_lock(&orangefs_htable_ops_in_progress_lock);
list_for_each_entry_safe(op,
next,
&htable_ops_in_progress[index],
&orangefs_htable_ops_in_progress[index],
list) {
if (op->tag == tag && !op_state_purged(op) &&
!op_state_given_up(op)) {
list_del_init(&op->list);
spin_unlock(&htable_ops_in_progress_lock);
spin_unlock(&orangefs_htable_ops_in_progress_lock);
return op;
}
}
spin_unlock(&htable_ops_in_progress_lock);
spin_unlock(&orangefs_htable_ops_in_progress_lock);
return NULL;
}
......@@ -276,11 +281,11 @@ static ssize_t orangefs_devreq_read(struct file *file,
if (ret != 0)
goto error;
spin_lock(&htable_ops_in_progress_lock);
spin_lock(&orangefs_htable_ops_in_progress_lock);
spin_lock(&cur_op->lock);
if (unlikely(op_state_given_up(cur_op))) {
spin_unlock(&cur_op->lock);
spin_unlock(&htable_ops_in_progress_lock);
spin_unlock(&orangefs_htable_ops_in_progress_lock);
complete(&cur_op->waitq);
goto restart;
}
......@@ -298,7 +303,7 @@ static ssize_t orangefs_devreq_read(struct file *file,
current->comm);
orangefs_devreq_add_op(cur_op);
spin_unlock(&cur_op->lock);
spin_unlock(&htable_ops_in_progress_lock);
spin_unlock(&orangefs_htable_ops_in_progress_lock);
/* The client only asks to read one size buffer. */
return MAX_DEV_REQ_UPSIZE;
......@@ -387,6 +392,13 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb,
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 */
op = orangefs_devreq_remove_op(head.tag);
if (!op) {
......@@ -527,6 +539,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;
orangefs_userspace_version = 0;
mutex_unlock(&devreq_mutex);
return 0;
}
......@@ -576,8 +589,6 @@ static long dispatch_ioctl_command(unsigned int command, unsigned long arg)
static __s32 max_down_size = MAX_DEV_REQ_DOWNSIZE;
struct ORANGEFS_dev_map_desc user_desc;
int ret = 0;
struct dev_mask_info_s mask_info = { 0 };
struct dev_mask2_info_s mask2_info = { 0, 0 };
int upstream_kmod = 1;
struct orangefs_sb_info_s *orangefs_sb;
......@@ -619,7 +630,7 @@ static long dispatch_ioctl_command(unsigned int command, unsigned long arg)
* all of the remounts are serviced (to avoid ops between
* mounts to fail)
*/
ret = mutex_lock_interruptible(&request_mutex);
ret = mutex_lock_interruptible(&orangefs_request_mutex);
if (ret < 0)
return ret;
gossip_debug(GOSSIP_DEV_DEBUG,
......@@ -654,7 +665,7 @@ static long dispatch_ioctl_command(unsigned int command, unsigned long arg)
gossip_debug(GOSSIP_DEV_DEBUG,
"%s: priority remount complete\n",
__func__);
mutex_unlock(&request_mutex);
mutex_unlock(&orangefs_request_mutex);
return ret;
case ORANGEFS_DEV_UPSTREAM:
......@@ -668,134 +679,11 @@ static long dispatch_ioctl_command(unsigned int command, unsigned long arg)
return ret;
case ORANGEFS_DEV_CLIENT_MASK:
ret = copy_from_user(&mask2_info,
(void __user *)arg,
sizeof(struct dev_mask2_info_s));
if (ret != 0)
return -EIO;
client_debug_mask.mask1 = mask2_info.mask1_value;
client_debug_mask.mask2 = mask2_info.mask2_value;
pr_info("%s: client debug mask has been been received "
":%llx: :%llx:\n",
__func__,
(unsigned long long)client_debug_mask.mask1,
(unsigned long long)client_debug_mask.mask2);
return ret;
return orangefs_debugfs_new_client_mask((void __user *)arg);
case ORANGEFS_DEV_CLIENT_STRING:
ret = copy_from_user(&client_debug_array_string,
(void __user *)arg,
ORANGEFS_MAX_DEBUG_STRING_LEN);
/*
* The real client-core makes an effort to ensure
* that actual strings that aren't too long to fit in
* this buffer is what we get here. We're going to use
* string functions on the stuff we got, so we'll make
* this extra effort to try and keep from
* flowing out of this buffer when we use the string
* functions, even if somehow the stuff we end up
* with here is garbage.
*/
client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN - 1] =
'\0';
if (ret != 0) {
pr_info("%s: CLIENT_STRING: copy_from_user failed\n",
__func__);
return -EIO;
}
pr_info("%s: client debug array string has been received.\n",
__func__);
if (!help_string_initialized) {
/* Free the "we don't know yet" default string... */
kfree(debug_help_string);
/* build a proper debug help string */
if (orangefs_prepare_debugfs_help_string(0)) {
gossip_err("%s: no debug help string \n",
__func__);
return -EIO;
}
/* Replace the boilerplate boot-time debug-help file. */
debugfs_remove(help_file_dentry);
help_file_dentry =
debugfs_create_file(
ORANGEFS_KMOD_DEBUG_HELP_FILE,
0444,
debug_dir,
debug_help_string,
&debug_help_fops);
if (!help_file_dentry) {
gossip_err("%s: debugfs_create_file failed for"
" :%s:!\n",
__func__,
ORANGEFS_KMOD_DEBUG_HELP_FILE);
return -EIO;
}
}
debug_mask_to_string(&client_debug_mask, 1);
debugfs_remove(client_debug_dentry);
orangefs_client_debug_init();
help_string_initialized++;
return ret;
return orangefs_debugfs_new_client_string((void __user *)arg);
case ORANGEFS_DEV_DEBUG:
ret = copy_from_user(&mask_info,
(void __user *)arg,
sizeof(mask_info));
if (ret != 0)
return -EIO;
if (mask_info.mask_type == KERNEL_MASK) {
if ((mask_info.mask_value == 0)
&& (kernel_mask_set_mod_init)) {
/*
* the kernel debug mask was set when the
* kernel module was loaded; don't override
* it if the client-core was started without
* a value for ORANGEFS_KMODMASK.
*/
return 0;
}
debug_mask_to_string(&mask_info.mask_value,
mask_info.mask_type);
gossip_debug_mask = mask_info.mask_value;
pr_info("%s: kernel debug mask has been modified to "
":%s: :%llx:\n",
__func__,
kernel_debug_string,
(unsigned long long)gossip_debug_mask);
} else if (mask_info.mask_type == CLIENT_MASK) {
debug_mask_to_string(&mask_info.mask_value,
mask_info.mask_type);
pr_info("%s: client debug mask has been modified to"
":%s: :%llx:\n",
__func__,
client_debug_string,
llu(mask_info.mask_value));
} else {
gossip_lerr("Invalid mask type....\n");
return -EINVAL;
}
return ret;
return orangefs_debugfs_new_debug((void __user *)arg);
default:
return -ENOIOCTLCMD;
}
......
......@@ -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
......@@ -98,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;
......@@ -119,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;
};
......
......@@ -14,6 +14,32 @@
#include <linux/fs.h>
#include <linux/pagemap.h>
static int flush_racache(struct inode *inode)
{
struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
struct orangefs_kernel_op_s *new_op;
int ret;
gossip_debug(GOSSIP_UTILS_DEBUG,
"%s: %pU: Handle is %pU | fs_id %d\n", __func__,
get_khandle_from_ino(inode), &orangefs_inode->refn.khandle,
orangefs_inode->refn.fs_id);
new_op = op_alloc(ORANGEFS_VFS_OP_RA_FLUSH);
if (!new_op)
return -ENOMEM;
new_op->upcall.req.ra_cache_flush.refn = orangefs_inode->refn;
ret = service_operation(new_op, "orangefs_flush_racache",
get_interruptible_flag(inode));
gossip_debug(GOSSIP_UTILS_DEBUG, "%s: got return value of %d\n",
__func__, ret);
op_release(new_op);
return ret;
}
/*
* Copy to client-core's address space from the buffers specified
* by the iovec upto total_size bytes.
......@@ -386,7 +412,7 @@ ssize_t orangefs_inode_read(struct inode *inode,
size_t bufmap_size;
ssize_t ret = -EINVAL;
g_orangefs_stats.reads++;
orangefs_stats.reads++;
bufmap_size = orangefs_bufmap_size_query();
if (count > bufmap_size) {
......@@ -427,7 +453,7 @@ static ssize_t orangefs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter
gossip_debug(GOSSIP_FILE_DEBUG, "orangefs_file_read_iter\n");
g_orangefs_stats.reads++;
orangefs_stats.reads++;
rc = do_readv_writev(ORANGEFS_IO_READ, file, &pos, iter);
iocb->ki_pos = pos;
......@@ -488,7 +514,7 @@ static ssize_t orangefs_file_write_iter(struct kiocb *iocb, struct iov_iter *ite
}
iocb->ki_pos = pos;
g_orangefs_stats.writes++;
orangefs_stats.writes++;
out:
......@@ -591,15 +617,24 @@ static int orangefs_file_release(struct inode *inode, struct file *file)
orangefs_flush_inode(inode);
/*
* remove all associated inode pages from the page cache and mmap
* remove all associated inode pages from the page cache and
* readahead cache (if any); this forces an expensive refresh of
* data for the next caller of mmap (or 'get_block' accesses)
*/
if (file->f_path.dentry->d_inode &&
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)) {
if (orangefs_features & ORANGEFS_FEATURE_READAHEAD) {
gossip_debug(GOSSIP_INODE_DEBUG,
"calling flush_racache on %pU\n",
get_khandle_from_ino(inode));
flush_racache(inode);
gossip_debug(GOSSIP_INODE_DEBUG,
"flush_racache finished\n");
}
truncate_inode_pages(file->f_path.dentry->d_inode->i_mapping,
0);
}
return 0;
}
......
......@@ -72,7 +72,7 @@ static int orangefs_create(struct inode *dir,
d_instantiate(dentry, inode);
unlock_new_inode(inode);
dentry->d_time = jiffies + dcache_timeout_msecs*HZ/1000;
dentry->d_time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000;
ORANGEFS_I(inode)->getattr_time = jiffies - 1;
gossip_debug(GOSSIP_NAME_DEBUG,
......@@ -183,7 +183,7 @@ static struct dentry *orangefs_lookup(struct inode *dir, struct dentry *dentry,
goto out;
}
dentry->d_time = jiffies + dcache_timeout_msecs*HZ/1000;
dentry->d_time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000;
inode = orangefs_iget(dir->i_sb, &new_op->downcall.resp.lookup.refn);
if (IS_ERR(inode)) {
......@@ -322,7 +322,7 @@ static int orangefs_symlink(struct inode *dir,
d_instantiate(dentry, inode);
unlock_new_inode(inode);
dentry->d_time = jiffies + dcache_timeout_msecs*HZ/1000;
dentry->d_time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000;
ORANGEFS_I(inode)->getattr_time = jiffies - 1;
gossip_debug(GOSSIP_NAME_DEBUG,
......@@ -386,7 +386,7 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
d_instantiate(dentry, inode);
unlock_new_inode(inode);
dentry->d_time = jiffies + dcache_timeout_msecs*HZ/1000;
dentry->d_time = jiffies + orangefs_dcache_timeout_msecs*HZ/1000;
ORANGEFS_I(inode)->getattr_time = jiffies - 1;
gossip_debug(GOSSIP_NAME_DEBUG,
......
......@@ -73,8 +73,8 @@ char *get_opname_string(struct orangefs_kernel_op_s *new_op)
return "OP_STATFS";
else if (type == ORANGEFS_VFS_OP_TRUNCATE)
return "OP_TRUNCATE";
else if (type == ORANGEFS_VFS_OP_MMAP_RA_FLUSH)
return "OP_MMAP_RA_FLUSH";
else if (type == ORANGEFS_VFS_OP_RA_FLUSH)
return "OP_RA_FLUSH";
else if (type == ORANGEFS_VFS_OP_FS_MOUNT)
return "OP_FS_MOUNT";
else if (type == ORANGEFS_VFS_OP_FS_UMOUNT)
......@@ -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?";
}
......
This diff is collapsed.
int orangefs_debugfs_init(void);
int orangefs_kernel_debug_init(void);
int orangefs_debugfs_init(int);
void orangefs_debugfs_cleanup(void);
int orangefs_client_debug_init(void);
int orangefs_prepare_debugfs_help_string(int);
int orangefs_debugfs_new_client_mask(void __user *);
int orangefs_debugfs_new_client_string(void __user *);
int orangefs_debugfs_new_debug(void __user *);
......@@ -28,7 +28,7 @@
#define ORANGEFS_VFS_OP_RENAME 0xFF00000A
#define ORANGEFS_VFS_OP_STATFS 0xFF00000B
#define ORANGEFS_VFS_OP_TRUNCATE 0xFF00000C
#define ORANGEFS_VFS_OP_MMAP_RA_FLUSH 0xFF00000D
#define ORANGEFS_VFS_OP_RA_FLUSH 0xFF00000D
#define ORANGEFS_VFS_OP_FS_MOUNT 0xFF00000E
#define ORANGEFS_VFS_OP_FS_UMOUNT 0xFF00000F
#define ORANGEFS_VFS_OP_GETXATTR 0xFF000010
......@@ -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!
......
......@@ -99,16 +99,6 @@ enum orangefs_vfs_op_states {
OP_VFS_STATE_GIVEN_UP = 16,
};
/*
* An array of client_debug_mask will be built to hold debug keyword/mask
* values fetched from userspace.
*/
struct client_debug_mask {
char *keyword;
__u64 mask1;
__u64 mask2;
};
/*
* orangefs kernel memory related flags
*/
......@@ -119,29 +109,6 @@ struct client_debug_mask {
#define ORANGEFS_CACHE_CREATE_FLAGS 0
#endif /* ((defined ORANGEFS_KERNEL_DEBUG) && (defined CONFIG_DEBUG_SLAB)) */
/* these functions are defined in orangefs-utils.c */
int orangefs_prepare_cdm_array(char *debug_array_string);
int orangefs_prepare_debugfs_help_string(int);
/* defined in orangefs-debugfs.c */
int orangefs_client_debug_init(void);
void debug_string_to_mask(char *, void *, int);
void do_c_mask(int, char *, struct client_debug_mask **);
void do_k_mask(int, char *, __u64 **);
void debug_mask_to_string(void *, int);
void do_k_string(void *, int);
void do_c_string(void *, int);
int check_amalgam_keyword(void *, int);
int keyword_is_amalgam(char *);
/*these variables are defined in orangefs-mod.c */
extern char kernel_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN];
extern char client_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN];
extern char client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN];
extern unsigned int kernel_mask_set_mod_init;
extern int orangefs_init_acl(struct inode *inode, struct inode *dir);
extern const struct xattr_handler *orangefs_xattr_handlers[];
......@@ -331,7 +298,7 @@ struct orangefs_stats {
unsigned long writes;
};
extern struct orangefs_stats g_orangefs_stats;
extern struct orangefs_stats orangefs_stats;
/*
* NOTE: See Documentation/filesystems/porting for information
......@@ -447,6 +414,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,6 +475,8 @@ ssize_t orangefs_inode_read(struct inode *inode,
/*
* defined in devorangefs-req.c
*/
extern uint32_t orangefs_userspace_version;
int orangefs_dev_init(void);
void orangefs_dev_cleanup(void);
int is_daemon_in_service(void);
......@@ -543,20 +514,18 @@ bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op);
int orangefs_normalize_to_errno(__s32 error_code);
extern struct mutex devreq_mutex;
extern struct mutex request_mutex;
extern int debug;
extern struct mutex orangefs_request_mutex;
extern int op_timeout_secs;
extern int slot_timeout_secs;
extern int dcache_timeout_msecs;
extern int getattr_timeout_msecs;
extern int orangefs_dcache_timeout_msecs;
extern int orangefs_getattr_timeout_msecs;
extern struct list_head orangefs_superblocks;
extern spinlock_t orangefs_superblocks_lock;
extern struct list_head orangefs_request_list;
extern spinlock_t orangefs_request_list_lock;
extern wait_queue_head_t orangefs_request_list_waitq;
extern struct list_head *htable_ops_in_progress;
extern spinlock_t htable_ops_in_progress_lock;
extern struct list_head *orangefs_htable_ops_in_progress;
extern spinlock_t orangefs_htable_ops_in_progress_lock;
extern int hash_table_size;
extern const struct address_space_operations orangefs_address_operations;
......
......@@ -21,34 +21,17 @@
* global variables declared here
*/
/* array of client debug keyword/mask values */
struct client_debug_mask *cdm_array;
int cdm_element_count;
char kernel_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN] = "none";
char client_debug_string[ORANGEFS_MAX_DEBUG_STRING_LEN];
char client_debug_array_string[ORANGEFS_MAX_DEBUG_STRING_LEN];
char *debug_help_string;
int help_string_initialized;
struct dentry *help_file_dentry;
struct dentry *client_debug_dentry;
struct dentry *debug_dir;
int client_verbose_index;
int client_all_index;
struct orangefs_stats g_orangefs_stats;
struct orangefs_stats orangefs_stats;
/* the size of the hash tables for ops in progress */
int hash_table_size = 509;
static ulong module_parm_debug_mask;
__u64 gossip_debug_mask;
struct client_debug_mask client_debug_mask = { NULL, 0, 0 };
unsigned int kernel_mask_set_mod_init; /* implicitly false */
__u64 orangefs_gossip_debug_mask;
int op_timeout_secs = ORANGEFS_DEFAULT_OP_TIMEOUT_SECS;
int slot_timeout_secs = ORANGEFS_DEFAULT_SLOT_TIMEOUT_SECS;
int dcache_timeout_msecs = 50;
int getattr_timeout_msecs = 50;
int orangefs_dcache_timeout_msecs = 50;
int orangefs_getattr_timeout_msecs = 50;
MODULE_LICENSE("GPL");
MODULE_AUTHOR("ORANGEFS Development Team");
......@@ -71,20 +54,17 @@ module_param(module_parm_debug_mask, ulong, 0644);
module_param(op_timeout_secs, int, 0);
module_param(slot_timeout_secs, int, 0);
/* synchronizes the request device file */
DEFINE_MUTEX(devreq_mutex);
/*
* Blocks non-priority requests from being queued for servicing. This
* could be used for protecting the request list data structure, but
* for now it's only being used to stall the op addition to the request
* list
*/
DEFINE_MUTEX(request_mutex);
DEFINE_MUTEX(orangefs_request_mutex);
/* hash table for storing operations waiting for matching downcall */
struct list_head *htable_ops_in_progress;
DEFINE_SPINLOCK(htable_ops_in_progress_lock);
struct list_head *orangefs_htable_ops_in_progress;
DEFINE_SPINLOCK(orangefs_htable_ops_in_progress_lock);
/* list for queueing upcall operations */
LIST_HEAD(orangefs_request_list);
......@@ -100,32 +80,6 @@ static int __init orangefs_init(void)
int ret = -1;
__u32 i = 0;
/* convert input debug mask to a 64-bit unsigned integer */
gossip_debug_mask = (unsigned long long) module_parm_debug_mask;
/*
* set the kernel's gossip debug string; invalid mask values will
* be ignored.
*/
debug_mask_to_string(&gossip_debug_mask, 0);
/* remove any invalid values from the mask */
debug_string_to_mask(kernel_debug_string, &gossip_debug_mask, 0);
/*
* if the mask has a non-zero value, then indicate that the mask
* was set when the kernel module was loaded. The orangefs dev ioctl
* command will look at this boolean to determine if the kernel's
* debug mask should be overwritten when the client-core is started.
*/
if (gossip_debug_mask != 0)
kernel_mask_set_mod_init = true;
pr_info("%s: called with debug mask: :%s: :%llx:\n",
__func__,
kernel_debug_string,
(unsigned long long)gossip_debug_mask);
ret = bdi_init(&orangefs_backing_dev_info);
if (ret)
......@@ -146,9 +100,9 @@ static int __init orangefs_init(void)
if (ret < 0)
goto cleanup_op;
htable_ops_in_progress =
orangefs_htable_ops_in_progress =
kcalloc(hash_table_size, sizeof(struct list_head), GFP_KERNEL);
if (!htable_ops_in_progress) {
if (!orangefs_htable_ops_in_progress) {
gossip_err("Failed to initialize op hashtable");
ret = -ENOMEM;
goto cleanup_inode;
......@@ -156,7 +110,7 @@ static int __init orangefs_init(void)
/* initialize a doubly linked at each hash table index */
for (i = 0; i < hash_table_size; i++)
INIT_LIST_HEAD(&htable_ops_in_progress[i]);
INIT_LIST_HEAD(&orangefs_htable_ops_in_progress[i]);
ret = fsid_key_table_initialize();
if (ret < 0)
......@@ -179,14 +133,10 @@ static int __init orangefs_init(void)
if (ret)
goto cleanup_key_table;
ret = orangefs_debugfs_init();
ret = orangefs_debugfs_init(module_parm_debug_mask);
if (ret)
goto debugfs_init_failed;
ret = orangefs_kernel_debug_init();
if (ret)
goto kernel_debug_init_failed;
ret = orangefs_sysfs_init();
if (ret)
goto sysfs_init_failed;
......@@ -214,8 +164,6 @@ static int __init orangefs_init(void)
sysfs_init_failed:
kernel_debug_init_failed:
debugfs_init_failed:
orangefs_debugfs_cleanup();
......@@ -223,7 +171,7 @@ static int __init orangefs_init(void)
fsid_key_table_finalize();
cleanup_progress_table:
kfree(htable_ops_in_progress);
kfree(orangefs_htable_ops_in_progress);
cleanup_inode:
orangefs_inode_cache_finalize();
......@@ -250,12 +198,12 @@ static void __exit orangefs_exit(void)
orangefs_dev_cleanup();
BUG_ON(!list_empty(&orangefs_request_list));
for (i = 0; i < hash_table_size; i++)
BUG_ON(!list_empty(&htable_ops_in_progress[i]));
BUG_ON(!list_empty(&orangefs_htable_ops_in_progress[i]));
orangefs_inode_cache_finalize();
op_cache_finalize();
kfree(htable_ops_in_progress);
kfree(orangefs_htable_ops_in_progress);
bdi_destroy(&orangefs_backing_dev_info);
......@@ -274,10 +222,10 @@ void purge_inprogress_ops(void)
struct orangefs_kernel_op_s *op;
struct orangefs_kernel_op_s *next;
spin_lock(&htable_ops_in_progress_lock);
spin_lock(&orangefs_htable_ops_in_progress_lock);
list_for_each_entry_safe(op,
next,
&htable_ops_in_progress[i],
&orangefs_htable_ops_in_progress[i],
list) {
set_op_state_purged(op);
gossip_debug(GOSSIP_DEV_DEBUG,
......@@ -287,7 +235,7 @@ void purge_inprogress_ops(void)
op->op_state,
current->comm);
}
spin_unlock(&htable_ops_in_progress_lock);
spin_unlock(&orangefs_htable_ops_in_progress_lock);
}
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -4,26 +4,6 @@
#include <linux/slab.h>
#include <linux/ioctl.h>
extern struct client_debug_mask *cdm_array;
extern char *debug_help_string;
extern int help_string_initialized;
extern struct dentry *debug_dir;
extern struct dentry *help_file_dentry;
extern struct dentry *client_debug_dentry;
extern const struct file_operations debug_help_fops;
extern int client_all_index;
extern int client_verbose_index;
extern int cdm_element_count;
#define DEBUG_HELP_STRING_SIZE 4096
#define HELP_STRING_UNINITIALIZED \
"Client Debug Keywords are unknown until the first time\n" \
"the client is started after boot.\n"
#define ORANGEFS_KMOD_DEBUG_HELP_FILE "debug-help"
#define ORANGEFS_KMOD_DEBUG_FILE "kernel-debug"
#define ORANGEFS_CLIENT_DEBUG_FILE "client-debug"
#define ORANGEFS_VERBOSE "verbose"
#define ORANGEFS_ALL "all"
/* pvfs2-config.h ***********************************************************/
#define ORANGEFS_VERSION_MAJOR 2
#define ORANGEFS_VERSION_MINOR 9
......@@ -426,13 +406,12 @@ do { \
printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
} while (0)
#else
extern __u64 gossip_debug_mask;
extern struct client_debug_mask client_debug_mask;
extern __u64 orangefs_gossip_debug_mask;
/* try to avoid function call overhead by checking masks in macro */
#define gossip_debug(mask, fmt, ...) \
do { \
if (gossip_debug_mask & (mask)) \
if (orangefs_gossip_debug_mask & (mask)) \
printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
} while (0)
#endif /* GOSSIP_DISABLE_DEBUG */
......
......@@ -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:
......@@ -530,8 +557,8 @@ void orangefs_kill_sb(struct super_block *sb)
* make sure that ORANGEFS_DEV_REMOUNT_ALL loop that might've seen us
* gets completed before we free the dang thing.
*/
mutex_lock(&request_mutex);
mutex_unlock(&request_mutex);
mutex_lock(&orangefs_request_mutex);
mutex_unlock(&orangefs_request_mutex);
/* free the orangefs superblock private data */
kfree(ORANGEFS_SB(sb));
......
......@@ -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;
};
......@@ -179,12 +179,18 @@ 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 {
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];
};
......@@ -204,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;
......@@ -228,7 +239,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;
......@@ -240,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;
};
......
......@@ -87,9 +87,9 @@ int service_operation(struct orangefs_kernel_op_s *op,
*/
if (!(flags & ORANGEFS_OP_NO_MUTEX)) {
if (flags & ORANGEFS_OP_INTERRUPTIBLE)
ret = mutex_lock_interruptible(&request_mutex);
ret = mutex_lock_interruptible(&orangefs_request_mutex);
else
ret = mutex_lock_killable(&request_mutex);
ret = mutex_lock_killable(&orangefs_request_mutex);
/*
* check to see if we were interrupted while waiting for
* mutex
......@@ -129,7 +129,7 @@ int service_operation(struct orangefs_kernel_op_s *op,
spin_unlock(&orangefs_request_list_lock);
if (!(flags & ORANGEFS_OP_NO_MUTEX))
mutex_unlock(&request_mutex);
mutex_unlock(&orangefs_request_mutex);
ret = wait_for_matching_downcall(op, timeout,
flags & ORANGEFS_OP_INTERRUPTIBLE);
......@@ -272,9 +272,9 @@ static void
} else if (op_state_in_progress(op)) {
/* op must be removed from the in progress htable */
spin_unlock(&op->lock);
spin_lock(&htable_ops_in_progress_lock);
spin_lock(&orangefs_htable_ops_in_progress_lock);
list_del_init(&op->list);
spin_unlock(&htable_ops_in_progress_lock);
spin_unlock(&orangefs_htable_ops_in_progress_lock);
gossip_debug(GOSSIP_WAIT_DEBUG,
"Interrupted: Removed op %p"
" from htable_ops_in_progress\n",
......
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