Message ID | 1466746760-155962-1-git-send-email-houtao1@huawei.com (mailing list archive) |
---|---|
State | Rejected, archived |
Headers | show |
On Fri, Jun 24, 2016 at 01:39:20PM +0800, Hou Tao wrote: > remove the usage of rblocklen at xfs_bmdr_to_bmbt, and > use be16_to_cpu(dblock->bb_numrecs) instead. It also > reduces an extra calculation. What problem does this fix, why does it need to be made and how did you test it? We have to be really careful about changing code that interacts with the on-disk format, as any bugs we introduced will result in filesystem corruption. Hence you need to explain to the reviewers why the change needs to be made to the reviewers... Cheers, Dave.
On 2016/6/24 14:38, Dave Chinner wrote: > On Fri, Jun 24, 2016 at 01:39:20PM +0800, Hou Tao wrote: >> remove the usage of rblocklen at xfs_bmdr_to_bmbt, and >> use be16_to_cpu(dblock->bb_numrecs) instead. It also >> reduces an extra calculation. > > What problem does this fix, why does it need to be made and > how did you test it? It fixes nothing, just for simplification of code understanding. And now I realize keeping the original code untouched is better, because using rblocklen to calculate the offset of xfs_bmbt_ptr_t is common among the btree code, so keeping it consistent. > We have to be really careful about changing code that interacts with > the on-disk format, as any bugs we introduced will result in > filesystem corruption. Hence you need to explain to the reviewers > why the change needs to be made to the reviewers... I will take care, Thanks. > > Cheers, > > Dave. >
diff --git a/fs/xfs/libxfs/xfs_bmap_btree.c b/fs/xfs/libxfs/xfs_bmap_btree.c index 6282f6e..452cad9 100644 --- a/fs/xfs/libxfs/xfs_bmap_btree.c +++ b/fs/xfs/libxfs/xfs_bmap_btree.c @@ -59,8 +59,7 @@ xfs_bmdr_to_bmbt( struct xfs_inode *ip, xfs_bmdr_block_t *dblock, int dblocklen, - struct xfs_btree_block *rblock, - int rblocklen) + struct xfs_btree_block *rblock) { struct xfs_mount *mp = ip->i_mount; int dmxr; @@ -85,8 +84,8 @@ xfs_bmdr_to_bmbt( fkp = XFS_BMDR_KEY_ADDR(dblock, 1); tkp = XFS_BMBT_KEY_ADDR(mp, rblock, 1); fpp = XFS_BMDR_PTR_ADDR(dblock, 1, dmxr); - tpp = XFS_BMAP_BROOT_PTR_ADDR(mp, rblock, 1, rblocklen); dmxr = be16_to_cpu(dblock->bb_numrecs); + tpp = XFS_BMBT_PTR_ADDR(mp, rblock, 1, dmxr); memcpy(tkp, fkp, sizeof(*fkp) * dmxr); memcpy(tpp, fpp, sizeof(*fpp) * dmxr); } diff --git a/fs/xfs/libxfs/xfs_bmap_btree.h b/fs/xfs/libxfs/xfs_bmap_btree.h index 819a8a4..b1d30f7 100644 --- a/fs/xfs/libxfs/xfs_bmap_btree.h +++ b/fs/xfs/libxfs/xfs_bmap_btree.h @@ -105,7 +105,7 @@ struct xfs_trans; * Prototypes for xfs_bmap.c to call. */ extern void xfs_bmdr_to_bmbt(struct xfs_inode *, xfs_bmdr_block_t *, int, - struct xfs_btree_block *, int); + struct xfs_btree_block *); extern void xfs_bmbt_get_all(xfs_bmbt_rec_host_t *r, xfs_bmbt_irec_t *s); extern xfs_filblks_t xfs_bmbt_get_blockcount(xfs_bmbt_rec_host_t *r); extern xfs_fsblock_t xfs_bmbt_get_startblock(xfs_bmbt_rec_host_t *r); diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c index bbcc8c7..23967aa 100644 --- a/fs/xfs/libxfs/xfs_inode_fork.c +++ b/fs/xfs/libxfs/xfs_inode_fork.c @@ -433,7 +433,7 @@ xfs_iformat_btree( * to the in-memory structure. */ xfs_bmdr_to_bmbt(ip, dfp, XFS_DFORK_SIZE(dip, ip->i_mount, whichfork), - ifp->if_broot, size); + ifp->if_broot); ifp->if_flags &= ~XFS_IFEXTENTS; ifp->if_flags |= XFS_IFBROOT;
remove the usage of rblocklen at xfs_bmdr_to_bmbt, and use be16_to_cpu(dblock->bb_numrecs) instead. It also reduces an extra calculation. Signed-off-by: Hou Tao <houtao1@huawei.com> --- fs/xfs/libxfs/xfs_bmap_btree.c | 5 ++--- fs/xfs/libxfs/xfs_bmap_btree.h | 2 +- fs/xfs/libxfs/xfs_inode_fork.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-)