xfs: Move AGI buffer type setting to xfs_read_agi
authorEric Sandeen <sandeen@sandeen.net>
Mon, 5 Dec 2016 01:31:31 +0000 (12:31 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 5 Dec 2016 01:31:31 +0000 (12:31 +1100)
We've missed properly setting the buffer type for
an AGI transaction in 3 spots now, so just move it
into xfs_read_agi() and set it if we are in a transaction
to avoid the problem in the future.

This is similar to how it is done in i.e. the dir3
and attr3 read functions.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/libxfs/xfs_ialloc.c
fs/xfs/xfs_inode.c
fs/xfs/xfs_log_recover.c

index 51b4e0de1fdc424e13f039adf98ae2789a27ba74..c482b9716347c6ac85d71466c54133f44d80a62d 100644 (file)
@@ -2450,8 +2450,6 @@ xfs_ialloc_log_agi(
        ASSERT(agi->agi_magicnum == cpu_to_be32(XFS_AGI_MAGIC));
 #endif
 
-       xfs_trans_buf_set_type(tp, bp, XFS_BLFT_AGI_BUF);
-
        /*
         * Compute byte offsets for the first and last fields in the first
         * region and log the agi buffer. This only logs up through
@@ -2592,6 +2590,8 @@ xfs_read_agi(
                        XFS_FSS_TO_BB(mp, 1), 0, bpp, &xfs_agi_buf_ops);
        if (error)
                return error;
+       if (tp)
+               xfs_trans_buf_set_type(tp, *bpp, XFS_BLFT_AGI_BUF);
 
        xfs_buf_set_ref(*bpp, XFS_AGI_REF);
        return 0;
index 4e560e6a12c1cc2d4b913292c62714bf78e9ae77..512ff13ed66a9568bc67cd82c2720c947855b64d 100644 (file)
@@ -2041,7 +2041,6 @@ xfs_iunlink(
        agi->agi_unlinked[bucket_index] = cpu_to_be32(agino);
        offset = offsetof(xfs_agi_t, agi_unlinked) +
                (sizeof(xfs_agino_t) * bucket_index);
-       xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
        xfs_trans_log_buf(tp, agibp, offset,
                          (offset + sizeof(xfs_agino_t) - 1));
        return 0;
@@ -2133,7 +2132,6 @@ xfs_iunlink_remove(
                agi->agi_unlinked[bucket_index] = cpu_to_be32(next_agino);
                offset = offsetof(xfs_agi_t, agi_unlinked) +
                        (sizeof(xfs_agino_t) * bucket_index);
-               xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
                xfs_trans_log_buf(tp, agibp, offset,
                                  (offset + sizeof(xfs_agino_t) - 1));
        } else {
index 2d91f5ab753811e053a775062986646439f96d57..9b3d7c76915d9c92948bed063d79bd10a6107a77 100644 (file)
@@ -4929,7 +4929,6 @@ xlog_recover_clear_agi_bucket(
        agi->agi_unlinked[bucket] = cpu_to_be32(NULLAGINO);
        offset = offsetof(xfs_agi_t, agi_unlinked) +
                 (sizeof(xfs_agino_t) * bucket);
-       xfs_trans_buf_set_type(tp, agibp, XFS_BLFT_AGI_BUF);
        xfs_trans_log_buf(tp, agibp, offset,
                          (offset + sizeof(xfs_agino_t) - 1));