public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: simplify the calculation of tpp at xfs_bmdr_to_bmbt
@ 2016-06-24  5:39 Hou Tao
  2016-06-24  6:38 ` Dave Chinner
  0 siblings, 1 reply; 3+ messages in thread
From: Hou Tao @ 2016-06-24  5:39 UTC (permalink / raw)
  To: xfs; +Cc: miaoxie, fangwei1

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(-)

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;
 
-- 
2.5.5

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs: simplify the calculation of tpp at xfs_bmdr_to_bmbt
  2016-06-24  5:39 [PATCH] xfs: simplify the calculation of tpp at xfs_bmdr_to_bmbt Hou Tao
@ 2016-06-24  6:38 ` Dave Chinner
  2016-06-24  7:01   ` Hou Tao
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Chinner @ 2016-06-24  6:38 UTC (permalink / raw)
  To: Hou Tao; +Cc: miaoxie, fangwei1, xfs

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.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs: simplify the calculation of tpp at xfs_bmdr_to_bmbt
  2016-06-24  6:38 ` Dave Chinner
@ 2016-06-24  7:01   ` Hou Tao
  0 siblings, 0 replies; 3+ messages in thread
From: Hou Tao @ 2016-06-24  7:01 UTC (permalink / raw)
  To: Dave Chinner; +Cc: miaoxie, fangwei1, xfs



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.
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-24  7:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-24  5:39 [PATCH] xfs: simplify the calculation of tpp at xfs_bmdr_to_bmbt Hou Tao
2016-06-24  6:38 ` Dave Chinner
2016-06-24  7:01   ` Hou Tao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox