mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
nfscl: Move layout high water variables into clientID
Commit f5aff1871d32 moved the delegation high water variables into the clientID structure, so that they are now per mount instead of global. This patch does the same for the layout highwater variables. It happens that the layout highwater variables are not actually used. This patch changes the code to use them. This is needed to add support for the CB_RECALL_ANY callback in a future commit. This patch only affects NFSv4.1/4.2 mounts with the "pnfs" mount option. The effect on these mounts will be minimal, since layouts are returned when they are stale and this normally ensures that the highwater mark is never hit. (cherry picked from commit 7e26f1c21049b5a1a2f490d8ac1909ccb24f0db2)
This commit is contained in:
parent
9f5457996e
commit
b27900b8d9
2 changed files with 9 additions and 5 deletions
|
|
@ -118,6 +118,8 @@ struct nfsclclient {
|
|||
time_t nfsc_expire;
|
||||
int nfsc_delegcnt;
|
||||
int nfsc_deleghighwater;
|
||||
int nfsc_layoutcnt;
|
||||
int nfsc_layouthighwater;
|
||||
u_int32_t nfsc_clientidrev;
|
||||
u_int32_t nfsc_rev;
|
||||
u_int32_t nfsc_renew;
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ NFSCLSTATEMUTEX;
|
|||
int nfscl_inited = 0;
|
||||
struct nfsclhead nfsclhead; /* Head of clientid list */
|
||||
|
||||
static int nfscl_layoutcnt = 0;
|
||||
static int nfscl_getopen(struct nfsclownerhead *, struct nfsclopenhash *,
|
||||
u_int8_t *, int, u_int8_t *, u_int8_t *, u_int32_t,
|
||||
struct nfscllockowner **, struct nfsclopen **);
|
||||
|
|
@ -923,6 +922,8 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSPROC_T *p,
|
|||
clp->nfsc_flags = NFSCLFLAGS_INITED;
|
||||
clp->nfsc_delegcnt = 0;
|
||||
clp->nfsc_deleghighwater = NFSCLDELEGHIGHWATER;
|
||||
clp->nfsc_layoutcnt = 0;
|
||||
clp->nfsc_layouthighwater = NFSCLLAYOUTHIGHWATER;
|
||||
clp->nfsc_clientidrev = 1;
|
||||
clp->nfsc_cbident = nfscl_nextcbident();
|
||||
nfscl_fillclid(nmp->nm_clval, uuid, clp->nfsc_id,
|
||||
|
|
@ -2982,13 +2983,14 @@ tryagain2:
|
|||
lyp = TAILQ_LAST(&clp->nfsc_layout, nfscllayouthead);
|
||||
while (lyp != NULL) {
|
||||
nlyp = TAILQ_PREV(lyp, nfscllayouthead, nfsly_list);
|
||||
if (lyp->nfsly_timestamp < NFSD_MONOSEC &&
|
||||
if ((lyp->nfsly_timestamp < NFSD_MONOSEC ||
|
||||
clp->nfsc_layoutcnt > clp->nfsc_layouthighwater) &&
|
||||
(lyp->nfsly_flags & (NFSLY_RECALL |
|
||||
NFSLY_RETONCLOSE)) == 0 &&
|
||||
lyp->nfsly_lock.nfslock_usecnt == 0 &&
|
||||
lyp->nfsly_lock.nfslock_lock == 0) {
|
||||
NFSCL_DEBUG(4, "ret stale lay=%d\n",
|
||||
nfscl_layoutcnt);
|
||||
clp->nfsc_layoutcnt);
|
||||
recallp = malloc(sizeof(*recallp),
|
||||
M_NFSLAYRECALL, M_NOWAIT);
|
||||
if (recallp == NULL)
|
||||
|
|
@ -5293,7 +5295,7 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen,
|
|||
LIST_INSERT_HEAD(NFSCLLAYOUTHASH(clp, fhp, fhlen), lyp,
|
||||
nfsly_hash);
|
||||
lyp->nfsly_timestamp = NFSD_MONOSEC + 120;
|
||||
nfscl_layoutcnt++;
|
||||
clp->nfsc_layoutcnt++;
|
||||
nfsstatsv1.cllayouts++;
|
||||
} else {
|
||||
if (retonclose != 0)
|
||||
|
|
@ -5668,7 +5670,7 @@ nfscl_freelayout(struct nfscllayout *layp)
|
|||
LIST_REMOVE(rp, nfsrecly_list);
|
||||
free(rp, M_NFSLAYRECALL);
|
||||
}
|
||||
nfscl_layoutcnt--;
|
||||
layp->nfsly_clp->nfsc_layoutcnt--;
|
||||
nfsstatsv1.cllayouts--;
|
||||
free(layp, M_NFSLAYOUT);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue