mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
xfs: clean up dqblk extraction
[ Upstream commit ed17f7da5f0c8b65b7b5f7c98beb0aadbc0546ee ] Since the introduction of xfs_dqblk in V5, xfs really ought to find the dqblk pointer from the dquot buffer, then compute the xfs_disk_dquot pointer from the dqblk pointer. Fix the open-coded xfs_buf_offset calls and do the type checking in the correct order. Note that this has made no practical difference since the start of the xfs_disk_dquot is coincident with the start of the xfs_dqblk. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org> Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
318cac2b98
commit
df716416db
@@ -562,7 +562,8 @@ xfs_dquot_from_disk(
|
|||||||
struct xfs_dquot *dqp,
|
struct xfs_dquot *dqp,
|
||||||
struct xfs_buf *bp)
|
struct xfs_buf *bp)
|
||||||
{
|
{
|
||||||
struct xfs_disk_dquot *ddqp = bp->b_addr + dqp->q_bufoffset;
|
struct xfs_dqblk *dqb = xfs_buf_offset(bp, dqp->q_bufoffset);
|
||||||
|
struct xfs_disk_dquot *ddqp = &dqb->dd_diskdq;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ensure that we got the type and ID we were looking for.
|
* Ensure that we got the type and ID we were looking for.
|
||||||
@@ -1250,7 +1251,7 @@ xfs_qm_dqflush(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Flush the incore dquot to the ondisk buffer. */
|
/* Flush the incore dquot to the ondisk buffer. */
|
||||||
dqblk = bp->b_addr + dqp->q_bufoffset;
|
dqblk = xfs_buf_offset(bp, dqp->q_bufoffset);
|
||||||
xfs_dquot_to_disk(&dqblk->dd_diskdq, dqp);
|
xfs_dquot_to_disk(&dqblk->dd_diskdq, dqp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ xlog_recover_dquot_commit_pass2(
|
|||||||
{
|
{
|
||||||
struct xfs_mount *mp = log->l_mp;
|
struct xfs_mount *mp = log->l_mp;
|
||||||
struct xfs_buf *bp;
|
struct xfs_buf *bp;
|
||||||
|
struct xfs_dqblk *dqb;
|
||||||
struct xfs_disk_dquot *ddq, *recddq;
|
struct xfs_disk_dquot *ddq, *recddq;
|
||||||
struct xfs_dq_logformat *dq_f;
|
struct xfs_dq_logformat *dq_f;
|
||||||
xfs_failaddr_t fa;
|
xfs_failaddr_t fa;
|
||||||
@@ -130,14 +131,14 @@ xlog_recover_dquot_commit_pass2(
|
|||||||
return error;
|
return error;
|
||||||
|
|
||||||
ASSERT(bp);
|
ASSERT(bp);
|
||||||
ddq = xfs_buf_offset(bp, dq_f->qlf_boffset);
|
dqb = xfs_buf_offset(bp, dq_f->qlf_boffset);
|
||||||
|
ddq = &dqb->dd_diskdq;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the dquot has an LSN in it, recover the dquot only if it's less
|
* If the dquot has an LSN in it, recover the dquot only if it's less
|
||||||
* than the lsn of the transaction we are replaying.
|
* than the lsn of the transaction we are replaying.
|
||||||
*/
|
*/
|
||||||
if (xfs_has_crc(mp)) {
|
if (xfs_has_crc(mp)) {
|
||||||
struct xfs_dqblk *dqb = (struct xfs_dqblk *)ddq;
|
|
||||||
xfs_lsn_t lsn = be64_to_cpu(dqb->dd_lsn);
|
xfs_lsn_t lsn = be64_to_cpu(dqb->dd_lsn);
|
||||||
|
|
||||||
if (lsn && lsn != -1 && XFS_LSN_CMP(lsn, current_lsn) >= 0) {
|
if (lsn && lsn != -1 && XFS_LSN_CMP(lsn, current_lsn) >= 0) {
|
||||||
@@ -147,7 +148,7 @@ xlog_recover_dquot_commit_pass2(
|
|||||||
|
|
||||||
memcpy(ddq, recddq, item->ri_buf[1].i_len);
|
memcpy(ddq, recddq, item->ri_buf[1].i_len);
|
||||||
if (xfs_has_crc(mp)) {
|
if (xfs_has_crc(mp)) {
|
||||||
xfs_update_cksum((char *)ddq, sizeof(struct xfs_dqblk),
|
xfs_update_cksum((char *)dqb, sizeof(struct xfs_dqblk),
|
||||||
XFS_DQUOT_CRC_OFF);
|
XFS_DQUOT_CRC_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user