Lines Matching refs:qfp

270 qf_get(struct quotafile *qfp, int type)
279 while ( (qfp->qf_qflags & (QTF_OPENING | QTF_CLOSING)) ) {
280 if ( (qfp->qf_qflags & QTF_OPENING) ) {
284 if ( (qfp->qf_qflags & QTF_CLOSING) ) {
285 qfp->qf_qflags |= QTF_WANTED;
286 msleep(&qfp->qf_qflags, quota_list_mtx_lock, PVFS, "qf_get", NULL);
289 if (qfp->qf_vp != NULLVP)
292 qfp->qf_qflags |= QTF_OPENING;
296 if ( (qfp->qf_qflags & QTF_CLOSING) ) {
300 qfp->qf_qflags |= QTF_CLOSING;
302 while ( (qfp->qf_qflags & QTF_OPENING) || qfp->qf_refcnt ) {
303 qfp->qf_qflags |= QTF_WANTED;
304 msleep(&qfp->qf_qflags, quota_list_mtx_lock, PVFS, "qf_get", NULL);
306 if (qfp->qf_vp == NULLVP) {
307 qfp->qf_qflags &= ~QTF_CLOSING;
318 qf_put(struct quotafile *qfp, int type)
327 qfp->qf_qflags &= ~type;
330 if ( (qfp->qf_qflags & QTF_WANTED) ) {
331 qfp->qf_qflags &= ~QTF_WANTED;
332 wakeup(&qfp->qf_qflags);
339 qf_lock(struct quotafile *qfp)
341 lck_mtx_lock(&qfp->qf_lock);
345 qf_unlock(struct quotafile *qfp)
347 lck_mtx_unlock(&qfp->qf_lock);
366 qf_ref(struct quotafile *qfp)
370 if ( (qfp->qf_qflags & (QTF_OPENING | QTF_CLOSING)) || (qfp->qf_vp == NULLVP) )
373 qfp->qf_refcnt++;
385 qf_rele(struct quotafile *qfp)
387 qfp->qf_refcnt--;
389 if ( (qfp->qf_qflags & QTF_WANTED) && qfp->qf_refcnt == 0) {
390 qfp->qf_qflags &= ~QTF_WANTED;
391 wakeup(&qfp->qf_qflags);
397 dqfileinit(struct quotafile *qfp)
399 qfp->qf_vp = NULLVP;
400 qfp->qf_qflags = 0;
402 lck_mtx_init(&qfp->qf_lock, qf_lck_grp, qf_lck_attr);
412 dqfileopen(struct quotafile *qfp, int type)
422 context.vc_ucred = qfp->qf_cred;
425 if ((error = vnode_size(qfp->qf_vp, &file_size, &context)) != 0)
432 error = VNOP_READ(qfp->qf_vp, auio, 0, &context);
449 qfp->qf_btime = OSSwapBigToHostInt32(header.dqh_btime);
451 qfp->qf_btime = MAX_DQ_TIME;
453 qfp->qf_itime = OSSwapBigToHostInt32(header.dqh_itime);
455 qfp->qf_itime = MAX_IQ_TIME;
458 qfp->qf_maxentries = OSSwapBigToHostInt32(header.dqh_maxentries);
459 qfp->qf_entrycnt = OSSwapBigToHostInt32(header.dqh_entrycnt);
460 qfp->qf_shift = dqhashshift(qfp->qf_maxentries);
469 dqfileclose(struct quotafile *qfp, __unused int type)
481 context.vc_ucred = qfp->qf_cred;
483 if (VNOP_READ(qfp->qf_vp, auio, 0, &context) == 0) {
484 header.dqh_entrycnt = OSSwapHostToBigInt32(qfp->qf_entrycnt);
487 (void) VNOP_WRITE(qfp->qf_vp, auio, 0, &context);
497 dqget(u_int32_t id, struct quotafile *qfp, int type, struct dquot **dqp)
512 if ( id == 0 || qfp->qf_vp == NULLVP ) {
518 if ( (qf_ref(qfp)) ) {
524 if ( (dqvp = qfp->qf_vp) == NULLVP ) {
525 qf_rele(qfp);
580 qf_rele(qfp);
639 qf_rele(qfp);
712 dq->dq_qfile = qfp;
734 error = dqlookup(qfp, id, &dq->dq_dqb, &dq->dq_index);
748 qf_rele(qfp);
768 dq->dq_btime = tv.tv_sec + qfp->qf_btime;
770 dq->dq_itime = tv.tv_sec + qfp->qf_itime;
774 qf_rele(qfp);
787 dqlookup(struct quotafile *qfp, u_int32_t id, struct dqblk *dqb, uint32_t *index)
798 qf_lock(qfp);
800 dqvp = qfp->qf_vp;
803 context.vc_ucred = qfp->qf_cred;
805 mask = qfp->qf_maxentries - 1;
806 i = dqhash1(id, qfp->qf_shift, mask);
809 for (last = (i + (qfp->qf_maxentries-1) * skip) & mask;
841 ++qfp->qf_entrycnt;
859 qf_unlock(qfp);
925 dqsync_orphans(struct quotafile *qfp)
932 if (dq->dq_qfile != qfp)
937 if (dq->dq_qfile != qfp) {