xfs_dquot.c (a4654e9bde4ecedb4921e6c8fe2088114bdff1b3) xfs_dquot.c (8d3d7e2b35ea7d91d6e085c93b5efecfb0fba307)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2000-2003 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6#include "xfs.h"
7#include "xfs_fs.h"
8#include "xfs_format.h"

--- 815 unchanged lines hidden (view full) ---

824/* Return the quota id for a given inode and type. */
825xfs_dqid_t
826xfs_qm_id_for_quotatype(
827 struct xfs_inode *ip,
828 uint type)
829{
830 switch (type) {
831 case XFS_DQ_USER:
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2000-2003 Silicon Graphics, Inc.
4 * All Rights Reserved.
5 */
6#include "xfs.h"
7#include "xfs_fs.h"
8#include "xfs_format.h"

--- 815 unchanged lines hidden (view full) ---

824/* Return the quota id for a given inode and type. */
825xfs_dqid_t
826xfs_qm_id_for_quotatype(
827 struct xfs_inode *ip,
828 uint type)
829{
830 switch (type) {
831 case XFS_DQ_USER:
832 return ip->i_d.di_uid;
832 return i_uid_read(VFS_I(ip));
833 case XFS_DQ_GROUP:
833 case XFS_DQ_GROUP:
834 return ip->i_d.di_gid;
834 return i_gid_read(VFS_I(ip));
835 case XFS_DQ_PROJ:
836 return ip->i_d.di_projid;
837 }
838 ASSERT(0);
839 return 0;
840}
841
842/*

--- 257 unchanged lines hidden (view full) ---

1100 error = -EIO;
1101 goto out_unlock;
1102 }
1103
1104 /*
1105 * Get the buffer containing the on-disk dquot
1106 */
1107 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno,
835 case XFS_DQ_PROJ:
836 return ip->i_d.di_projid;
837 }
838 ASSERT(0);
839 return 0;
840}
841
842/*

--- 257 unchanged lines hidden (view full) ---

1100 error = -EIO;
1101 goto out_unlock;
1102 }
1103
1104 /*
1105 * Get the buffer containing the on-disk dquot
1106 */
1107 error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp, dqp->q_blkno,
1108 mp->m_quotainfo->qi_dqchunklen, 0, &bp,
1109 &xfs_dquot_buf_ops);
1108 mp->m_quotainfo->qi_dqchunklen, XBF_TRYLOCK,
1109 &bp, &xfs_dquot_buf_ops);
1110 if (error)
1111 goto out_unlock;
1112
1113 /*
1114 * Calculate the location of the dquot inside the buffer.
1115 */
1116 dqb = bp->b_addr + dqp->q_bufoffset;
1117 ddqp = &dqb->dd_diskdq;

--- 54 unchanged lines hidden (view full) ---

1172 }
1173
1174 trace_xfs_dqflush_done(dqp);
1175 *bpp = bp;
1176 return 0;
1177
1178out_unlock:
1179 xfs_dqfunlock(dqp);
1110 if (error)
1111 goto out_unlock;
1112
1113 /*
1114 * Calculate the location of the dquot inside the buffer.
1115 */
1116 dqb = bp->b_addr + dqp->q_bufoffset;
1117 ddqp = &dqb->dd_diskdq;

--- 54 unchanged lines hidden (view full) ---

1172 }
1173
1174 trace_xfs_dqflush_done(dqp);
1175 *bpp = bp;
1176 return 0;
1177
1178out_unlock:
1179 xfs_dqfunlock(dqp);
1180 return -EIO;
1180 return error;
1181}
1182
1183/*
1184 * Lock two xfs_dquot structures.
1185 *
1186 * To avoid deadlocks we always lock the quota structure with
1187 * the lowerd id first.
1188 */

--- 83 unchanged lines hidden ---
1181}
1182
1183/*
1184 * Lock two xfs_dquot structures.
1185 *
1186 * To avoid deadlocks we always lock the quota structure with
1187 * the lowerd id first.
1188 */

--- 83 unchanged lines hidden ---