From 61fe135c1dde112f483bba01d645debd881b5428 Mon Sep 17 00:00:00 2001 From: Dave Chinner Date: Wed, 3 Apr 2013 16:11:30 +1100 Subject: xfs: buffer type overruns blf_flags field The buffer type passed to log recvoery in the buffer log item overruns the blf_flags field. I had assumed that flags field was a 32 bit value, and it turns out it is a unisgned short. Therefore having 19 flags doesn't really work. Convert the buffer type field to numeric value, and use the top 5 bits of the flags field for it. We currently have 17 types of buffers, so using 5 bits gives us plenty of room for expansion in future.... Signed-off-by: Dave Chinner Reviewed-by: Ben Myers Signed-off-by: Ben Myers --- fs/xfs/xfs_da_btree.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'fs/xfs/xfs_da_btree.c') diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c index 5aebd9bd44d1..56814e305dea 100644 --- a/fs/xfs/xfs_da_btree.c +++ b/fs/xfs/xfs_da_btree.c @@ -312,15 +312,15 @@ xfs_da3_node_read( switch (be16_to_cpu(info->magic)) { case XFS_DA3_NODE_MAGIC: case XFS_DA_NODE_MAGIC: - type = XFS_BLF_DA_NODE_BUF; + type = XFS_BLFT_DA_NODE_BUF; break; case XFS_ATTR_LEAF_MAGIC: case XFS_ATTR3_LEAF_MAGIC: - type = XFS_BLF_ATTR_LEAF_BUF; + type = XFS_BLFT_ATTR_LEAF_BUF; break; case XFS_DIR2_LEAFN_MAGIC: case XFS_DIR3_LEAFN_MAGIC: - type = XFS_BLF_DIR_LEAFN_BUF; + type = XFS_BLFT_DIR_LEAFN_BUF; break; default: type = 0; @@ -361,7 +361,7 @@ xfs_da3_node_create( if (error) return(error); bp->b_ops = &xfs_da3_node_buf_ops; - xfs_trans_buf_set_type(tp, bp, XFS_BLF_DA_NODE_BUF); + xfs_trans_buf_set_type(tp, bp, XFS_BLFT_DA_NODE_BUF); node = bp->b_addr; if (xfs_sb_version_hascrc(&mp->m_sb)) { @@ -597,7 +597,7 @@ xfs_da3_root_split( * we are about to copy oldroot to bp, so set up the type * of bp while we know exactly what it will be. */ - xfs_trans_buf_set_type(tp, bp, XFS_BLF_DA_NODE_BUF); + xfs_trans_buf_set_type(tp, bp, XFS_BLFT_DA_NODE_BUF); } else { struct xfs_dir3_icleaf_hdr leafhdr; struct xfs_dir2_leaf_entry *ents; @@ -615,7 +615,7 @@ xfs_da3_root_split( * we are about to copy oldroot to bp, so set up the type * of bp while we know exactly what it will be. */ - xfs_trans_buf_set_type(tp, bp, XFS_BLF_DIR_LEAFN_BUF); + xfs_trans_buf_set_type(tp, bp, XFS_BLFT_DIR_LEAFN_BUF); } /* -- cgit v1.2.3-70-g09d2