diff options
Diffstat (limited to 'fs/xfs/quota/xfs_qm_syscalls.c')
-rw-r--r-- | fs/xfs/quota/xfs_qm_syscalls.c | 162 |
1 files changed, 78 insertions, 84 deletions
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c index 50bee07d6b0e..92b002f1805f 100644 --- a/fs/xfs/quota/xfs_qm_syscalls.c +++ b/fs/xfs/quota/xfs_qm_syscalls.c | |||
@@ -79,6 +79,7 @@ xfs_qm_scall_quotaoff( | |||
79 | xfs_mount_t *mp, | 79 | xfs_mount_t *mp, |
80 | uint flags) | 80 | uint flags) |
81 | { | 81 | { |
82 | struct xfs_quotainfo *q = mp->m_quotainfo; | ||
82 | uint dqtype; | 83 | uint dqtype; |
83 | int error; | 84 | int error; |
84 | uint inactivate_flags; | 85 | uint inactivate_flags; |
@@ -102,11 +103,8 @@ xfs_qm_scall_quotaoff( | |||
102 | * critical thing. | 103 | * critical thing. |
103 | * If quotaoff, then we must be dealing with the root filesystem. | 104 | * If quotaoff, then we must be dealing with the root filesystem. |
104 | */ | 105 | */ |
105 | ASSERT(mp->m_quotainfo); | 106 | ASSERT(q); |
106 | if (mp->m_quotainfo) | 107 | mutex_lock(&q->qi_quotaofflock); |
107 | mutex_lock(&(XFS_QI_QOFFLOCK(mp))); | ||
108 | |||
109 | ASSERT(mp->m_quotainfo); | ||
110 | 108 | ||
111 | /* | 109 | /* |
112 | * If we're just turning off quota enforcement, change mp and go. | 110 | * If we're just turning off quota enforcement, change mp and go. |
@@ -117,7 +115,7 @@ xfs_qm_scall_quotaoff( | |||
117 | spin_lock(&mp->m_sb_lock); | 115 | spin_lock(&mp->m_sb_lock); |
118 | mp->m_sb.sb_qflags = mp->m_qflags; | 116 | mp->m_sb.sb_qflags = mp->m_qflags; |
119 | spin_unlock(&mp->m_sb_lock); | 117 | spin_unlock(&mp->m_sb_lock); |
120 | mutex_unlock(&(XFS_QI_QOFFLOCK(mp))); | 118 | mutex_unlock(&q->qi_quotaofflock); |
121 | 119 | ||
122 | /* XXX what to do if error ? Revert back to old vals incore ? */ | 120 | /* XXX what to do if error ? Revert back to old vals incore ? */ |
123 | error = xfs_qm_write_sb_changes(mp, XFS_SB_QFLAGS); | 121 | error = xfs_qm_write_sb_changes(mp, XFS_SB_QFLAGS); |
@@ -150,10 +148,8 @@ xfs_qm_scall_quotaoff( | |||
150 | * Nothing to do? Don't complain. This happens when we're just | 148 | * Nothing to do? Don't complain. This happens when we're just |
151 | * turning off quota enforcement. | 149 | * turning off quota enforcement. |
152 | */ | 150 | */ |
153 | if ((mp->m_qflags & flags) == 0) { | 151 | if ((mp->m_qflags & flags) == 0) |
154 | mutex_unlock(&(XFS_QI_QOFFLOCK(mp))); | 152 | goto out_unlock; |
155 | return (0); | ||
156 | } | ||
157 | 153 | ||
158 | /* | 154 | /* |
159 | * Write the LI_QUOTAOFF log record, and do SB changes atomically, | 155 | * Write the LI_QUOTAOFF log record, and do SB changes atomically, |
@@ -162,7 +158,7 @@ xfs_qm_scall_quotaoff( | |||
162 | */ | 158 | */ |
163 | error = xfs_qm_log_quotaoff(mp, &qoffstart, flags); | 159 | error = xfs_qm_log_quotaoff(mp, &qoffstart, flags); |
164 | if (error) | 160 | if (error) |
165 | goto out_error; | 161 | goto out_unlock; |
166 | 162 | ||
167 | /* | 163 | /* |
168 | * Next we clear the XFS_MOUNT_*DQ_ACTIVE bit(s) in the mount struct | 164 | * Next we clear the XFS_MOUNT_*DQ_ACTIVE bit(s) in the mount struct |
@@ -204,7 +200,7 @@ xfs_qm_scall_quotaoff( | |||
204 | * So, if we couldn't purge all the dquots from the filesystem, | 200 | * So, if we couldn't purge all the dquots from the filesystem, |
205 | * we can't get rid of the incore data structures. | 201 | * we can't get rid of the incore data structures. |
206 | */ | 202 | */ |
207 | while ((nculprits = xfs_qm_dqpurge_all(mp, dqtype|XFS_QMOPT_QUOTAOFF))) | 203 | while ((nculprits = xfs_qm_dqpurge_all(mp, dqtype))) |
208 | delay(10 * nculprits); | 204 | delay(10 * nculprits); |
209 | 205 | ||
210 | /* | 206 | /* |
@@ -222,7 +218,7 @@ xfs_qm_scall_quotaoff( | |||
222 | if (error) { | 218 | if (error) { |
223 | /* We're screwed now. Shutdown is the only option. */ | 219 | /* We're screwed now. Shutdown is the only option. */ |
224 | xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); | 220 | xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE); |
225 | goto out_error; | 221 | goto out_unlock; |
226 | } | 222 | } |
227 | 223 | ||
228 | /* | 224 | /* |
@@ -230,27 +226,26 @@ xfs_qm_scall_quotaoff( | |||
230 | */ | 226 | */ |
231 | if (((flags & XFS_MOUNT_QUOTA_ALL) == XFS_MOUNT_QUOTA_SET1) || | 227 | if (((flags & XFS_MOUNT_QUOTA_ALL) == XFS_MOUNT_QUOTA_SET1) || |
232 | ((flags & XFS_MOUNT_QUOTA_ALL) == XFS_MOUNT_QUOTA_SET2)) { | 228 | ((flags & XFS_MOUNT_QUOTA_ALL) == XFS_MOUNT_QUOTA_SET2)) { |
233 | mutex_unlock(&(XFS_QI_QOFFLOCK(mp))); | 229 | mutex_unlock(&q->qi_quotaofflock); |
234 | xfs_qm_destroy_quotainfo(mp); | 230 | xfs_qm_destroy_quotainfo(mp); |
235 | return (0); | 231 | return (0); |
236 | } | 232 | } |
237 | 233 | ||
238 | /* | 234 | /* |
239 | * Release our quotainode references, and vn_purge them, | 235 | * Release our quotainode references if we don't need them anymore. |
240 | * if we don't need them anymore. | ||
241 | */ | 236 | */ |
242 | if ((dqtype & XFS_QMOPT_UQUOTA) && XFS_QI_UQIP(mp)) { | 237 | if ((dqtype & XFS_QMOPT_UQUOTA) && q->qi_uquotaip) { |
243 | IRELE(XFS_QI_UQIP(mp)); | 238 | IRELE(q->qi_uquotaip); |
244 | XFS_QI_UQIP(mp) = NULL; | 239 | q->qi_uquotaip = NULL; |
245 | } | 240 | } |
246 | if ((dqtype & (XFS_QMOPT_GQUOTA|XFS_QMOPT_PQUOTA)) && XFS_QI_GQIP(mp)) { | 241 | if ((dqtype & (XFS_QMOPT_GQUOTA|XFS_QMOPT_PQUOTA)) && q->qi_gquotaip) { |
247 | IRELE(XFS_QI_GQIP(mp)); | 242 | IRELE(q->qi_gquotaip); |
248 | XFS_QI_GQIP(mp) = NULL; | 243 | q->qi_gquotaip = NULL; |
249 | } | 244 | } |
250 | out_error: | ||
251 | mutex_unlock(&(XFS_QI_QOFFLOCK(mp))); | ||
252 | 245 | ||
253 | return (error); | 246 | out_unlock: |
247 | mutex_unlock(&q->qi_quotaofflock); | ||
248 | return error; | ||
254 | } | 249 | } |
255 | 250 | ||
256 | int | 251 | int |
@@ -379,9 +374,9 @@ xfs_qm_scall_quotaon( | |||
379 | /* | 374 | /* |
380 | * Switch on quota enforcement in core. | 375 | * Switch on quota enforcement in core. |
381 | */ | 376 | */ |
382 | mutex_lock(&(XFS_QI_QOFFLOCK(mp))); | 377 | mutex_lock(&mp->m_quotainfo->qi_quotaofflock); |
383 | mp->m_qflags |= (flags & XFS_ALL_QUOTA_ENFD); | 378 | mp->m_qflags |= (flags & XFS_ALL_QUOTA_ENFD); |
384 | mutex_unlock(&(XFS_QI_QOFFLOCK(mp))); | 379 | mutex_unlock(&mp->m_quotainfo->qi_quotaofflock); |
385 | 380 | ||
386 | return (0); | 381 | return (0); |
387 | } | 382 | } |
@@ -392,11 +387,12 @@ xfs_qm_scall_quotaon( | |||
392 | */ | 387 | */ |
393 | int | 388 | int |
394 | xfs_qm_scall_getqstat( | 389 | xfs_qm_scall_getqstat( |
395 | xfs_mount_t *mp, | 390 | struct xfs_mount *mp, |
396 | fs_quota_stat_t *out) | 391 | struct fs_quota_stat *out) |
397 | { | 392 | { |
398 | xfs_inode_t *uip, *gip; | 393 | struct xfs_quotainfo *q = mp->m_quotainfo; |
399 | boolean_t tempuqip, tempgqip; | 394 | struct xfs_inode *uip, *gip; |
395 | boolean_t tempuqip, tempgqip; | ||
400 | 396 | ||
401 | uip = gip = NULL; | 397 | uip = gip = NULL; |
402 | tempuqip = tempgqip = B_FALSE; | 398 | tempuqip = tempgqip = B_FALSE; |
@@ -415,9 +411,9 @@ xfs_qm_scall_getqstat( | |||
415 | out->qs_uquota.qfs_ino = mp->m_sb.sb_uquotino; | 411 | out->qs_uquota.qfs_ino = mp->m_sb.sb_uquotino; |
416 | out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino; | 412 | out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino; |
417 | 413 | ||
418 | if (mp->m_quotainfo) { | 414 | if (q) { |
419 | uip = mp->m_quotainfo->qi_uquotaip; | 415 | uip = q->qi_uquotaip; |
420 | gip = mp->m_quotainfo->qi_gquotaip; | 416 | gip = q->qi_gquotaip; |
421 | } | 417 | } |
422 | if (!uip && mp->m_sb.sb_uquotino != NULLFSINO) { | 418 | if (!uip && mp->m_sb.sb_uquotino != NULLFSINO) { |
423 | if (xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, | 419 | if (xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, |
@@ -441,17 +437,20 @@ xfs_qm_scall_getqstat( | |||
441 | if (tempgqip) | 437 | if (tempgqip) |
442 | IRELE(gip); | 438 | IRELE(gip); |
443 | } | 439 | } |
444 | if (mp->m_quotainfo) { | 440 | if (q) { |
445 | out->qs_incoredqs = XFS_QI_MPLNDQUOTS(mp); | 441 | out->qs_incoredqs = q->qi_dquots; |
446 | out->qs_btimelimit = XFS_QI_BTIMELIMIT(mp); | 442 | out->qs_btimelimit = q->qi_btimelimit; |
447 | out->qs_itimelimit = XFS_QI_ITIMELIMIT(mp); | 443 | out->qs_itimelimit = q->qi_itimelimit; |
448 | out->qs_rtbtimelimit = XFS_QI_RTBTIMELIMIT(mp); | 444 | out->qs_rtbtimelimit = q->qi_rtbtimelimit; |
449 | out->qs_bwarnlimit = XFS_QI_BWARNLIMIT(mp); | 445 | out->qs_bwarnlimit = q->qi_bwarnlimit; |
450 | out->qs_iwarnlimit = XFS_QI_IWARNLIMIT(mp); | 446 | out->qs_iwarnlimit = q->qi_iwarnlimit; |
451 | } | 447 | } |
452 | return (0); | 448 | return 0; |
453 | } | 449 | } |
454 | 450 | ||
451 | #define XFS_DQ_MASK \ | ||
452 | (FS_DQ_LIMIT_MASK | FS_DQ_TIMER_MASK | FS_DQ_WARNS_MASK) | ||
453 | |||
455 | /* | 454 | /* |
456 | * Adjust quota limits, and start/stop timers accordingly. | 455 | * Adjust quota limits, and start/stop timers accordingly. |
457 | */ | 456 | */ |
@@ -462,15 +461,17 @@ xfs_qm_scall_setqlim( | |||
462 | uint type, | 461 | uint type, |
463 | fs_disk_quota_t *newlim) | 462 | fs_disk_quota_t *newlim) |
464 | { | 463 | { |
464 | struct xfs_quotainfo *q = mp->m_quotainfo; | ||
465 | xfs_disk_dquot_t *ddq; | 465 | xfs_disk_dquot_t *ddq; |
466 | xfs_dquot_t *dqp; | 466 | xfs_dquot_t *dqp; |
467 | xfs_trans_t *tp; | 467 | xfs_trans_t *tp; |
468 | int error; | 468 | int error; |
469 | xfs_qcnt_t hard, soft; | 469 | xfs_qcnt_t hard, soft; |
470 | 470 | ||
471 | if ((newlim->d_fieldmask & | 471 | if (newlim->d_fieldmask & ~XFS_DQ_MASK) |
472 | (FS_DQ_LIMIT_MASK|FS_DQ_TIMER_MASK|FS_DQ_WARNS_MASK)) == 0) | 472 | return EINVAL; |
473 | return (0); | 473 | if ((newlim->d_fieldmask & XFS_DQ_MASK) == 0) |
474 | return 0; | ||
474 | 475 | ||
475 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SETQLIM); | 476 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SETQLIM); |
476 | if ((error = xfs_trans_reserve(tp, 0, sizeof(xfs_disk_dquot_t) + 128, | 477 | if ((error = xfs_trans_reserve(tp, 0, sizeof(xfs_disk_dquot_t) + 128, |
@@ -485,7 +486,7 @@ xfs_qm_scall_setqlim( | |||
485 | * a quotaoff from happening). (XXXThis doesn't currently happen | 486 | * a quotaoff from happening). (XXXThis doesn't currently happen |
486 | * because we take the vfslock before calling xfs_qm_sysent). | 487 | * because we take the vfslock before calling xfs_qm_sysent). |
487 | */ | 488 | */ |
488 | mutex_lock(&(XFS_QI_QOFFLOCK(mp))); | 489 | mutex_lock(&q->qi_quotaofflock); |
489 | 490 | ||
490 | /* | 491 | /* |
491 | * Get the dquot (locked), and join it to the transaction. | 492 | * Get the dquot (locked), and join it to the transaction. |
@@ -493,9 +494,8 @@ xfs_qm_scall_setqlim( | |||
493 | */ | 494 | */ |
494 | if ((error = xfs_qm_dqget(mp, NULL, id, type, XFS_QMOPT_DQALLOC, &dqp))) { | 495 | if ((error = xfs_qm_dqget(mp, NULL, id, type, XFS_QMOPT_DQALLOC, &dqp))) { |
495 | xfs_trans_cancel(tp, XFS_TRANS_ABORT); | 496 | xfs_trans_cancel(tp, XFS_TRANS_ABORT); |
496 | mutex_unlock(&(XFS_QI_QOFFLOCK(mp))); | ||
497 | ASSERT(error != ENOENT); | 497 | ASSERT(error != ENOENT); |
498 | return (error); | 498 | goto out_unlock; |
499 | } | 499 | } |
500 | xfs_trans_dqjoin(tp, dqp); | 500 | xfs_trans_dqjoin(tp, dqp); |
501 | ddq = &dqp->q_core; | 501 | ddq = &dqp->q_core; |
@@ -513,8 +513,8 @@ xfs_qm_scall_setqlim( | |||
513 | ddq->d_blk_hardlimit = cpu_to_be64(hard); | 513 | ddq->d_blk_hardlimit = cpu_to_be64(hard); |
514 | ddq->d_blk_softlimit = cpu_to_be64(soft); | 514 | ddq->d_blk_softlimit = cpu_to_be64(soft); |
515 | if (id == 0) { | 515 | if (id == 0) { |
516 | mp->m_quotainfo->qi_bhardlimit = hard; | 516 | q->qi_bhardlimit = hard; |
517 | mp->m_quotainfo->qi_bsoftlimit = soft; | 517 | q->qi_bsoftlimit = soft; |
518 | } | 518 | } |
519 | } else { | 519 | } else { |
520 | qdprintk("blkhard %Ld < blksoft %Ld\n", hard, soft); | 520 | qdprintk("blkhard %Ld < blksoft %Ld\n", hard, soft); |
@@ -529,8 +529,8 @@ xfs_qm_scall_setqlim( | |||
529 | ddq->d_rtb_hardlimit = cpu_to_be64(hard); | 529 | ddq->d_rtb_hardlimit = cpu_to_be64(hard); |
530 | ddq->d_rtb_softlimit = cpu_to_be64(soft); | 530 | ddq->d_rtb_softlimit = cpu_to_be64(soft); |
531 | if (id == 0) { | 531 | if (id == 0) { |
532 | mp->m_quotainfo->qi_rtbhardlimit = hard; | 532 | q->qi_rtbhardlimit = hard; |
533 | mp->m_quotainfo->qi_rtbsoftlimit = soft; | 533 | q->qi_rtbsoftlimit = soft; |
534 | } | 534 | } |
535 | } else { | 535 | } else { |
536 | qdprintk("rtbhard %Ld < rtbsoft %Ld\n", hard, soft); | 536 | qdprintk("rtbhard %Ld < rtbsoft %Ld\n", hard, soft); |
@@ -546,8 +546,8 @@ xfs_qm_scall_setqlim( | |||
546 | ddq->d_ino_hardlimit = cpu_to_be64(hard); | 546 | ddq->d_ino_hardlimit = cpu_to_be64(hard); |
547 | ddq->d_ino_softlimit = cpu_to_be64(soft); | 547 | ddq->d_ino_softlimit = cpu_to_be64(soft); |
548 | if (id == 0) { | 548 | if (id == 0) { |
549 | mp->m_quotainfo->qi_ihardlimit = hard; | 549 | q->qi_ihardlimit = hard; |
550 | mp->m_quotainfo->qi_isoftlimit = soft; | 550 | q->qi_isoftlimit = soft; |
551 | } | 551 | } |
552 | } else { | 552 | } else { |
553 | qdprintk("ihard %Ld < isoft %Ld\n", hard, soft); | 553 | qdprintk("ihard %Ld < isoft %Ld\n", hard, soft); |
@@ -572,23 +572,23 @@ xfs_qm_scall_setqlim( | |||
572 | * for warnings. | 572 | * for warnings. |
573 | */ | 573 | */ |
574 | if (newlim->d_fieldmask & FS_DQ_BTIMER) { | 574 | if (newlim->d_fieldmask & FS_DQ_BTIMER) { |
575 | mp->m_quotainfo->qi_btimelimit = newlim->d_btimer; | 575 | q->qi_btimelimit = newlim->d_btimer; |
576 | ddq->d_btimer = cpu_to_be32(newlim->d_btimer); | 576 | ddq->d_btimer = cpu_to_be32(newlim->d_btimer); |
577 | } | 577 | } |
578 | if (newlim->d_fieldmask & FS_DQ_ITIMER) { | 578 | if (newlim->d_fieldmask & FS_DQ_ITIMER) { |
579 | mp->m_quotainfo->qi_itimelimit = newlim->d_itimer; | 579 | q->qi_itimelimit = newlim->d_itimer; |
580 | ddq->d_itimer = cpu_to_be32(newlim->d_itimer); | 580 | ddq->d_itimer = cpu_to_be32(newlim->d_itimer); |
581 | } | 581 | } |
582 | if (newlim->d_fieldmask & FS_DQ_RTBTIMER) { | 582 | if (newlim->d_fieldmask & FS_DQ_RTBTIMER) { |
583 | mp->m_quotainfo->qi_rtbtimelimit = newlim->d_rtbtimer; | 583 | q->qi_rtbtimelimit = newlim->d_rtbtimer; |
584 | ddq->d_rtbtimer = cpu_to_be32(newlim->d_rtbtimer); | 584 | ddq->d_rtbtimer = cpu_to_be32(newlim->d_rtbtimer); |
585 | } | 585 | } |
586 | if (newlim->d_fieldmask & FS_DQ_BWARNS) | 586 | if (newlim->d_fieldmask & FS_DQ_BWARNS) |
587 | mp->m_quotainfo->qi_bwarnlimit = newlim->d_bwarns; | 587 | q->qi_bwarnlimit = newlim->d_bwarns; |
588 | if (newlim->d_fieldmask & FS_DQ_IWARNS) | 588 | if (newlim->d_fieldmask & FS_DQ_IWARNS) |
589 | mp->m_quotainfo->qi_iwarnlimit = newlim->d_iwarns; | 589 | q->qi_iwarnlimit = newlim->d_iwarns; |
590 | if (newlim->d_fieldmask & FS_DQ_RTBWARNS) | 590 | if (newlim->d_fieldmask & FS_DQ_RTBWARNS) |
591 | mp->m_quotainfo->qi_rtbwarnlimit = newlim->d_rtbwarns; | 591 | q->qi_rtbwarnlimit = newlim->d_rtbwarns; |
592 | } else { | 592 | } else { |
593 | /* | 593 | /* |
594 | * If the user is now over quota, start the timelimit. | 594 | * If the user is now over quota, start the timelimit. |
@@ -605,8 +605,9 @@ xfs_qm_scall_setqlim( | |||
605 | error = xfs_trans_commit(tp, 0); | 605 | error = xfs_trans_commit(tp, 0); |
606 | xfs_qm_dqprint(dqp); | 606 | xfs_qm_dqprint(dqp); |
607 | xfs_qm_dqrele(dqp); | 607 | xfs_qm_dqrele(dqp); |
608 | mutex_unlock(&(XFS_QI_QOFFLOCK(mp))); | ||
609 | 608 | ||
609 | out_unlock: | ||
610 | mutex_unlock(&q->qi_quotaofflock); | ||
610 | return error; | 611 | return error; |
611 | } | 612 | } |
612 | 613 | ||
@@ -853,7 +854,8 @@ xfs_dqrele_inode( | |||
853 | int error; | 854 | int error; |
854 | 855 | ||
855 | /* skip quota inodes */ | 856 | /* skip quota inodes */ |
856 | if (ip == XFS_QI_UQIP(ip->i_mount) || ip == XFS_QI_GQIP(ip->i_mount)) { | 857 | if (ip == ip->i_mount->m_quotainfo->qi_uquotaip || |
858 | ip == ip->i_mount->m_quotainfo->qi_gquotaip) { | ||
857 | ASSERT(ip->i_udquot == NULL); | 859 | ASSERT(ip->i_udquot == NULL); |
858 | ASSERT(ip->i_gdquot == NULL); | 860 | ASSERT(ip->i_gdquot == NULL); |
859 | read_unlock(&pag->pag_ici_lock); | 861 | read_unlock(&pag->pag_ici_lock); |
@@ -931,7 +933,8 @@ struct mutex qcheck_lock; | |||
931 | } | 933 | } |
932 | 934 | ||
933 | typedef struct dqtest { | 935 | typedef struct dqtest { |
934 | xfs_dqmarker_t q_lists; | 936 | uint dq_flags; /* various flags (XFS_DQ_*) */ |
937 | struct list_head q_hashlist; | ||
935 | xfs_dqhash_t *q_hash; /* the hashchain header */ | 938 | xfs_dqhash_t *q_hash; /* the hashchain header */ |
936 | xfs_mount_t *q_mount; /* filesystem this relates to */ | 939 | xfs_mount_t *q_mount; /* filesystem this relates to */ |
937 | xfs_dqid_t d_id; /* user id or group id */ | 940 | xfs_dqid_t d_id; /* user id or group id */ |
@@ -942,14 +945,9 @@ typedef struct dqtest { | |||
942 | STATIC void | 945 | STATIC void |
943 | xfs_qm_hashinsert(xfs_dqhash_t *h, xfs_dqtest_t *dqp) | 946 | xfs_qm_hashinsert(xfs_dqhash_t *h, xfs_dqtest_t *dqp) |
944 | { | 947 | { |
945 | xfs_dquot_t *d; | 948 | list_add(&dqp->q_hashlist, &h->qh_list); |
946 | if (((d) = (h)->qh_next)) | 949 | h->qh_version++; |
947 | (d)->HL_PREVP = &((dqp)->HL_NEXT); | 950 | h->qh_nelems++; |
948 | (dqp)->HL_NEXT = d; | ||
949 | (dqp)->HL_PREVP = &((h)->qh_next); | ||
950 | (h)->qh_next = (xfs_dquot_t *)dqp; | ||
951 | (h)->qh_version++; | ||
952 | (h)->qh_nelems++; | ||
953 | } | 951 | } |
954 | STATIC void | 952 | STATIC void |
955 | xfs_qm_dqtest_print( | 953 | xfs_qm_dqtest_print( |
@@ -1061,9 +1059,7 @@ xfs_qm_internalqcheck_dqget( | |||
1061 | xfs_dqhash_t *h; | 1059 | xfs_dqhash_t *h; |
1062 | 1060 | ||
1063 | h = DQTEST_HASH(mp, id, type); | 1061 | h = DQTEST_HASH(mp, id, type); |
1064 | for (d = (xfs_dqtest_t *) h->qh_next; d != NULL; | 1062 | list_for_each_entry(d, &h->qh_list, q_hashlist) { |
1065 | d = (xfs_dqtest_t *) d->HL_NEXT) { | ||
1066 | /* DQTEST_LIST_PRINT(h, HL_NEXT, "@@@@@ dqtestlist @@@@@"); */ | ||
1067 | if (d->d_id == id && mp == d->q_mount) { | 1063 | if (d->d_id == id && mp == d->q_mount) { |
1068 | *O_dq = d; | 1064 | *O_dq = d; |
1069 | return (0); | 1065 | return (0); |
@@ -1074,6 +1070,7 @@ xfs_qm_internalqcheck_dqget( | |||
1074 | d->d_id = id; | 1070 | d->d_id = id; |
1075 | d->q_mount = mp; | 1071 | d->q_mount = mp; |
1076 | d->q_hash = h; | 1072 | d->q_hash = h; |
1073 | INIT_LIST_HEAD(&d->q_hashlist); | ||
1077 | xfs_qm_hashinsert(h, d); | 1074 | xfs_qm_hashinsert(h, d); |
1078 | *O_dq = d; | 1075 | *O_dq = d; |
1079 | return (0); | 1076 | return (0); |
@@ -1180,8 +1177,6 @@ xfs_qm_internalqcheck( | |||
1180 | xfs_ino_t lastino; | 1177 | xfs_ino_t lastino; |
1181 | int done, count; | 1178 | int done, count; |
1182 | int i; | 1179 | int i; |
1183 | xfs_dqtest_t *d, *e; | ||
1184 | xfs_dqhash_t *h1; | ||
1185 | int error; | 1180 | int error; |
1186 | 1181 | ||
1187 | lastino = 0; | 1182 | lastino = 0; |
@@ -1221,19 +1216,18 @@ xfs_qm_internalqcheck( | |||
1221 | } | 1216 | } |
1222 | cmn_err(CE_DEBUG, "Checking results against system dquots"); | 1217 | cmn_err(CE_DEBUG, "Checking results against system dquots"); |
1223 | for (i = 0; i < qmtest_hashmask; i++) { | 1218 | for (i = 0; i < qmtest_hashmask; i++) { |
1224 | h1 = &qmtest_udqtab[i]; | 1219 | xfs_dqtest_t *d, *n; |
1225 | for (d = (xfs_dqtest_t *) h1->qh_next; d != NULL; ) { | 1220 | xfs_dqhash_t *h; |
1221 | |||
1222 | h = &qmtest_udqtab[i]; | ||
1223 | list_for_each_entry_safe(d, n, &h->qh_list, q_hashlist) { | ||
1226 | xfs_dqtest_cmp(d); | 1224 | xfs_dqtest_cmp(d); |
1227 | e = (xfs_dqtest_t *) d->HL_NEXT; | ||
1228 | kmem_free(d); | 1225 | kmem_free(d); |
1229 | d = e; | ||
1230 | } | 1226 | } |
1231 | h1 = &qmtest_gdqtab[i]; | 1227 | h = &qmtest_gdqtab[i]; |
1232 | for (d = (xfs_dqtest_t *) h1->qh_next; d != NULL; ) { | 1228 | list_for_each_entry_safe(d, n, &h->qh_list, q_hashlist) { |
1233 | xfs_dqtest_cmp(d); | 1229 | xfs_dqtest_cmp(d); |
1234 | e = (xfs_dqtest_t *) d->HL_NEXT; | ||
1235 | kmem_free(d); | 1230 | kmem_free(d); |
1236 | d = e; | ||
1237 | } | 1231 | } |
1238 | } | 1232 | } |
1239 | 1233 | ||