pNFS: Add nfsstats counters for number of Layouts

For pNFS, Layouts are issued by the server to indicate
where a file's data resides on the DS(s).  This patch
adds counters for how many layouts are allocated to
the nfsstatsv1 structure, using two reserved fields.

MFC after:	2 weeks
This commit is contained in:
Rick Macklem 2021-11-12 17:32:55 -08:00
parent d032cda0d0
commit ce9676de86
3 changed files with 6 additions and 2 deletions

View File

@ -459,8 +459,8 @@ struct nfsstatsv1 {
uint64_t rpccnt[NFSV42_NPROCS + 11];
uint64_t rpcretries;
uint64_t srvrpccnt[NFSV42_NOPS + NFSV4OP_FAKENOPS + 15];
uint64_t reserved_0;
uint64_t reserved_1;
uint64_t srvlayouts;
uint64_t cllayouts;
uint64_t rpcrequests;
uint64_t rpctimeouts;
uint64_t rpcunexpected;

View File

@ -5212,6 +5212,7 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen,
nfsly_hash);
lyp->nfsly_timestamp = NFSD_MONOSEC + 120;
nfscl_layoutcnt++;
nfsstatsv1.cllayouts++;
} else {
if (retonclose != 0)
lyp->nfsly_flags |= NFSLY_RETONCLOSE;
@ -5586,6 +5587,7 @@ nfscl_freelayout(struct nfscllayout *layp)
free(rp, M_NFSLAYRECALL);
}
nfscl_layoutcnt--;
nfsstatsv1.cllayouts--;
free(layp, M_NFSLAYOUT);
}

View File

@ -7400,6 +7400,7 @@ nfsrv_addlayout(struct nfsrv_descript *nd, struct nfslayout **lypp,
/* Insert the new layout in the lists. */
*lypp = NULL;
atomic_add_int(&nfsrv_layoutcnt, 1);
nfsstatsv1.srvlayouts++;
NFSBCOPY(lyp->lay_xdr, layp, lyp->lay_layoutlen);
*layoutlenp = lyp->lay_layoutlen;
TAILQ_INSERT_HEAD(&lhyp->list, lyp, lay_list);
@ -7492,6 +7493,7 @@ nfsrv_freelayout(struct nfslayouthead *lhp, struct nfslayout *lyp)
NFSD_DEBUG(4, "Freelayout=%p\n", lyp);
atomic_add_int(&nfsrv_layoutcnt, -1);
nfsstatsv1.srvlayouts--;
TAILQ_REMOVE(lhp, lyp, lay_list);
free(lyp, M_NFSDSTATE);
}