libceph: align session_key and con_secret to 16 bytes
[linux-2.6-microblaze.git] / fs / xfs / xfs_qm.c
index be67570..c134eb4 100644 (file)
@@ -249,7 +249,6 @@ xfs_qm_unmount_quotas(
 STATIC int
 xfs_qm_dqattach_one(
        struct xfs_inode        *ip,
-       xfs_dqid_t              id,
        xfs_dqtype_t            type,
        bool                    doalloc,
        struct xfs_dquot        **IO_idqpp)
@@ -330,23 +329,23 @@ xfs_qm_dqattach_locked(
        ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
 
        if (XFS_IS_UQUOTA_ON(mp) && !ip->i_udquot) {
-               error = xfs_qm_dqattach_one(ip, i_uid_read(VFS_I(ip)),
-                               XFS_DQTYPE_USER, doalloc, &ip->i_udquot);
+               error = xfs_qm_dqattach_one(ip, XFS_DQTYPE_USER,
+                               doalloc, &ip->i_udquot);
                if (error)
                        goto done;
                ASSERT(ip->i_udquot);
        }
 
        if (XFS_IS_GQUOTA_ON(mp) && !ip->i_gdquot) {
-               error = xfs_qm_dqattach_one(ip, i_gid_read(VFS_I(ip)),
-                               XFS_DQTYPE_GROUP, doalloc, &ip->i_gdquot);
+               error = xfs_qm_dqattach_one(ip, XFS_DQTYPE_GROUP,
+                               doalloc, &ip->i_gdquot);
                if (error)
                        goto done;
                ASSERT(ip->i_gdquot);
        }
 
        if (XFS_IS_PQUOTA_ON(mp) && !ip->i_pdquot) {
-               error = xfs_qm_dqattach_one(ip, ip->i_d.di_projid, XFS_DQTYPE_PROJ,
+               error = xfs_qm_dqattach_one(ip, XFS_DQTYPE_PROJ,
                                doalloc, &ip->i_pdquot);
                if (error)
                        goto done;
@@ -661,6 +660,17 @@ xfs_qm_init_quotainfo(
        /* Precalc some constants */
        qinf->qi_dqchunklen = XFS_FSB_TO_BB(mp, XFS_DQUOT_CLUSTER_SIZE_FSB);
        qinf->qi_dqperchunk = xfs_calc_dquots_per_chunk(qinf->qi_dqchunklen);
+       if (xfs_sb_version_hasbigtime(&mp->m_sb)) {
+               qinf->qi_expiry_min =
+                       xfs_dq_bigtime_to_unix(XFS_DQ_BIGTIME_EXPIRY_MIN);
+               qinf->qi_expiry_max =
+                       xfs_dq_bigtime_to_unix(XFS_DQ_BIGTIME_EXPIRY_MAX);
+       } else {
+               qinf->qi_expiry_min = XFS_DQ_LEGACY_EXPIRY_MIN;
+               qinf->qi_expiry_max = XFS_DQ_LEGACY_EXPIRY_MAX;
+       }
+       trace_xfs_quota_expiry_range(mp, qinf->qi_expiry_min,
+                       qinf->qi_expiry_max);
 
        mp->m_qflags |= (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_CHKD);
 
@@ -727,15 +737,15 @@ xfs_qm_destroy_quotainfo(
  */
 STATIC int
 xfs_qm_qino_alloc(
-       xfs_mount_t     *mp,
-       xfs_inode_t     **ip,
-       uint            flags)
+       struct xfs_mount        *mp,
+       struct xfs_inode        **ipp,
+       unsigned int            flags)
 {
-       xfs_trans_t     *tp;
-       int             error;
-       bool            need_alloc = true;
+       struct xfs_trans        *tp;
+       int                     error;
+       bool                    need_alloc = true;
 
-       *ip = NULL;
+       *ipp = NULL;
        /*
         * With superblock that doesn't have separate pquotino, we
         * share an inode between gquota and pquota. If the on-disk
@@ -761,7 +771,7 @@ xfs_qm_qino_alloc(
                                return -EFSCORRUPTED;
                }
                if (ino != NULLFSINO) {
-                       error = xfs_iget(mp, NULL, ino, 0, 0, ip);
+                       error = xfs_iget(mp, NULL, ino, 0, 0, ipp);
                        if (error)
                                return error;
                        mp->m_sb.sb_gquotino = NULLFSINO;
@@ -777,7 +787,7 @@ xfs_qm_qino_alloc(
                return error;
 
        if (need_alloc) {
-               error = xfs_dir_ialloc(&tp, NULL, S_IFREG, 1, 0, 0, ip);
+               error = xfs_dir_ialloc(&tp, NULL, S_IFREG, 1, 0, 0, ipp);
                if (error) {
                        xfs_trans_cancel(tp);
                        return error;
@@ -802,11 +812,11 @@ xfs_qm_qino_alloc(
                mp->m_sb.sb_qflags = mp->m_qflags & XFS_ALL_QUOTA_ACCT;
        }
        if (flags & XFS_QMOPT_UQUOTA)
-               mp->m_sb.sb_uquotino = (*ip)->i_ino;
+               mp->m_sb.sb_uquotino = (*ipp)->i_ino;
        else if (flags & XFS_QMOPT_GQUOTA)
-               mp->m_sb.sb_gquotino = (*ip)->i_ino;
+               mp->m_sb.sb_gquotino = (*ipp)->i_ino;
        else
-               mp->m_sb.sb_pquotino = (*ip)->i_ino;
+               mp->m_sb.sb_pquotino = (*ipp)->i_ino;
        spin_unlock(&mp->m_sb_lock);
        xfs_log_sb(tp);
 
@@ -816,7 +826,7 @@ xfs_qm_qino_alloc(
                xfs_alert(mp, "%s failed (error %d)!", __func__, error);
        }
        if (need_alloc)
-               xfs_finish_inode_setup(*ip);
+               xfs_finish_inode_setup(*ipp);
        return error;
 }
 
@@ -879,6 +889,8 @@ xfs_qm_reset_dqcounts(
                        ddq->d_bwarns = 0;
                        ddq->d_iwarns = 0;
                        ddq->d_rtbwarns = 0;
+                       if (xfs_sb_version_hasbigtime(&mp->m_sb))
+                               ddq->d_type |= XFS_DQTYPE_BIGTIME;
                }
 
                if (xfs_sb_version_hascrc(&mp->m_sb)) {
@@ -1650,6 +1662,7 @@ xfs_qm_vop_dqalloc(
        }
 
        if ((flags & XFS_QMOPT_UQUOTA) && XFS_IS_UQUOTA_ON(mp)) {
+               ASSERT(O_udqpp);
                if (!uid_eq(inode->i_uid, uid)) {
                        /*
                         * What we need is the dquot that has this uid, and
@@ -1683,6 +1696,7 @@ xfs_qm_vop_dqalloc(
                }
        }
        if ((flags & XFS_QMOPT_GQUOTA) && XFS_IS_GQUOTA_ON(mp)) {
+               ASSERT(O_gdqpp);
                if (!gid_eq(inode->i_gid, gid)) {
                        xfs_iunlock(ip, lockflags);
                        error = xfs_qm_dqget(mp, from_kgid(user_ns, gid),
@@ -1700,9 +1714,10 @@ xfs_qm_vop_dqalloc(
                }
        }
        if ((flags & XFS_QMOPT_PQUOTA) && XFS_IS_PQUOTA_ON(mp)) {
+               ASSERT(O_pdqpp);
                if (ip->i_d.di_projid != prid) {
                        xfs_iunlock(ip, lockflags);
-                       error = xfs_qm_dqget(mp, (xfs_dqid_t)prid,
+                       error = xfs_qm_dqget(mp, prid,
                                        XFS_DQTYPE_PROJ, true, &pq);
                        if (error) {
                                ASSERT(error != -ENOENT);