aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2015-01-30 04:16:33 -0500
committerJan Kara <jack@suse.cz>2015-01-30 04:16:33 -0500
commit1cd6b7be92016538ea1f2a8e1f955e9b974d93ea (patch)
tree77ca10be1da7aaf19cde95de0cb9c4bfcde636a0 /fs/xfs
parenta39427007e7ccd83dbb7cd81b18156cebeab4d1e (diff)
parent14bf61ffe6ac54afcd1e888a4407fe16054483db (diff)
Merge branch 'for_linus' into for_next
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/xfs_qm.h4
-rw-r--r--fs/xfs/xfs_qm_syscalls.c156
-rw-r--r--fs/xfs/xfs_quotaops.c8
3 files changed, 72 insertions, 96 deletions
diff --git a/fs/xfs/xfs_qm.h b/fs/xfs/xfs_qm.h
index 3a07a937e232..41f6c0b9d51c 100644
--- a/fs/xfs/xfs_qm.h
+++ b/fs/xfs/xfs_qm.h
@@ -166,9 +166,9 @@ extern void xfs_qm_dqrele_all_inodes(struct xfs_mount *, uint);
166/* quota ops */ 166/* quota ops */
167extern int xfs_qm_scall_trunc_qfiles(struct xfs_mount *, uint); 167extern int xfs_qm_scall_trunc_qfiles(struct xfs_mount *, uint);
168extern int xfs_qm_scall_getquota(struct xfs_mount *, xfs_dqid_t, 168extern int xfs_qm_scall_getquota(struct xfs_mount *, xfs_dqid_t,
169 uint, struct fs_disk_quota *); 169 uint, struct qc_dqblk *);
170extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint, 170extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint,
171 struct fs_disk_quota *); 171 struct qc_dqblk *);
172extern int xfs_qm_scall_getqstat(struct xfs_mount *, 172extern int xfs_qm_scall_getqstat(struct xfs_mount *,
173 struct fs_quota_stat *); 173 struct fs_quota_stat *);
174extern int xfs_qm_scall_getqstatv(struct xfs_mount *, 174extern int xfs_qm_scall_getqstatv(struct xfs_mount *,
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
index 42a15ddedb07..d56a4f5155d5 100644
--- a/fs/xfs/xfs_qm_syscalls.c
+++ b/fs/xfs/xfs_qm_syscalls.c
@@ -39,7 +39,6 @@ STATIC int xfs_qm_log_quotaoff(xfs_mount_t *, xfs_qoff_logitem_t **, uint);
39STATIC int xfs_qm_log_quotaoff_end(xfs_mount_t *, xfs_qoff_logitem_t *, 39STATIC int xfs_qm_log_quotaoff_end(xfs_mount_t *, xfs_qoff_logitem_t *,
40 uint); 40 uint);
41STATIC uint xfs_qm_export_flags(uint); 41STATIC uint xfs_qm_export_flags(uint);
42STATIC uint xfs_qm_export_qtype_flags(uint);
43 42
44/* 43/*
45 * Turn off quota accounting and/or enforcement for all udquots and/or 44 * Turn off quota accounting and/or enforcement for all udquots and/or
@@ -547,8 +546,8 @@ xfs_qm_scall_getqstatv(
547 return 0; 546 return 0;
548} 547}
549 548
550#define XFS_DQ_MASK \ 549#define XFS_QC_MASK \
551 (FS_DQ_LIMIT_MASK | FS_DQ_TIMER_MASK | FS_DQ_WARNS_MASK) 550 (QC_LIMIT_MASK | QC_TIMER_MASK | QC_WARNS_MASK)
552 551
553/* 552/*
554 * Adjust quota limits, and start/stop timers accordingly. 553 * Adjust quota limits, and start/stop timers accordingly.
@@ -558,7 +557,7 @@ xfs_qm_scall_setqlim(
558 struct xfs_mount *mp, 557 struct xfs_mount *mp,
559 xfs_dqid_t id, 558 xfs_dqid_t id,
560 uint type, 559 uint type,
561 fs_disk_quota_t *newlim) 560 struct qc_dqblk *newlim)
562{ 561{
563 struct xfs_quotainfo *q = mp->m_quotainfo; 562 struct xfs_quotainfo *q = mp->m_quotainfo;
564 struct xfs_disk_dquot *ddq; 563 struct xfs_disk_dquot *ddq;
@@ -567,9 +566,9 @@ xfs_qm_scall_setqlim(
567 int error; 566 int error;
568 xfs_qcnt_t hard, soft; 567 xfs_qcnt_t hard, soft;
569 568
570 if (newlim->d_fieldmask & ~XFS_DQ_MASK) 569 if (newlim->d_fieldmask & ~XFS_QC_MASK)
571 return -EINVAL; 570 return -EINVAL;
572 if ((newlim->d_fieldmask & XFS_DQ_MASK) == 0) 571 if ((newlim->d_fieldmask & XFS_QC_MASK) == 0)
573 return 0; 572 return 0;
574 573
575 /* 574 /*
@@ -607,11 +606,11 @@ xfs_qm_scall_setqlim(
607 /* 606 /*
608 * Make sure that hardlimits are >= soft limits before changing. 607 * Make sure that hardlimits are >= soft limits before changing.
609 */ 608 */
610 hard = (newlim->d_fieldmask & FS_DQ_BHARD) ? 609 hard = (newlim->d_fieldmask & QC_SPC_HARD) ?
611 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_hardlimit) : 610 (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_spc_hardlimit) :
612 be64_to_cpu(ddq->d_blk_hardlimit); 611 be64_to_cpu(ddq->d_blk_hardlimit);
613 soft = (newlim->d_fieldmask & FS_DQ_BSOFT) ? 612 soft = (newlim->d_fieldmask & QC_SPC_SOFT) ?
614 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_blk_softlimit) : 613 (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_spc_softlimit) :
615 be64_to_cpu(ddq->d_blk_softlimit); 614 be64_to_cpu(ddq->d_blk_softlimit);
616 if (hard == 0 || hard >= soft) { 615 if (hard == 0 || hard >= soft) {
617 ddq->d_blk_hardlimit = cpu_to_be64(hard); 616 ddq->d_blk_hardlimit = cpu_to_be64(hard);
@@ -624,11 +623,11 @@ xfs_qm_scall_setqlim(
624 } else { 623 } else {
625 xfs_debug(mp, "blkhard %Ld < blksoft %Ld", hard, soft); 624 xfs_debug(mp, "blkhard %Ld < blksoft %Ld", hard, soft);
626 } 625 }
627 hard = (newlim->d_fieldmask & FS_DQ_RTBHARD) ? 626 hard = (newlim->d_fieldmask & QC_RT_SPC_HARD) ?
628 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_hardlimit) : 627 (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_rt_spc_hardlimit) :
629 be64_to_cpu(ddq->d_rtb_hardlimit); 628 be64_to_cpu(ddq->d_rtb_hardlimit);
630 soft = (newlim->d_fieldmask & FS_DQ_RTBSOFT) ? 629 soft = (newlim->d_fieldmask & QC_RT_SPC_SOFT) ?
631 (xfs_qcnt_t) XFS_BB_TO_FSB(mp, newlim->d_rtb_softlimit) : 630 (xfs_qcnt_t) XFS_B_TO_FSB(mp, newlim->d_rt_spc_softlimit) :
632 be64_to_cpu(ddq->d_rtb_softlimit); 631 be64_to_cpu(ddq->d_rtb_softlimit);
633 if (hard == 0 || hard >= soft) { 632 if (hard == 0 || hard >= soft) {
634 ddq->d_rtb_hardlimit = cpu_to_be64(hard); 633 ddq->d_rtb_hardlimit = cpu_to_be64(hard);
@@ -641,10 +640,10 @@ xfs_qm_scall_setqlim(
641 xfs_debug(mp, "rtbhard %Ld < rtbsoft %Ld", hard, soft); 640 xfs_debug(mp, "rtbhard %Ld < rtbsoft %Ld", hard, soft);
642 } 641 }
643 642
644 hard = (newlim->d_fieldmask & FS_DQ_IHARD) ? 643 hard = (newlim->d_fieldmask & QC_INO_HARD) ?
645 (xfs_qcnt_t) newlim->d_ino_hardlimit : 644 (xfs_qcnt_t) newlim->d_ino_hardlimit :
646 be64_to_cpu(ddq->d_ino_hardlimit); 645 be64_to_cpu(ddq->d_ino_hardlimit);
647 soft = (newlim->d_fieldmask & FS_DQ_ISOFT) ? 646 soft = (newlim->d_fieldmask & QC_INO_SOFT) ?
648 (xfs_qcnt_t) newlim->d_ino_softlimit : 647 (xfs_qcnt_t) newlim->d_ino_softlimit :
649 be64_to_cpu(ddq->d_ino_softlimit); 648 be64_to_cpu(ddq->d_ino_softlimit);
650 if (hard == 0 || hard >= soft) { 649 if (hard == 0 || hard >= soft) {
@@ -661,12 +660,12 @@ xfs_qm_scall_setqlim(
661 /* 660 /*
662 * Update warnings counter(s) if requested 661 * Update warnings counter(s) if requested
663 */ 662 */
664 if (newlim->d_fieldmask & FS_DQ_BWARNS) 663 if (newlim->d_fieldmask & QC_SPC_WARNS)
665 ddq->d_bwarns = cpu_to_be16(newlim->d_bwarns); 664 ddq->d_bwarns = cpu_to_be16(newlim->d_spc_warns);
666 if (newlim->d_fieldmask & FS_DQ_IWARNS) 665 if (newlim->d_fieldmask & QC_INO_WARNS)
667 ddq->d_iwarns = cpu_to_be16(newlim->d_iwarns); 666 ddq->d_iwarns = cpu_to_be16(newlim->d_ino_warns);
668 if (newlim->d_fieldmask & FS_DQ_RTBWARNS) 667 if (newlim->d_fieldmask & QC_RT_SPC_WARNS)
669 ddq->d_rtbwarns = cpu_to_be16(newlim->d_rtbwarns); 668 ddq->d_rtbwarns = cpu_to_be16(newlim->d_rt_spc_warns);
670 669
671 if (id == 0) { 670 if (id == 0) {
672 /* 671 /*
@@ -676,24 +675,24 @@ xfs_qm_scall_setqlim(
676 * soft and hard limit values (already done, above), and 675 * soft and hard limit values (already done, above), and
677 * for warnings. 676 * for warnings.
678 */ 677 */
679 if (newlim->d_fieldmask & FS_DQ_BTIMER) { 678 if (newlim->d_fieldmask & QC_SPC_TIMER) {
680 q->qi_btimelimit = newlim->d_btimer; 679 q->qi_btimelimit = newlim->d_spc_timer;
681 ddq->d_btimer = cpu_to_be32(newlim->d_btimer); 680 ddq->d_btimer = cpu_to_be32(newlim->d_spc_timer);
682 } 681 }
683 if (newlim->d_fieldmask & FS_DQ_ITIMER) { 682 if (newlim->d_fieldmask & QC_INO_TIMER) {
684 q->qi_itimelimit = newlim->d_itimer; 683 q->qi_itimelimit = newlim->d_ino_timer;
685 ddq->d_itimer = cpu_to_be32(newlim->d_itimer); 684 ddq->d_itimer = cpu_to_be32(newlim->d_ino_timer);
686 } 685 }
687 if (newlim->d_fieldmask & FS_DQ_RTBTIMER) { 686 if (newlim->d_fieldmask & QC_RT_SPC_TIMER) {
688 q->qi_rtbtimelimit = newlim->d_rtbtimer; 687 q->qi_rtbtimelimit = newlim->d_rt_spc_timer;
689 ddq->d_rtbtimer = cpu_to_be32(newlim->d_rtbtimer); 688 ddq->d_rtbtimer = cpu_to_be32(newlim->d_rt_spc_timer);
690 } 689 }
691 if (newlim->d_fieldmask & FS_DQ_BWARNS) 690 if (newlim->d_fieldmask & QC_SPC_WARNS)
692 q->qi_bwarnlimit = newlim->d_bwarns; 691 q->qi_bwarnlimit = newlim->d_spc_warns;
693 if (newlim->d_fieldmask & FS_DQ_IWARNS) 692 if (newlim->d_fieldmask & QC_INO_WARNS)
694 q->qi_iwarnlimit = newlim->d_iwarns; 693 q->qi_iwarnlimit = newlim->d_ino_warns;
695 if (newlim->d_fieldmask & FS_DQ_RTBWARNS) 694 if (newlim->d_fieldmask & QC_RT_SPC_WARNS)
696 q->qi_rtbwarnlimit = newlim->d_rtbwarns; 695 q->qi_rtbwarnlimit = newlim->d_rt_spc_warns;
697 } else { 696 } else {
698 /* 697 /*
699 * If the user is now over quota, start the timelimit. 698 * If the user is now over quota, start the timelimit.
@@ -798,7 +797,7 @@ xfs_qm_scall_getquota(
798 struct xfs_mount *mp, 797 struct xfs_mount *mp,
799 xfs_dqid_t id, 798 xfs_dqid_t id,
800 uint type, 799 uint type,
801 struct fs_disk_quota *dst) 800 struct qc_dqblk *dst)
802{ 801{
803 struct xfs_dquot *dqp; 802 struct xfs_dquot *dqp;
804 int error; 803 int error;
@@ -822,28 +821,25 @@ xfs_qm_scall_getquota(
822 } 821 }
823 822
824 memset(dst, 0, sizeof(*dst)); 823 memset(dst, 0, sizeof(*dst));
825 dst->d_version = FS_DQUOT_VERSION; 824 dst->d_spc_hardlimit =
826 dst->d_flags = xfs_qm_export_qtype_flags(dqp->q_core.d_flags); 825 XFS_FSB_TO_B(mp, be64_to_cpu(dqp->q_core.d_blk_hardlimit));
827 dst->d_id = be32_to_cpu(dqp->q_core.d_id); 826 dst->d_spc_softlimit =
828 dst->d_blk_hardlimit = 827 XFS_FSB_TO_B(mp, be64_to_cpu(dqp->q_core.d_blk_softlimit));
829 XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_blk_hardlimit));
830 dst->d_blk_softlimit =
831 XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_blk_softlimit));
832 dst->d_ino_hardlimit = be64_to_cpu(dqp->q_core.d_ino_hardlimit); 828 dst->d_ino_hardlimit = be64_to_cpu(dqp->q_core.d_ino_hardlimit);
833 dst->d_ino_softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit); 829 dst->d_ino_softlimit = be64_to_cpu(dqp->q_core.d_ino_softlimit);
834 dst->d_bcount = XFS_FSB_TO_BB(mp, dqp->q_res_bcount); 830 dst->d_space = XFS_FSB_TO_B(mp, dqp->q_res_bcount);
835 dst->d_icount = dqp->q_res_icount; 831 dst->d_ino_count = dqp->q_res_icount;
836 dst->d_btimer = be32_to_cpu(dqp->q_core.d_btimer); 832 dst->d_spc_timer = be32_to_cpu(dqp->q_core.d_btimer);
837 dst->d_itimer = be32_to_cpu(dqp->q_core.d_itimer); 833 dst->d_ino_timer = be32_to_cpu(dqp->q_core.d_itimer);
838 dst->d_iwarns = be16_to_cpu(dqp->q_core.d_iwarns); 834 dst->d_ino_warns = be16_to_cpu(dqp->q_core.d_iwarns);
839 dst->d_bwarns = be16_to_cpu(dqp->q_core.d_bwarns); 835 dst->d_spc_warns = be16_to_cpu(dqp->q_core.d_bwarns);
840 dst->d_rtb_hardlimit = 836 dst->d_rt_spc_hardlimit =
841 XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_rtb_hardlimit)); 837 XFS_FSB_TO_B(mp, be64_to_cpu(dqp->q_core.d_rtb_hardlimit));
842 dst->d_rtb_softlimit = 838 dst->d_rt_spc_softlimit =
843 XFS_FSB_TO_BB(mp, be64_to_cpu(dqp->q_core.d_rtb_softlimit)); 839 XFS_FSB_TO_B(mp, be64_to_cpu(dqp->q_core.d_rtb_softlimit));
844 dst->d_rtbcount = XFS_FSB_TO_BB(mp, dqp->q_res_rtbcount); 840 dst->d_rt_space = XFS_FSB_TO_B(mp, dqp->q_res_rtbcount);
845 dst->d_rtbtimer = be32_to_cpu(dqp->q_core.d_rtbtimer); 841 dst->d_rt_spc_timer = be32_to_cpu(dqp->q_core.d_rtbtimer);
846 dst->d_rtbwarns = be16_to_cpu(dqp->q_core.d_rtbwarns); 842 dst->d_rt_spc_warns = be16_to_cpu(dqp->q_core.d_rtbwarns);
847 843
848 /* 844 /*
849 * Internally, we don't reset all the timers when quota enforcement 845 * Internally, we don't reset all the timers when quota enforcement
@@ -856,23 +852,23 @@ xfs_qm_scall_getquota(
856 dqp->q_core.d_flags == XFS_DQ_GROUP) || 852 dqp->q_core.d_flags == XFS_DQ_GROUP) ||
857 (!XFS_IS_PQUOTA_ENFORCED(mp) && 853 (!XFS_IS_PQUOTA_ENFORCED(mp) &&
858 dqp->q_core.d_flags == XFS_DQ_PROJ)) { 854 dqp->q_core.d_flags == XFS_DQ_PROJ)) {
859 dst->d_btimer = 0; 855 dst->d_spc_timer = 0;
860 dst->d_itimer = 0; 856 dst->d_ino_timer = 0;
861 dst->d_rtbtimer = 0; 857 dst->d_rt_spc_timer = 0;
862 } 858 }
863 859
864#ifdef DEBUG 860#ifdef DEBUG
865 if (((XFS_IS_UQUOTA_ENFORCED(mp) && dst->d_flags == FS_USER_QUOTA) || 861 if (((XFS_IS_UQUOTA_ENFORCED(mp) && type == XFS_DQ_USER) ||
866 (XFS_IS_GQUOTA_ENFORCED(mp) && dst->d_flags == FS_GROUP_QUOTA) || 862 (XFS_IS_GQUOTA_ENFORCED(mp) && type == XFS_DQ_GROUP) ||
867 (XFS_IS_PQUOTA_ENFORCED(mp) && dst->d_flags == FS_PROJ_QUOTA)) && 863 (XFS_IS_PQUOTA_ENFORCED(mp) && type == XFS_DQ_PROJ)) &&
868 dst->d_id != 0) { 864 id != 0) {
869 if ((dst->d_bcount > dst->d_blk_softlimit) && 865 if ((dst->d_space > dst->d_spc_softlimit) &&
870 (dst->d_blk_softlimit > 0)) { 866 (dst->d_spc_softlimit > 0)) {
871 ASSERT(dst->d_btimer != 0); 867 ASSERT(dst->d_spc_timer != 0);
872 } 868 }
873 if ((dst->d_icount > dst->d_ino_softlimit) && 869 if ((dst->d_ino_count > dst->d_ino_softlimit) &&
874 (dst->d_ino_softlimit > 0)) { 870 (dst->d_ino_softlimit > 0)) {
875 ASSERT(dst->d_itimer != 0); 871 ASSERT(dst->d_ino_timer != 0);
876 } 872 }
877 } 873 }
878#endif 874#endif
@@ -882,26 +878,6 @@ out_put:
882} 878}
883 879
884STATIC uint 880STATIC uint
885xfs_qm_export_qtype_flags(
886 uint flags)
887{
888 /*
889 * Can't be more than one, or none.
890 */
891 ASSERT((flags & (FS_PROJ_QUOTA | FS_USER_QUOTA)) !=
892 (FS_PROJ_QUOTA | FS_USER_QUOTA));
893 ASSERT((flags & (FS_PROJ_QUOTA | FS_GROUP_QUOTA)) !=
894 (FS_PROJ_QUOTA | FS_GROUP_QUOTA));
895 ASSERT((flags & (FS_USER_QUOTA | FS_GROUP_QUOTA)) !=
896 (FS_USER_QUOTA | FS_GROUP_QUOTA));
897 ASSERT((flags & (FS_PROJ_QUOTA|FS_USER_QUOTA|FS_GROUP_QUOTA)) != 0);
898
899 return (flags & XFS_DQ_USER) ?
900 FS_USER_QUOTA : (flags & XFS_DQ_PROJ) ?
901 FS_PROJ_QUOTA : FS_GROUP_QUOTA;
902}
903
904STATIC uint
905xfs_qm_export_flags( 881xfs_qm_export_flags(
906 uint flags) 882 uint flags)
907{ 883{
diff --git a/fs/xfs/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c
index 8fcd20dbf89a..a226203fa46a 100644
--- a/fs/xfs/xfs_quotaops.c
+++ b/fs/xfs/xfs_quotaops.c
@@ -131,7 +131,7 @@ STATIC int
131xfs_fs_get_dqblk( 131xfs_fs_get_dqblk(
132 struct super_block *sb, 132 struct super_block *sb,
133 struct kqid qid, 133 struct kqid qid,
134 struct fs_disk_quota *fdq) 134 struct qc_dqblk *qdq)
135{ 135{
136 struct xfs_mount *mp = XFS_M(sb); 136 struct xfs_mount *mp = XFS_M(sb);
137 137
@@ -141,14 +141,14 @@ xfs_fs_get_dqblk(
141 return -ESRCH; 141 return -ESRCH;
142 142
143 return xfs_qm_scall_getquota(mp, from_kqid(&init_user_ns, qid), 143 return xfs_qm_scall_getquota(mp, from_kqid(&init_user_ns, qid),
144 xfs_quota_type(qid.type), fdq); 144 xfs_quota_type(qid.type), qdq);
145} 145}
146 146
147STATIC int 147STATIC int
148xfs_fs_set_dqblk( 148xfs_fs_set_dqblk(
149 struct super_block *sb, 149 struct super_block *sb,
150 struct kqid qid, 150 struct kqid qid,
151 struct fs_disk_quota *fdq) 151 struct qc_dqblk *qdq)
152{ 152{
153 struct xfs_mount *mp = XFS_M(sb); 153 struct xfs_mount *mp = XFS_M(sb);
154 154
@@ -160,7 +160,7 @@ xfs_fs_set_dqblk(
160 return -ESRCH; 160 return -ESRCH;
161 161
162 return xfs_qm_scall_setqlim(mp, from_kqid(&init_user_ns, qid), 162 return xfs_qm_scall_setqlim(mp, from_kqid(&init_user_ns, qid),
163 xfs_quota_type(qid.type), fdq); 163 xfs_quota_type(qid.type), qdq);
164} 164}
165 165
166const struct quotactl_ops xfs_quotactl_operations = { 166const struct quotactl_ops xfs_quotactl_operations = {