Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
ca9f518e
Commit
ca9f518e
authored
Feb 26, 2016
by
Mike Marshall
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Orangefs: code sanitation.
Signed-off-by:
Mike Marshall
<
hubcap@omnibond.com
>
parent
401898ee
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
29 deletions
+46
-29
fs/orangefs/devorangefs-req.c
fs/orangefs/devorangefs-req.c
+10
-10
fs/orangefs/orangefs-mod.c
fs/orangefs/orangefs-mod.c
+6
-5
fs/orangefs/waitqueue.c
fs/orangefs/waitqueue.c
+30
-14
No files found.
fs/orangefs/devorangefs-req.c
View file @
ca9f518e
...
@@ -46,6 +46,10 @@ static void orangefs_devreq_add_op(struct orangefs_kernel_op_s *op)
...
@@ -46,6 +46,10 @@ static void orangefs_devreq_add_op(struct orangefs_kernel_op_s *op)
list_add_tail
(
&
op
->
list
,
&
htable_ops_in_progress
[
index
]);
list_add_tail
(
&
op
->
list
,
&
htable_ops_in_progress
[
index
]);
}
}
/*
* find the op with this tag and remove it from the in progress
* hash table.
*/
static
struct
orangefs_kernel_op_s
*
orangefs_devreq_remove_op
(
__u64
tag
)
static
struct
orangefs_kernel_op_s
*
orangefs_devreq_remove_op
(
__u64
tag
)
{
{
struct
orangefs_kernel_op_s
*
op
,
*
next
;
struct
orangefs_kernel_op_s
*
op
,
*
next
;
...
@@ -190,8 +194,10 @@ static ssize_t orangefs_devreq_read(struct file *file,
...
@@ -190,8 +194,10 @@ static ssize_t orangefs_devreq_read(struct file *file,
return
-
EAGAIN
;
return
-
EAGAIN
;
}
}
gossip_debug
(
GOSSIP_DEV_DEBUG
,
"orangefs: reading op tag %llu %s
\n
"
,
gossip_debug
(
GOSSIP_DEV_DEBUG
,
"%s: reading op tag %llu %s
\n
"
,
llu
(
cur_op
->
tag
),
get_opname_string
(
cur_op
));
__func__
,
llu
(
cur_op
->
tag
),
get_opname_string
(
cur_op
));
/*
/*
* Such an op should never be on the list in the first place. If so, we
* Such an op should never be on the list in the first place. If so, we
...
@@ -204,6 +210,7 @@ static ssize_t orangefs_devreq_read(struct file *file,
...
@@ -204,6 +210,7 @@ static ssize_t orangefs_devreq_read(struct file *file,
spin_unlock
(
&
orangefs_request_list_lock
);
spin_unlock
(
&
orangefs_request_list_lock
);
return
-
EAGAIN
;
return
-
EAGAIN
;
}
}
list_del_init
(
&
cur_op
->
list
);
list_del_init
(
&
cur_op
->
list
);
spin_unlock
(
&
orangefs_request_list_lock
);
spin_unlock
(
&
orangefs_request_list_lock
);
...
@@ -323,6 +330,7 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb,
...
@@ -323,6 +330,7 @@ static ssize_t orangefs_devreq_write_iter(struct kiocb *iocb,
return
-
EPROTO
;
return
-
EPROTO
;
}
}
/* 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
)
{
gossip_err
(
"WARNING: No one's waiting for tag %llu
\n
"
,
gossip_err
(
"WARNING: No one's waiting for tag %llu
\n
"
,
...
@@ -486,15 +494,7 @@ static int orangefs_devreq_release(struct inode *inode, struct file *file)
...
@@ -486,15 +494,7 @@ static int orangefs_devreq_release(struct inode *inode, struct file *file)
gossip_debug
(
GOSSIP_DEV_DEBUG
,
"ORANGEFS Device Close: Filesystem(s) %s
\n
"
,
gossip_debug
(
GOSSIP_DEV_DEBUG
,
"ORANGEFS Device Close: Filesystem(s) %s
\n
"
,
(
unmounted
?
"UNMOUNTED"
:
"MOUNTED"
));
(
unmounted
?
"UNMOUNTED"
:
"MOUNTED"
));
/*
* Walk through the list of ops in the request list, mark them
* as purged and wake them up.
*/
purge_waiting_ops
();
purge_waiting_ops
();
/*
* Walk through the hash table of in progress operations; mark
* them as purged and wake them up
*/
purge_inprogress_ops
();
purge_inprogress_ops
();
orangefs_bufmap_run_down
();
orangefs_bufmap_run_down
();
...
...
fs/orangefs/orangefs-mod.c
View file @
ca9f518e
...
@@ -119,10 +119,10 @@ static int __init orangefs_init(void)
...
@@ -119,10 +119,10 @@ static int __init orangefs_init(void)
if
(
gossip_debug_mask
!=
0
)
if
(
gossip_debug_mask
!=
0
)
kernel_mask_set_mod_init
=
true
;
kernel_mask_set_mod_init
=
true
;
/* print information message to the system log */
pr_info
(
"%s: called with debug mask: :%s: :%llx:
\n
"
,
pr_info
(
"orangefs: orangefs_init called with debug mask: :%s: :%llx:
\n
"
,
__func__
,
kernel_debug_string
,
kernel_debug_string
,
(
unsigned
long
long
)
gossip_debug_mask
);
(
unsigned
long
long
)
gossip_debug_mask
);
ret
=
bdi_init
(
&
orangefs_backing_dev_info
);
ret
=
bdi_init
(
&
orangefs_backing_dev_info
);
...
@@ -147,7 +147,8 @@ static int __init orangefs_init(void)
...
@@ -147,7 +147,8 @@ static int __init orangefs_init(void)
/* Initialize the orangefsdev subsystem. */
/* Initialize the orangefsdev subsystem. */
ret
=
orangefs_dev_init
();
ret
=
orangefs_dev_init
();
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
gossip_err
(
"orangefs: could not initialize device subsystem %d!
\n
"
,
gossip_err
(
"%s: could not initialize device subsystem %d!
\n
"
,
__func__
,
ret
);
ret
);
goto
cleanup_inode
;
goto
cleanup_inode
;
}
}
...
...
fs/orangefs/waitqueue.c
View file @
ca9f518e
...
@@ -75,7 +75,7 @@ int service_operation(struct orangefs_kernel_op_s *op,
...
@@ -75,7 +75,7 @@ int service_operation(struct orangefs_kernel_op_s *op,
/*
/*
* If ORANGEFS_OP_NO_MUTEX was set in flags, we need to avoid
* If ORANGEFS_OP_NO_MUTEX was set in flags, we need to avoid
* aquiring the request_mutex because we're servicing a
* a
c
quiring the request_mutex because we're servicing a
* high priority remount operation and the request_mutex is
* high priority remount operation and the request_mutex is
* already taken.
* already taken.
*/
*/
...
@@ -91,7 +91,8 @@ int service_operation(struct orangefs_kernel_op_s *op,
...
@@ -91,7 +91,8 @@ int service_operation(struct orangefs_kernel_op_s *op,
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
op
->
downcall
.
status
=
ret
;
op
->
downcall
.
status
=
ret
;
gossip_debug
(
GOSSIP_WAIT_DEBUG
,
gossip_debug
(
GOSSIP_WAIT_DEBUG
,
"orangefs: service_operation interrupted.
\n
"
);
"%s: service_operation interrupted.
\n
"
,
__func__
);
return
ret
;
return
ret
;
}
}
}
}
...
@@ -127,9 +128,9 @@ int service_operation(struct orangefs_kernel_op_s *op,
...
@@ -127,9 +128,9 @@ int service_operation(struct orangefs_kernel_op_s *op,
ret
,
ret
,
op
);
op
);
/* got matching downcall; make sure status is in errno format */
if
(
!
ret
)
{
if
(
!
ret
)
{
spin_unlock
(
&
op
->
lock
);
spin_unlock
(
&
op
->
lock
);
/* got matching downcall; make sure status is in errno format */
op
->
downcall
.
status
=
op
->
downcall
.
status
=
orangefs_normalize_to_errno
(
op
->
downcall
.
status
);
orangefs_normalize_to_errno
(
op
->
downcall
.
status
);
ret
=
op
->
downcall
.
status
;
ret
=
op
->
downcall
.
status
;
...
@@ -144,8 +145,8 @@ int service_operation(struct orangefs_kernel_op_s *op,
...
@@ -144,8 +145,8 @@ int service_operation(struct orangefs_kernel_op_s *op,
}
}
/*
/*
* remove
waiting ops
from the request list or
* remove
a waiting op
from the request list or
* remove
in-progress ops
from the in-progress list.
* remove
an in-progress op
from the in-progress list.
*/
*/
orangefs_clean_up_interrupted_operation
(
op
);
orangefs_clean_up_interrupted_operation
(
op
);
...
@@ -179,6 +180,7 @@ int service_operation(struct orangefs_kernel_op_s *op,
...
@@ -179,6 +180,7 @@ int service_operation(struct orangefs_kernel_op_s *op,
return
ret
;
return
ret
;
}
}
/* This can get called on an I/O op if it had a bad service_operation. */
bool
orangefs_cancel_op_in_progress
(
struct
orangefs_kernel_op_s
*
op
)
bool
orangefs_cancel_op_in_progress
(
struct
orangefs_kernel_op_s
*
op
)
{
{
u64
tag
=
op
->
tag
;
u64
tag
=
op
->
tag
;
...
@@ -206,23 +208,31 @@ bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op)
...
@@ -206,23 +208,31 @@ bool orangefs_cancel_op_in_progress(struct orangefs_kernel_op_s *op)
spin_unlock
(
&
op
->
lock
);
spin_unlock
(
&
op
->
lock
);
spin_unlock
(
&
orangefs_request_list_lock
);
spin_unlock
(
&
orangefs_request_list_lock
);
gossip_debug
(
GOSSIP_
UTILS
_DEBUG
,
gossip_debug
(
GOSSIP_
WAIT
_DEBUG
,
"Attempting ORANGEFS operation cancellation of tag %llu
\n
"
,
"Attempting ORANGEFS operation cancellation of tag %llu
\n
"
,
llu
(
tag
));
llu
(
tag
));
return
true
;
return
true
;
}
}
static
void
orangefs_clean_up_interrupted_operation
(
struct
orangefs_kernel_op_s
*
op
)
/*
* Change an op to the "given up" state and remove it from its list.
*/
static
void
orangefs_clean_up_interrupted_operation
(
struct
orangefs_kernel_op_s
*
op
)
{
{
/*
/*
* handle interrupted cases depending on what state we were in when
* handle interrupted cases depending on what state we were in when
* the interruption is detected. there is a coarse grained lock
* the interruption is detected.
* across the operation.
*
*
* Called with op->lock held.
* Called with op->lock held.
*/
*/
/*
* List manipulation code elsewhere will ignore ops that
* have been given up upon.
*/
op
->
op_state
|=
OP_VFS_STATE_GIVEN_UP
;
op
->
op_state
|=
OP_VFS_STATE_GIVEN_UP
;
/* from that point on it can't be moved by anybody else */
if
(
list_empty
(
&
op
->
list
))
{
if
(
list_empty
(
&
op
->
list
))
{
/* caught copying to/from daemon */
/* caught copying to/from daemon */
BUG_ON
(
op_state_serviced
(
op
));
BUG_ON
(
op_state_serviced
(
op
));
...
@@ -259,12 +269,12 @@ static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s
...
@@ -259,12 +269,12 @@ static void orangefs_clean_up_interrupted_operation(struct orangefs_kernel_op_s
}
}
/*
/*
*
s
leeps on waitqueue waiting for matching downcall.
*
S
leeps on waitqueue waiting for matching downcall.
*
i
f client-core finishes servicing, then we are good to go.
*
I
f client-core finishes servicing, then we are good to go.
* else if client-core exits, we get woken up here, and retry with a timeout
* else if client-core exits, we get woken up here, and retry with a timeout
*
*
*
Post w
hen this call returns to the caller, the specified op will no
*
W
hen this call returns to the caller, the specified op will no
* longer be
on any list or htable
.
* longer be
in either the in_progress hash table or on the request list
.
*
*
* Returns 0 on success and -errno on failure
* Returns 0 on success and -errno on failure
* Errors are:
* Errors are:
...
@@ -281,6 +291,12 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op,
...
@@ -281,6 +291,12 @@ static int wait_for_matching_downcall(struct orangefs_kernel_op_s *op,
{
{
long
n
;
long
n
;
/*
* There's a "schedule_timeout" inside of these wait
* primitives, during which the op is out of the hands of the
* user process that needs something done and is being
* manipulated by the client-core process.
*/
if
(
interruptible
)
if
(
interruptible
)
n
=
wait_for_completion_interruptible_timeout
(
&
op
->
waitq
,
n
=
wait_for_completion_interruptible_timeout
(
&
op
->
waitq
,
timeout
);
timeout
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment