xfs
[Top] [All Lists]

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

To: Jeff Liu <jeff.liu@xxxxxxxxxx>
Subject: Re: [PATCH v4 02/13] xfs: make use of xfs_calc_buf_res() in xfs_trans.c
From: Ben Myers <bpm@xxxxxxx>
Date: Thu, 31 Jan 2013 19:39:37 -0600
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <51067C69.2020509@xxxxxxxxxx>
References: <51067C69.2020509@xxxxxxxxxx>
User-agent: Mutt/1.5.20 (2009-06-14)
Hey Jeff,

On Mon, Jan 28, 2013 at 09:26:01PM +0800, Jeff Liu wrote:
> Refining the existing reservations with xfs_calc_buf_res() in xfs_trans.c
> 
> Signed-off-by: Jie Liu <jeff.liu@xxxxxxxxxx>
> CC: Dave Chinner <david@xxxxxxxxxxxxx>
> Reviewed-by: Mark Tinguely <tinguely@xxxxxxx>

...

> ---
>  fs/xfs/xfs_trans.c |  237 
> ++++++++++++++++++++++++----------------------------
>  1 file changed, 110 insertions(+), 127 deletions(-)
> 
> diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c

...

> @@ -298,18 +286,19 @@ xfs_calc_create_reservation(
>       struct xfs_mount        *mp)
>  {
>       return XFS_DQUOT_LOGRES(mp) +
> -             MAX((mp->m_sb.sb_inodesize +
> -                  mp->m_sb.sb_inodesize +
> -                  mp->m_sb.sb_sectsize +
> +             MAX((xfs_calc_buf_res(2, mp->m_sb.sb_inodesize) +
> +                  xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
>                    XFS_FSB_TO_B(mp, 1) +
> -                  XFS_DIROP_LOG_RES(mp) +
> -                  128 * (3 + XFS_DIROP_LOG_COUNT(mp))),
> -                 (3 * mp->m_sb.sb_sectsize +
> -                  XFS_FSB_TO_B(mp, XFS_IALLOC_BLOCKS(mp)) +
> -                  XFS_FSB_TO_B(mp, mp->m_in_maxlevels) +
> -                  XFS_ALLOCFREE_LOG_RES(mp, 1) +
> -                  128 * (2 + XFS_IALLOC_BLOCKS(mp) + mp->m_in_maxlevels +
> -                         XFS_ALLOCFREE_LOG_COUNT(mp, 1))));
> +                  xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp),
> +                                   XFS_FSB_TO_B(mp, 1))),
> +                 (xfs_calc_buf_res(2, mp->m_sb.sb_sectsize) +
> +                  mp->m_sb.sb_sectsize +
> +                  xfs_calc_buf_res(XFS_IALLOC_BLOCKS(mp),
> +                                   XFS_FSB_TO_B(mp, 1)) +
> +                  xfs_calc_buf_res(mp->m_in_maxlevels,
> +                                   XFS_FSB_TO_B(mp, 1)) +
> +                  xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 1),
> +                                   XFS_FSB_TO_B(mp, 1))));
>  }

xfs/xfs_inode_item.c
xfs/xfs_trans.c: In function âxfs_calc_create_reservationâ:
xfs/xfs_trans.c:289: warning: comparison of distinct pointer types lacks a cast

>  /*
> @@ -539,16 +524,14 @@ xfs_calc_attrrm_reservation(
>       struct xfs_mount        *mp)
>  {
>       return XFS_DQUOT_LOGRES(mp) +
> -             MAX((mp->m_sb.sb_inodesize +
> -                  XFS_FSB_TO_B(mp, XFS_DA_NODE_MAXDEPTH) +
> +             MAX((xfs_calc_buf_res(1, mp->m_sb.sb_inodesize) +
> +                  xfs_calc_buf_res(XFS_DA_NODE_MAXDEPTH,
> +                                   XFS_FSB_TO_B(mp, 1)) +
>                    XFS_FSB_TO_B(mp, XFS_BM_MAXLEVELS(mp, XFS_ATTR_FORK)) +
> -                  128 * (1 + XFS_DA_NODE_MAXDEPTH +
> -                         XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK))),
> -                 (2 * mp->m_sb.sb_sectsize +
> -                  2 * mp->m_sb.sb_sectsize +
> -                  mp->m_sb.sb_sectsize +
> -                  XFS_ALLOCFREE_LOG_RES(mp, 2) +
> -                  128 * (5 + XFS_ALLOCFREE_LOG_COUNT(mp, 2))));
> +                  xfs_calc_buf_res(XFS_BM_MAXLEVELS(mp, XFS_DATA_FORK), 0)),
> +                 (xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) +
> +                  xfs_calc_buf_res(XFS_ALLOCFREE_LOG_COUNT(mp, 2),
> +                                   XFS_FSB_TO_B(mp, 1))));
>  }

xfs/xfs_trans.c: In function âxfs_calc_attrrm_reservationâ:
xfs/xfs_trans.c:527: warning: comparison of distinct pointer types lacks a cast

Can you fix up those warnings?  I think you need only resend patch 2.

Thanks,
Ben

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