diff options
Diffstat (limited to 'fs/xfs/xfs_inode_buf.c')
| -rw-r--r-- | fs/xfs/xfs_inode_buf.c | 34 | 
1 files changed, 16 insertions, 18 deletions
diff --git a/fs/xfs/xfs_inode_buf.c b/fs/xfs/xfs_inode_buf.c index 63382d37f56..cb35ae41d4a 100644 --- a/fs/xfs/xfs_inode_buf.c +++ b/fs/xfs/xfs_inode_buf.c @@ -17,20 +17,20 @@   */  #include "xfs.h"  #include "xfs_fs.h" +#include "xfs_shared.h"  #include "xfs_format.h" -#include "xfs_log.h" -#include "xfs_trans.h" +#include "xfs_log_format.h" +#include "xfs_trans_resv.h"  #include "xfs_sb.h"  #include "xfs_ag.h"  #include "xfs_mount.h" -#include "xfs_bmap_btree.h" -#include "xfs_ialloc_btree.h" -#include "xfs_dinode.h"  #include "xfs_inode.h"  #include "xfs_error.h"  #include "xfs_cksum.h"  #include "xfs_icache.h" +#include "xfs_trans.h"  #include "xfs_ialloc.h" +#include "xfs_dinode.h"  /*   * Check that none of the inode's in the buffer have a next @@ -102,8 +102,7 @@ xfs_inode_buf_verify(  			}  			xfs_buf_ioerror(bp, EFSCORRUPTED); -			XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_HIGH, -					     mp, dip); +			xfs_verifier_error(bp);  #ifdef DEBUG  			xfs_alert(mp,  				"bad inode magic/vsn daddr %lld #%d (magic=%x)", @@ -306,7 +305,7 @@ xfs_dinode_verify(  	if (!xfs_sb_version_hascrc(&mp->m_sb))  		return false;  	if (!xfs_verify_cksum((char *)dip, mp->m_sb.sb_inodesize, -			      offsetof(struct xfs_dinode, di_crc))) +			      XFS_DINODE_CRC_OFF))  		return false;  	if (be64_to_cpu(dip->di_ino) != ip->i_ino)  		return false; @@ -327,7 +326,7 @@ xfs_dinode_calc_crc(  	ASSERT(xfs_sb_version_hascrc(&mp->m_sb));  	crc = xfs_start_cksum((char *)dip, mp->m_sb.sb_inodesize, -			      offsetof(struct xfs_dinode, di_crc)); +			      XFS_DINODE_CRC_OFF);  	dip->di_crc = xfs_end_cksum(crc);  } @@ -438,17 +437,16 @@ xfs_iread(  	}  	/* -	 * The inode format changed when we moved the link count and -	 * made it 32 bits long.  If this is an old format inode, -	 * convert it in memory to look like a new one.  If it gets -	 * flushed to disk we will convert back before flushing or -	 * logging it.  We zero out the new projid field and the old link -	 * count field.  We'll handle clearing the pad field (the remains -	 * of the old uuid field) when we actually convert the inode to -	 * the new format. We don't change the version number so that we -	 * can distinguish this from a real new format inode. +	 * Automatically convert version 1 inode formats in memory to version 2 +	 * inode format. If the inode is modified, it will get logged and +	 * rewritten as a version 2 inode. We can do this because we set the +	 * superblock feature bit for v2 inodes unconditionally during mount +	 * and it means the reast of the code can assume the inode version is 2 +	 * or higher.  	 */  	if (ip->i_d.di_version == 1) { +		ip->i_d.di_version = 2; +		memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));  		ip->i_d.di_nlink = ip->i_d.di_onlink;  		ip->i_d.di_onlink = 0;  		xfs_set_projid(ip, 0);  | 
