formating changes to pnfs_layout.c
This commit is contained in:
parent
0e287a87be
commit
48fa809fc5
1 changed files with 115 additions and 114 deletions
|
|
@ -380,7 +380,9 @@ static enum pnfs_status file_layout_cache(
|
||||||
status = layout_grant_status(state, iomode);
|
status = layout_grant_status(state, iomode);
|
||||||
ReleaseSRWLockShared(&state->lock);
|
ReleaseSRWLockShared(&state->lock);
|
||||||
|
|
||||||
if (status == PNFS_PENDING) {
|
if (status != PNFS_PENDING)
|
||||||
|
goto out;
|
||||||
|
|
||||||
/* use an exclusive lock while attempting to get a new layout */
|
/* use an exclusive lock while attempting to get a new layout */
|
||||||
AcquireSRWLockExclusive(&state->lock);
|
AcquireSRWLockExclusive(&state->lock);
|
||||||
|
|
||||||
|
|
@ -413,7 +415,7 @@ static enum pnfs_status file_layout_cache(
|
||||||
state->pending = FALSE;
|
state->pending = FALSE;
|
||||||
WakeConditionVariable(&state->cond);
|
WakeConditionVariable(&state->cond);
|
||||||
ReleaseSRWLockExclusive(&state->lock);
|
ReleaseSRWLockExclusive(&state->lock);
|
||||||
}
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -475,7 +477,9 @@ static enum pnfs_status file_layout_device(
|
||||||
status = file_device_status(state);
|
status = file_device_status(state);
|
||||||
ReleaseSRWLockShared(&state->lock);
|
ReleaseSRWLockShared(&state->lock);
|
||||||
|
|
||||||
if (status == PNFS_PENDING) {
|
if (status != PNFS_PENDING)
|
||||||
|
goto out;
|
||||||
|
|
||||||
/* use an exclusive lock to look up device info */
|
/* use an exclusive lock to look up device info */
|
||||||
AcquireSRWLockExclusive(&state->lock);
|
AcquireSRWLockExclusive(&state->lock);
|
||||||
|
|
||||||
|
|
@ -506,7 +510,8 @@ static enum pnfs_status file_layout_device(
|
||||||
state->pending = FALSE;
|
state->pending = FALSE;
|
||||||
WakeConditionVariable(&state->cond);
|
WakeConditionVariable(&state->cond);
|
||||||
ReleaseSRWLockExclusive(&state->lock);
|
ReleaseSRWLockExclusive(&state->lock);
|
||||||
}
|
|
||||||
|
out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -571,7 +576,9 @@ static enum pnfs_status file_layout_return(
|
||||||
status = layout_return_status(state);
|
status = layout_return_status(state);
|
||||||
ReleaseSRWLockShared(&state->lock);
|
ReleaseSRWLockShared(&state->lock);
|
||||||
|
|
||||||
if (status == PNFS_PENDING) {
|
if (status != PNFS_PENDING)
|
||||||
|
goto out;
|
||||||
|
|
||||||
/* under exclusive lock, return the layout and reset status flags */
|
/* under exclusive lock, return the layout and reset status flags */
|
||||||
AcquireSRWLockExclusive(&state->lock);
|
AcquireSRWLockExclusive(&state->lock);
|
||||||
|
|
||||||
|
|
@ -588,9 +595,8 @@ static enum pnfs_status file_layout_return(
|
||||||
|
|
||||||
/* drop the lock during the rpc call */
|
/* drop the lock during the rpc call */
|
||||||
ReleaseSRWLockExclusive(&state->lock);
|
ReleaseSRWLockExclusive(&state->lock);
|
||||||
nfsstat = pnfs_rpc_layoutreturn(session, file,
|
nfsstat = pnfs_rpc_layoutreturn(session, file, PNFS_LAYOUTTYPE_FILE,
|
||||||
PNFS_LAYOUTTYPE_FILE, PNFS_IOMODE_ANY, 0,
|
PNFS_IOMODE_ANY, 0, NFS4_UINT64_MAX, &stateid, &layoutreturn_res);
|
||||||
NFS4_UINT64_MAX, &stateid, &layoutreturn_res);
|
|
||||||
AcquireSRWLockExclusive(&state->lock);
|
AcquireSRWLockExclusive(&state->lock);
|
||||||
|
|
||||||
if (nfsstat) {
|
if (nfsstat) {
|
||||||
|
|
@ -625,8 +631,8 @@ static enum pnfs_status file_layout_return(
|
||||||
state->pending = FALSE;
|
state->pending = FALSE;
|
||||||
WakeConditionVariable(&state->cond);
|
WakeConditionVariable(&state->cond);
|
||||||
ReleaseSRWLockExclusive(&state->lock);
|
ReleaseSRWLockExclusive(&state->lock);
|
||||||
}
|
|
||||||
|
|
||||||
|
out:
|
||||||
dprintf(FLLVL, "<-- file_layout_return() returning %s\n",
|
dprintf(FLLVL, "<-- file_layout_return() returning %s\n",
|
||||||
pnfs_error_string(status));
|
pnfs_error_string(status));
|
||||||
return status;
|
return status;
|
||||||
|
|
@ -780,7 +786,7 @@ void pnfs_layout_state_close(
|
||||||
/* pnfs_layout_recall */
|
/* pnfs_layout_recall */
|
||||||
|
|
||||||
/* expects the caller to have an exclusive lock */
|
/* expects the caller to have an exclusive lock */
|
||||||
static enum pnfs_status layout_recall_return(
|
static void layout_recall_return(
|
||||||
IN pnfs_layout_state *state)
|
IN pnfs_layout_state *state)
|
||||||
{
|
{
|
||||||
dprintf(FLLVL, "layout_recall_return() 'forgetting' layout\n");
|
dprintf(FLLVL, "layout_recall_return() 'forgetting' layout\n");
|
||||||
|
|
@ -801,8 +807,6 @@ static enum pnfs_status layout_recall_return(
|
||||||
* just zero the stateid since it won't be valid anymore */
|
* just zero the stateid since it won't be valid anymore */
|
||||||
ZeroMemory(&state->stateid, sizeof(state->stateid));
|
ZeroMemory(&state->stateid, sizeof(state->stateid));
|
||||||
state->status = 0;
|
state->status = 0;
|
||||||
|
|
||||||
return PNFS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum pnfs_status file_layout_recall(
|
static enum pnfs_status file_layout_recall(
|
||||||
|
|
@ -835,7 +839,7 @@ static enum pnfs_status file_layout_recall(
|
||||||
state->stateid.seqid = stateid_arg->seqid;
|
state->stateid.seqid = stateid_arg->seqid;
|
||||||
} else {
|
} else {
|
||||||
/* if there is no pending io, return the layout now */
|
/* if there is no pending io, return the layout now */
|
||||||
status = layout_recall_return(state);
|
layout_recall_return(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReleaseSRWLockExclusive(&state->lock);
|
ReleaseSRWLockExclusive(&state->lock);
|
||||||
|
|
@ -868,8 +872,7 @@ static bool_t fsid_matches(
|
||||||
IN const nfs41_fsid *lhs,
|
IN const nfs41_fsid *lhs,
|
||||||
IN const nfs41_fsid *rhs)
|
IN const nfs41_fsid *rhs)
|
||||||
{
|
{
|
||||||
return lhs->major == rhs->major
|
return lhs->major == rhs->major && lhs->minor == rhs->minor;
|
||||||
&& lhs->minor == rhs->minor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum pnfs_status file_layout_recall_fsid(
|
static enum pnfs_status file_layout_recall_fsid(
|
||||||
|
|
@ -980,11 +983,9 @@ enum pnfs_status pnfs_layout_io_start(
|
||||||
/* don't start any more io if the layout has been recalled */
|
/* don't start any more io if the layout has been recalled */
|
||||||
status = PNFSERR_LAYOUT_RECALLED;
|
status = PNFSERR_LAYOUT_RECALLED;
|
||||||
dprintf(FLLVL, "pnfs_layout_io_start() failed, layout was recalled\n");
|
dprintf(FLLVL, "pnfs_layout_io_start() failed, layout was recalled\n");
|
||||||
} else if (layout_unit_size(state->layout) == 0) { /* prevent div/0 */
|
} else if ((layout_unit_size(state->layout) == 0 ) || /* prevent div/0 */
|
||||||
status = PNFSERR_NO_LAYOUT;
|
(state->layout->device->stripes.count == 0) ||
|
||||||
} else if (state->layout->device->stripes.count == 0) {
|
(state->layout->device->servers.count == 0)) {
|
||||||
status = PNFSERR_NO_LAYOUT;
|
|
||||||
} else if (state->layout->device->servers.count == 0) {
|
|
||||||
status = PNFSERR_NO_LAYOUT;
|
status = PNFSERR_NO_LAYOUT;
|
||||||
} else {
|
} else {
|
||||||
/* take a reference on the layout, so that it won't be recalled
|
/* take a reference on the layout, so that it won't be recalled
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue