xfs
[Top] [All Lists]

Re: [PATCH v3 02/13] xfs: make use of xfs_calc_buf_res() in xfs_trans.c

To: Jeff Liu <jeff.liu@xxxxxxxxxx>
Subject: Re: [PATCH v3 02/13] xfs: make use of xfs_calc_buf_res() in xfs_trans.c
From: Mark Tinguely <tinguely@xxxxxxx>
Date: Thu, 24 Jan 2013 15:39:35 -0600
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <5101168E.7080801@xxxxxxxxxx>
References: <5101168E.7080801@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20120122 Thunderbird/9.0
On 01/24/13 05:10, Jeff Liu wrote:
Refine the existing reservations routines with xfs_calc_buf_res() in 
xfs_trans.c.

Signed-off-by: Jie Liu<jeff.liu@xxxxxxxxxx>
---
  fs/xfs/xfs_trans.c |  238 ++++++++++++++++++++++++----------------------------
  1 file changed, 111 insertions(+), 127 deletions(-)

  /*
@@ -148,18 +145,18 @@ xfs_calc_itruncate_reservation(
        struct xfs_mount        *mp)
  {
        return XFS_DQUOT_LOGRES(mp) +
-               MAX((mp->m_sb.sb_inodesize +
-                    XFS_FSB_TO_B(mp, XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1) +
-                    128 * (2 + XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK))),
-                   (4 * mp->m_sb.sb_sectsize +
-                    4 * mp->m_sb.sb_sectsize +
-                    mp->m_sb.sb_sectsize +
-                    XFS_ALLOCFREE_LOG_RES(mp, 4) +
-                    128 * (9 + XFS_ALLOCFREE_LOG_COUNT(mp, 4)) +
-                    128 * 5 +
-                    XFS_ALLOCFREE_LOG_RES(mp, 1) +
-                    128 * (2 + XFS_IALLOC_BLOCKS(mp) + mp->m_in_maxlevels +
-                           XFS_ALLOCFREE_LOG_COUNT(mp, 1))));
+               MAX((xfs_calc_buf_res(1, mp->m_sb.sb_inodesize) +
+                    xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK) + 1,
+                                     XFS_FSB_TO_B(mp, 1))),
+                   (xfs_calc_buf_res(9, mp->m_sb.sb_sectsize) +
+                    xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 4),
+                                     XFS_FSB_TO_B(mp, 1)) +
+                   xfs_calc_buf_res(5, 0) +
+                   xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 1),
+                                    XFS_FSB_TO_B(mp, 1)) +
+                   xfs_calc_buf_res(2 + XFS_IALLOC_BLOCKS(mp) +
+                                    mp->m_in_maxlevels,
+                                    XFS_FSB_TO_B(mp, 0))));
                                        ^^^^
        I see the (2 + XFS_IALLOC_BLOCKS(mp) + mp->m_in_maxlevel)
        headers in the original code, but I still don't see data.

 I ran the counts for the args of MAX() command and I get a different
 result:

ARG1   ARG2
25728 218752   before
25728 255616   after - second arg is too big as I expected.


Some of the other counts don't match for me either.

--Mark.

<Prev in Thread] Current Thread [Next in Thread>