xfs_dquot.c (985a78fdde15e1730383f99867ca38b5648444bf) | xfs_dquot.c (0b0fa1d1d16794ce48188cc6434ec38f6e1f1b4b) |
---|---|
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" --- 547 unchanged lines hidden (view full) --- 556 dqp->q_res_icount = be64_to_cpu(ddqp->d_icount); 557 dqp->q_res_rtbcount = be64_to_cpu(ddqp->d_rtbcount); 558 559 /* initialize the dquot speculative prealloc thresholds */ 560 xfs_dquot_set_prealloc_limits(dqp); 561 return 0; 562} 563 | 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" --- 547 unchanged lines hidden (view full) --- 556 dqp->q_res_icount = be64_to_cpu(ddqp->d_icount); 557 dqp->q_res_rtbcount = be64_to_cpu(ddqp->d_rtbcount); 558 559 /* initialize the dquot speculative prealloc thresholds */ 560 xfs_dquot_set_prealloc_limits(dqp); 561 return 0; 562} 563 |
564/* Copy the in-core quota fields into the on-disk buffer. */ 565void 566xfs_dquot_to_disk( 567 struct xfs_disk_dquot *ddqp, 568 struct xfs_dquot *dqp) 569{ 570 memcpy(ddqp, &dqp->q_core, sizeof(struct xfs_disk_dquot)); 571} 572 |
|
564/* Allocate and initialize the dquot buffer for this in-core dquot. */ 565static int 566xfs_qm_dqread_alloc( 567 struct xfs_mount *mp, 568 struct xfs_dquot *dqp, 569 struct xfs_buf **bpp) 570{ 571 struct xfs_trans *tp; --- 538 unchanged lines hidden (view full) --- 1110 struct xfs_log_item *lip, *n; 1111 1112 list_for_each_entry_safe(lip, n, &bp->b_li_list, li_bio_list) { 1113 list_del_init(&lip->li_bio_list); 1114 xfs_qm_dqflush_done(lip); 1115 } 1116} 1117 | 573/* Allocate and initialize the dquot buffer for this in-core dquot. */ 574static int 575xfs_qm_dqread_alloc( 576 struct xfs_mount *mp, 577 struct xfs_dquot *dqp, 578 struct xfs_buf **bpp) 579{ 580 struct xfs_trans *tp; --- 538 unchanged lines hidden (view full) --- 1119 struct xfs_log_item *lip, *n; 1120 1121 list_for_each_entry_safe(lip, n, &bp->b_li_list, li_bio_list) { 1122 list_del_init(&lip->li_bio_list); 1123 xfs_qm_dqflush_done(lip); 1124 } 1125} 1126 |
1127/* Check incore dquot for errors before we flush. */ 1128static xfs_failaddr_t 1129xfs_qm_dqflush_check( 1130 struct xfs_dquot *dqp) 1131{ 1132 __u8 type = dqp->dq_flags & XFS_DQ_ALLTYPES; 1133 1134 if (type != XFS_DQ_USER && 1135 type != XFS_DQ_GROUP && 1136 type != XFS_DQ_PROJ) 1137 return __this_address; 1138 1139 return NULL; 1140} 1141 |
|
1118/* 1119 * Write a modified dquot to disk. 1120 * The dquot must be locked and the flush lock too taken by caller. 1121 * The flush lock will not be unlocked until the dquot reaches the disk, 1122 * but the dquot is free to be unlocked and modified by the caller 1123 * in the interim. Dquot is still locked on return. This behavior is 1124 * identical to that of inodes. 1125 */ --- 42 unchanged lines hidden (view full) --- 1168 if (fa) { 1169 xfs_alert(mp, "corrupt dquot ID 0x%x in memory at %pS", 1170 be32_to_cpu(dqp->q_core.d_id), fa); 1171 xfs_buf_relse(bp); 1172 error = -EFSCORRUPTED; 1173 goto out_abort; 1174 } 1175 | 1142/* 1143 * Write a modified dquot to disk. 1144 * The dquot must be locked and the flush lock too taken by caller. 1145 * The flush lock will not be unlocked until the dquot reaches the disk, 1146 * but the dquot is free to be unlocked and modified by the caller 1147 * in the interim. Dquot is still locked on return. This behavior is 1148 * identical to that of inodes. 1149 */ --- 42 unchanged lines hidden (view full) --- 1192 if (fa) { 1193 xfs_alert(mp, "corrupt dquot ID 0x%x in memory at %pS", 1194 be32_to_cpu(dqp->q_core.d_id), fa); 1195 xfs_buf_relse(bp); 1196 error = -EFSCORRUPTED; 1197 goto out_abort; 1198 } 1199 |
1176 /* This is the only portion of data that needs to persist */ 1177 memcpy(ddqp, &dqp->q_core, sizeof(struct xfs_disk_dquot)); | 1200 fa = xfs_qm_dqflush_check(dqp); 1201 if (fa) { 1202 xfs_alert(mp, "corrupt dquot ID 0x%x in memory at %pS", 1203 be32_to_cpu(dqp->q_core.d_id), fa); 1204 xfs_buf_relse(bp); 1205 error = -EFSCORRUPTED; 1206 goto out_abort; 1207 } |
1178 | 1208 |
1209 xfs_dquot_to_disk(ddqp, dqp); 1210 |
|
1179 /* 1180 * Clear the dirty field and remember the flush lsn for later use. 1181 */ 1182 dqp->q_flags &= ~XFS_DQFLAG_DIRTY; 1183 1184 xfs_trans_ail_copy_lsn(mp->m_ail, &dqp->q_logitem.qli_flush_lsn, 1185 &dqp->q_logitem.qli_item.li_lsn); 1186 --- 133 unchanged lines hidden --- | 1211 /* 1212 * Clear the dirty field and remember the flush lsn for later use. 1213 */ 1214 dqp->q_flags &= ~XFS_DQFLAG_DIRTY; 1215 1216 xfs_trans_ail_copy_lsn(mp->m_ail, &dqp->q_logitem.qli_flush_lsn, 1217 &dqp->q_logitem.qli_item.li_lsn); 1218 --- 133 unchanged lines hidden --- |