Lines Matching defs:lyp

218 static void nfsrv_freelayout(struct nfslayouthead *lhp, struct nfslayout *lyp);
232 fhandle_t *fhp, struct nfslayout *lyp, int changed, int laytype,
6808 struct nfslayout *lyp;
6852 error = nfsrv_findlayout(&nd->nd_clientid, &fh, layouttype, p, &lyp);
6857 if (error == 0 && (stateidp->other[0] != lyp->lay_stateid.other[0] ||
6858 stateidp->other[1] != lyp->lay_stateid.other[1] ||
6859 stateidp->other[2] != lyp->lay_stateid.other[2])) {
6860 if ((lyp->lay_flags & NFSLAY_CALLB) == 0) {
6874 * "lyp" will be set before being used below, but set it NULL
6877 nfsrv_freelayout(&lhyp->list, lyp);
6878 lyp = NULL;
6882 if (lyp->lay_layoutlen > maxcnt) {
6888 if ((lyp->lay_flags & NFSLAY_NOSPC) != 0) {
6893 lyp->lay_flags |= NFSLAY_RW;
6895 lyp->lay_flags |= NFSLAY_READ;
6896 NFSBCOPY(lyp->lay_xdr, layp, lyp->lay_layoutlen);
6897 *layoutlenp = lyp->lay_layoutlen;
6898 if (++lyp->lay_stateid.seqid == 0)
6899 lyp->lay_stateid.seqid = 1;
6900 stateidp->seqid = lyp->lay_stateid.seqid;
6917 lyp = nfsrv_filelayout(nd, *iomode, &fh, dsfhp,
6923 lyp = nfsrv_flexlayout(nd, *iomode, mirrorcnt,
6936 error = nfsrv_addlayout(nd, &lyp, stateidp, layp, layoutlenp, p);
6939 * The lyp will be set to NULL by nfsrv_addlayout() if it
6942 free(lyp, M_NFSDSTATE);
6954 struct nfslayout *lyp;
6957 lyp = malloc(sizeof(struct nfslayout) + NFSX_V4FILELAYOUT, M_NFSDSTATE,
6959 lyp->lay_type = NFSLAYOUT_NFSV4_1_FILES;
6961 lyp->lay_flags = NFSLAY_RW;
6963 lyp->lay_flags = NFSLAY_READ;
6964 NFSBCOPY(fhp, &lyp->lay_fh, sizeof(*fhp));
6965 lyp->lay_clientid.qval = nd->nd_clientid.qval;
6966 lyp->lay_fsid = fs;
6967 NFSBCOPY(devid, lyp->lay_deviceid, NFSX_V4DEVICEID);
6970 tl = (uint32_t *)lyp->lay_xdr;
6982 lyp->lay_layoutlen = NFSX_V4FILELAYOUT;
6983 return (lyp);
7002 struct nfslayout *lyp;
7006 lyp = malloc(sizeof(struct nfslayout) + NFSX_V4FLEXLAYOUT(mirrorcnt),
7008 lyp->lay_type = NFSLAYOUT_FLEXFILE;
7010 lyp->lay_flags = NFSLAY_RW;
7012 lyp->lay_flags = NFSLAY_READ;
7013 NFSBCOPY(fhp, &lyp->lay_fh, sizeof(*fhp));
7014 lyp->lay_clientid.qval = nd->nd_clientid.qval;
7015 lyp->lay_fsid = fs;
7016 lyp->lay_mirrorcnt = mirrorcnt;
7017 NFSBCOPY(devid, lyp->lay_deviceid, NFSX_V4DEVICEID);
7020 tl = (uint32_t *)lyp->lay_xdr;
7055 lyp->lay_layoutlen = NFSX_V4FLEXLAYOUT(mirrorcnt);
7056 return (lyp);
7120 struct nfslayout *lyp, *nlyp;
7131 TAILQ_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) {
7132 if (lyp->lay_type == NFSLAYOUT_FLEXFILE &&
7133 lyp->lay_mirrorcnt > 1) {
7135 tl = lyp->lay_xdr;
7137 for (j = 0; j < lyp->lay_mirrorcnt; j++) {
7143 TAILQ_REMOVE(&lhyp->list, lyp,
7145 TAILQ_INSERT_HEAD(&loclyp, lyp,
7159 TAILQ_FOREACH_SAFE(lyp, &loclyp, lay_list, nlyp) {
7165 if (++lyp->lay_stateid.seqid == 0)
7166 lyp->lay_stateid.seqid = 1;
7167 nfsrv_recalllayout(lyp->lay_clientid, &lyp->lay_stateid,
7168 &lyp->lay_fh, lyp, 1, lyp->lay_type, p);
7169 nfsrv_freelayout(&loclyp, lyp);
7178 struct nfslayout *lyp, int changed, int laytype, NFSPROC_T *p)
7194 /* If lyp != NULL, handle an error return here. */
7195 if (error != 0 && lyp != NULL) {
7203 if ((lyp->lay_flags & NFSLAY_RECALL) != 0) {
7204 lyp->lay_flags |= NFSLAY_RETURNED;
7205 wakeup(lyp);
7223 struct nfslayout *lyp;
7231 TAILQ_FOREACH_REVERSE(lyp, &lhyp->list, nfslayouthead, lay_list) {
7232 if ((lyp->lay_flags & NFSLAY_CALLB) == 0) {
7233 lyp->lay_flags |= NFSLAY_CALLB;
7238 if (++lyp->lay_stateid.seqid == 0)
7239 lyp->lay_stateid.seqid = 1;
7240 clientid = lyp->lay_clientid;
7241 stateid = lyp->lay_stateid;
7242 NFSBCOPY(&lyp->lay_fh, &fh, sizeof(fh));
7243 laytype = lyp->lay_type;
7248 if (lyp != NULL) {
7260 &lyp);
7262 (lyp->lay_flags & NFSLAY_CALLB) != 0 &&
7263 lyp->lay_stateid.other[0] == stateid.other[0] &&
7264 lyp->lay_stateid.other[1] == stateid.other[1] &&
7265 lyp->lay_stateid.other[2] == stateid.other[2]) {
7271 nfsrv_freelayout(&lhyp->list, lyp);
7279 lyp->lay_flags &= ~NFSLAY_CALLB;
7280 TAILQ_REMOVE(&lhyp->list, lyp,
7282 TAILQ_INSERT_HEAD(&lhyp->list, lyp,
7302 struct nfslayout *lyp;
7327 layouttype, p, &lyp);
7330 stateidp->other[0] == lyp->lay_stateid.other[0] &&
7331 stateidp->other[1] == lyp->lay_stateid.other[1] &&
7332 stateidp->other[2] == lyp->lay_stateid.other[2]) {
7338 lyp->lay_stateid.seqid,
7339 lyp->lay_stateid.other[0],
7340 lyp->lay_stateid.other[1],
7341 lyp->lay_stateid.other[2],
7343 lyp->lay_flags);
7344 if (++lyp->lay_stateid.seqid == 0)
7345 lyp->lay_stateid.seqid = 1;
7346 stateidp->seqid = lyp->lay_stateid.seqid;
7350 lyp->lay_flags &= ~NFSLAY_READ;
7352 lyp->lay_flags &= ~NFSLAY_RW;
7353 if ((lyp->lay_flags & (NFSLAY_READ |
7356 lyp);
7364 TAILQ_FOREACH(lyp, &nfsrv_recalllisthead, lay_list) {
7365 if (NFSBCMP(&lyp->lay_fh, &fh,
7367 lyp->lay_clientid.qval ==
7370 lyp->lay_stateid.other[0] &&
7372 lyp->lay_stateid.other[1] &&
7374 lyp->lay_stateid.other[2]) {
7375 lyp->lay_flags |= NFSLAY_RETURNED;
7376 wakeup(lyp);
7404 struct nfslayout *lyp;
7410 TAILQ_FOREACH(lyp, &lhyp->list, lay_list) {
7411 if (NFSBCMP(&lyp->lay_fh, fhp, sizeof(*fhp)) == 0 &&
7412 lyp->lay_clientid.qval == clientidp->qval &&
7413 lyp->lay_type == laytype)
7416 if (lyp != NULL)
7417 *lypp = lyp;
7432 struct nfslayout *lyp, *nlyp;
7438 lyp = *lypp;
7439 fhp = &lyp->lay_fh;
7447 lyp->lay_stateid.seqid = stateidp->seqid = 1;
7448 lyp->lay_stateid.other[0] = stateidp->other[0] =
7450 lyp->lay_stateid.other[1] = stateidp->other[1] =
7452 lyp->lay_stateid.other[2] = stateidp->other[2] =
7465 nlyp->lay_flags |= (lyp->lay_flags & (NFSLAY_READ | NFSLAY_RW));
7482 NFSBCOPY(lyp->lay_xdr, layp, lyp->lay_layoutlen);
7483 *layoutlenp = lyp->lay_layoutlen;
7484 TAILQ_INSERT_HEAD(&lhyp->list, lyp, lay_list);
7551 struct nfslayout *lyp, *nlyp;
7557 TAILQ_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) {
7558 if (lyp->lay_clientid.qval == clientid.qval)
7559 nfsrv_freelayout(&lhyp->list, lyp);
7569 nfsrv_freelayout(struct nfslayouthead *lhp, struct nfslayout *lyp)
7572 NFSD_DEBUG(4, "Freelayout=%p\n", lyp);
7575 TAILQ_REMOVE(lhp, lyp, lay_list);
7576 free(lyp, M_NFSDSTATE);
7618 struct nfslayout *lyp, *nlyp;
7635 TAILQ_FOREACH_SAFE(lyp, &nfsrv_recalllisthead, lay_list, nlyp)
7636 nfsrv_freelayout(&nfsrv_recalllisthead, lyp);
7647 struct nfslayout *lyp, *nlyp;
7653 TAILQ_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) {
7654 if (clid->qval != lyp->lay_clientid.qval)
7656 if (fs != NULL && fsidcmp(fs, &lyp->lay_fsid) != 0)
7658 if (laytype != lyp->lay_type)
7661 lyp->lay_flags &= ~NFSLAY_READ;
7663 lyp->lay_flags &= ~NFSLAY_RW;
7664 if ((lyp->lay_flags & (NFSLAY_READ | NFSLAY_RW)) == 0)
7665 nfsrv_freelayout(&lhyp->list, lyp);
7678 struct nfslayout *lyp, *nlyp;
7682 TAILQ_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) {
7683 if (NFSBCMP(&lyp->lay_fh, fhp, sizeof(*fhp)) == 0)
7684 nfsrv_freelayout(&lhyp->list, lyp);
7696 struct nfslayout *lyp, *nlyp;
7702 TAILQ_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp)
7703 nfsrv_freelayout(&lhyp->list, lyp);
8177 struct nfslayout *lyp;
8192 TAILQ_FOREACH(lyp, &lhyp->list, lay_list) {
8193 if (NFSBCMP(&lyp->lay_fh, &fh, sizeof(fh)) == 0 &&
8194 ((lyp->lay_flags & NFSLAY_RW) != 0 ||
8195 ((lyp->lay_flags & NFSLAY_READ) != 0 &&
8198 clid[clidcnt].qval = lyp->lay_clientid.qval;
8326 struct nfslayout *lyp, *nlyp;
8379 TAILQ_FOREACH_SAFE(lyp, &lhyp->list, lay_list, nlyp) {
8380 if (NFSBCMP(&lyp->lay_fh, &fh, sizeof(fh)) == 0 &&
8381 (lyp->lay_flags & NFSLAY_RW) != 0) {
8382 TAILQ_REMOVE(&lhyp->list, lyp, lay_list);
8383 TAILQ_INSERT_HEAD(&nfsrv_recalllisthead, lyp, lay_list);
8384 lyp->lay_trycnt = 0;
8399 TAILQ_FOREACH(lyp, &nfsrv_recalllisthead, lay_list) {
8400 if (NFSBCMP(&lyp->lay_fh, &fh, sizeof(fh)) == 0 &&
8401 (lyp->lay_flags & NFSLAY_RECALL) == 0) {
8402 lyp->lay_flags |= NFSLAY_RECALL;
8407 if (++lyp->lay_stateid.seqid == 0)
8408 lyp->lay_stateid.seqid = 1;
8410 nfsrv_recalllayout(lyp->lay_clientid, &lyp->lay_stateid,
8411 &lyp->lay_fh, lyp, 0, lyp->lay_type, p);
8419 TAILQ_FOREACH(lyp, &nfsrv_recalllisthead, lay_list) {
8420 if (NFSBCMP(&lyp->lay_fh, &fh, sizeof(fh)) == 0) {
8421 if ((lyp->lay_flags & NFSLAY_RETURNED) != 0) {
8422 TAILQ_REMOVE(&nfsrv_recalllisthead, lyp,
8424 TAILQ_INSERT_HEAD(&thl, lyp, lay_list);
8428 lyp->lay_trycnt++;
8429 ret = mtx_sleep(lyp, NFSDRECALLMUTEXPTR,
8435 if ((lyp->lay_flags & NFSLAY_RETURNED) == 0) {
8446 if (lyp->lay_trycnt >= 60) {
8462 TAILQ_FOREACH_SAFE(lyp, &thl, lay_list, nlyp)
8463 nfsrv_freelayout(&thl, lyp);
8879 struct nfslayout *lyp;
8895 TAILQ_FOREACH(lyp, &lhyp->list, lay_list) {
8896 if (NFSBCMP(lyp->lay_deviceid, devid,
8901 lyp->lay_flags |= NFSLAY_NOSPC;
8903 lyp->lay_flags &= ~NFSLAY_NOSPC;