[Pvfs2-cvs] commit by pcarns in
pvfs2-1/src/server/request-scheduler: request-scheduler.c
request-scheduler.h
CVS commit program
cvs at parl.clemson.edu
Fri Apr 4 12:57:38 EST 2008
Update of /projects/cvsroot/pvfs2-1/src/server/request-scheduler
In directory parlweb1:/tmp/cvs-serv14123/src/server/request-scheduler
Modified Files:
request-scheduler.c request-scheduler.h
Log Message:
Push use of named enumerations for request scheduling parameters all the
way down into request-scheduler.c rather than converting to integer flags.
This fixes a bug that allowed server modification operations to proceed
concurrently as if they were read only.
Index: request-scheduler.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/request-scheduler/request-scheduler.c,v
diff -p -u -r1.67 -r1.68
--- request-scheduler.c 20 Feb 2008 17:16:44 -0000 1.67
+++ request-scheduler.c 4 Apr 2008 17:57:38 -0000 1.68
@@ -82,8 +82,8 @@ struct req_sched_element
enum req_sched_states state; /* state of this element */
PVFS_handle handle;
struct timeval tv; /* used for timer events */
- int readonly_flag; /* indicates a read only operation */
-
+ /* indicates type of access needed by this op */
+ enum PINT_server_req_access_type access_type;
int mode_change; /* specifies that the element is a mode change */
enum PVFS_server_mode mode; /* the mode to change to */
};
@@ -306,14 +306,13 @@ static void PINT_req_sched_do_change_mod
* \return 1 if request should proceed immediately, 0 if the
* request will be scheduled later, and -errno on failure
*/
-int PINT_req_sched_post(
- enum PVFS_server_op op,
- PVFS_fs_id fs_id,
- PVFS_handle handle,
- int readonly_flag,
- int schedule,
- void *in_user_ptr,
- req_sched_id * out_id)
+int PINT_req_sched_post(enum PVFS_server_op op,
+ PVFS_fs_id fs_id,
+ PVFS_handle handle,
+ enum PINT_server_req_access_type access_type,
+ enum PINT_server_sched_policy sched_policy,
+ void *in_user_ptr,
+ req_sched_id * out_id)
{
struct qlist_head *hash_link;
int ret = -1;
@@ -325,9 +324,9 @@ int PINT_req_sched_post(
struct qlist_head *iterator;
int tmp_flag;
- if(!schedule)
+ if(sched_policy == PINT_SERVER_REQ_BYPASS)
{
- if(!readonly_flag && !PVFS_SERV_IS_MGMT_OP(op))
+ if(access_type == PINT_SERVER_REQ_MODIFY && !PVFS_SERV_IS_MGMT_OP(op))
{
/* if this requests modifies the file system, we have to check
* to see if we are in admin mode or about to enter admin mode
@@ -364,10 +363,10 @@ int PINT_req_sched_post(
tmp_element->state = REQ_QUEUED;
tmp_element->handle = handle;
tmp_element->list_head = NULL;
- tmp_element->readonly_flag = readonly_flag;
+ tmp_element->access_type = access_type;
tmp_element->mode_change = 0;
- if(!readonly_flag && !PVFS_SERV_IS_MGMT_OP(op))
+ if(access_type == PINT_SERVER_REQ_MODIFY && !PVFS_SERV_IS_MGMT_OP(op))
{
if(PINT_req_sched_in_admin_mode())
{
@@ -408,7 +407,9 @@ int PINT_req_sched_post(
/* return 1 if the list is empty before we add this entry */
ret = qlist_empty(&(tmp_list->req_list));
if (ret == 1)
+ {
tmp_element->state = REQ_SCHEDULED;
+ }
else
{
/* check queue to see if we can apply any optimizations */
@@ -455,7 +456,7 @@ int PINT_req_sched_post(
ret = 0;
}
}
- else if (readonly_flag &&
+ else if (access_type == PINT_SERVER_REQ_READONLY &&
next_element->state == REQ_SCHEDULED &&
last_element->state == REQ_SCHEDULED)
{
@@ -468,7 +469,7 @@ int PINT_req_sched_post(
{
tmp_element2 = qlist_entry(iterator, struct req_sched_element,
list_link);
- if(!tmp_element2->readonly_flag)
+ if(tmp_element2->access_type == PINT_SERVER_REQ_MODIFY)
{
tmp_flag = 1;
break;
@@ -498,7 +499,7 @@ int PINT_req_sched_post(
* dirent request to proceed.
*/
tmp_element->state = REQ_SCHEDULED;
- tmp_element->readonly_flag = 1;
+ tmp_element->access_type = PINT_SERVER_REQ_READONLY;
gossip_debug(GOSSIP_REQ_SCHED_DEBUG, "REQ SCHED allowing "
"concurrent dirent op, handle: %llu\n",
llu(handle));
@@ -812,13 +813,13 @@ int PINT_req_sched_release(
}
}
}
- else if(next_element->readonly_flag)
+ else if(next_element->access_type == PINT_SERVER_REQ_READONLY)
{
/* keep going as long as the operations are read only;
* we let these all go concurrently
*/
while (next_element &&
- (next_element->readonly_flag) &&
+ (next_element->access_type == PINT_SERVER_REQ_READONLY) &&
(next_element->list_link.next != &(tmp_list->req_list)))
{
next_element =
@@ -826,7 +827,7 @@ int PINT_req_sched_release(
struct req_sched_element,
list_link);
if (next_element &&
- (next_element->readonly_flag))
+ (next_element->access_type == PINT_SERVER_REQ_READONLY))
{
gossip_debug(
GOSSIP_REQ_SCHED_DEBUG,
Index: request-scheduler.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/src/server/request-scheduler/request-scheduler.h,v
diff -p -u -r1.16 -r1.17
--- request-scheduler.h 11 Feb 2008 17:25:31 -0000 1.16
+++ request-scheduler.h 4 Apr 2008 17:57:38 -0000 1.17
@@ -24,6 +24,16 @@
typedef PVFS_id_gen_t req_sched_id;
typedef int req_sched_error_code;
+enum PINT_server_req_access_type
+{
+ PINT_SERVER_REQ_READONLY = 0,
+ PINT_SERVER_REQ_MODIFY
+};
+enum PINT_server_sched_policy
+{
+ PINT_SERVER_REQ_BYPASS = 0,
+ PINT_SERVER_REQ_SCHEDULE
+};
/* setup and teardown */
int PINT_req_sched_initialize(
@@ -37,8 +47,8 @@ int PINT_req_sched_finalize(
int PINT_req_sched_post(enum PVFS_server_op op,
PVFS_fs_id fs_id,
PVFS_handle handle,
- int read_only_flag,
- int schedule,
+ enum PINT_server_req_access_type access_type,
+ enum PINT_server_sched_policy sched_policy,
void *in_user_ptr,
req_sched_id * out_id);
More information about the Pvfs2-cvs
mailing list