Skip to content

Commit

Permalink
orangefs: rename most remaining global variables
Browse files Browse the repository at this point in the history
Only op_timeout_secs, slot_timeout_secs, and hash_table_size are left
because they are exposed as module parameters. All other global
variables have the orangefs_ prefix.

Signed-off-by: Martin Brandenburg <[email protected]>
  • Loading branch information
Martin Brandenburg committed Aug 16, 2016
1 parent 889d5f1 commit 1d50361
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 46 deletions.
2 changes: 1 addition & 1 deletion fs/orangefs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 10 additions & 10 deletions fs/orangefs/devorangefs-req.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,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]);
}

/*
Expand All @@ -60,20 +60,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;
}

Expand Down Expand Up @@ -279,11 +279,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;
}
Expand All @@ -301,7 +301,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;
Expand Down Expand Up @@ -620,7 +620,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,
Expand Down Expand Up @@ -655,7 +655,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:
Expand Down
8 changes: 4 additions & 4 deletions fs/orangefs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions fs/orangefs/orangefs-kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -510,18 +510,18 @@ bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op);

int orangefs_normalize_to_errno(__s32 error_code);

extern struct mutex request_mutex;
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;
Expand Down
28 changes: 14 additions & 14 deletions fs/orangefs/orangefs-mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ static ulong module_parm_debug_mask;
__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");
Expand Down Expand Up @@ -60,11 +60,11 @@ module_param(slot_timeout_secs, int, 0);
* 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);
Expand Down Expand Up @@ -100,17 +100,17 @@ 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;
}

/* 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)
Expand Down Expand Up @@ -171,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();
Expand All @@ -198,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);

Expand All @@ -222,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,
Expand All @@ -235,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);
}
}

Expand Down
8 changes: 4 additions & 4 deletions fs/orangefs/orangefs-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@ static ssize_t sysfs_int_show(struct kobject *kobj,
rc = scnprintf(buf,
PAGE_SIZE,
"%d\n",
dcache_timeout_msecs);
orangefs_dcache_timeout_msecs);
goto out;
} else if (!strcmp(attr->attr.name,
"getattr_timeout_msecs")) {
rc = scnprintf(buf,
PAGE_SIZE,
"%d\n",
getattr_timeout_msecs);
orangefs_getattr_timeout_msecs);
goto out;
} else {
goto out;
Expand Down Expand Up @@ -270,10 +270,10 @@ static ssize_t sysfs_int_store(struct kobject *kobj,
rc = kstrtoint(buf, 0, &slot_timeout_secs);
goto out;
} else if (!strcmp(attr->attr.name, "dcache_timeout_msecs")) {
rc = kstrtoint(buf, 0, &dcache_timeout_msecs);
rc = kstrtoint(buf, 0, &orangefs_dcache_timeout_msecs);
goto out;
} else if (!strcmp(attr->attr.name, "getattr_timeout_msecs")) {
rc = kstrtoint(buf, 0, &getattr_timeout_msecs);
rc = kstrtoint(buf, 0, &orangefs_getattr_timeout_msecs);
goto out;
} else {
goto out;
Expand Down
3 changes: 2 additions & 1 deletion fs/orangefs/orangefs-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ int orangefs_inode_getattr(struct inode *inode, int new, int bypass)
inode->i_mode = type | (is_root_handle(inode) ? S_ISVTX : 0) |
orangefs_inode_perms(&new_op->downcall.resp.getattr.attributes);

orangefs_inode->getattr_time = jiffies + getattr_timeout_msecs*HZ/1000;
orangefs_inode->getattr_time = jiffies +
orangefs_getattr_timeout_msecs*HZ/1000;
ret = 0;
out:
op_release(new_op);
Expand Down
4 changes: 2 additions & 2 deletions fs/orangefs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,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));
Expand Down
10 changes: 5 additions & 5 deletions fs/orangefs/waitqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 1d50361

Please sign in to comment.