public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Xiaole He <hexiaole1994@126.com>
Cc: linux-xfs@vger.kernel.org, dchinner@redhat.com,
	chandan.babu@oracle.com, zhangshida@kylinos.cn,
	Xiaole He <hexiaole@kylinos.cn>
Subject: Re: [PATCH v1] libxfs: fix reservation space for removing transaction
Date: Wed, 8 Feb 2023 17:43:13 -0800	[thread overview]
Message-ID: <Y+RPsT3kKwB7HaVR@magnolia> (raw)
In-Reply-To: <20230206130949.12947-1-hexiaole1994@126.com>

On Mon, Feb 06, 2023 at 09:09:49PM +0800, Xiaole He wrote:
> In libxfs/xfs_trans_resv.c:
> 
> /* libxfs/xfs_trans_resv.c begin */
>  1 /*
>  2  * For removing a directory entry we can modify:
>  3  *    the parent directory inode: inode size
>  4  *    the removed inode: inode size
>  5  *    the directory btree could join: (max depth + v2) * dir block size
>  6  *    the directory bmap btree could join or split: (max depth + v2) * blocksize
>  7  * And the bmap_finish transaction can free the dir and bmap blocks giving:
>  8  *    the agf for the ag in which the blocks live: 2 * sector size
>  9  *    the agfl for the ag in which the blocks live: 2 * sector size
> 10  *    the superblock for the free block count: sector size
> 11  ...
> 12  */
> 13 STATIC uint
> 14 xfs_calc_remove_reservation(
> 15      struct xfs_mount        *mp)
> 16 {
> 17      return XFS_DQUOT_LOGRES(mp) +
> 18              xfs_calc_iunlink_add_reservation(mp) +
> 19              max((xfs_calc_inode_res(mp, 1) +

1?  It's 2 currently.  Are you using an old version of xfsprogs?

> 20                   xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp),
> 21                                    XFS_FSB_TO_B(mp, 1))),
> 22                  (xfs_calc_buf_res(4, mp->m_sb.sb_sectsize) +
> 23      ...
> 24 }
> /* libxfs/xfs_trans_resv.c end */
> 
> Above lines 8-10 indicates there has 5 sector size of space to be
> reserved, but the above line 22 only reserve 4 sector size of space,
> this patch fix the problem and sorry for not notice this problem at
> Commit d3e53ab7cdc7fabb8c94137e335634e0ed4691e8 ("xfs: fix inode
> reservation space for removing transaction").
> 
> Signed-off-by: Xiaole He <hexiaole@kylinos.cn>
> ---
>  libxfs/xfs_trans_resv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libxfs/xfs_trans_resv.c b/libxfs/xfs_trans_resv.c
> index 04c44480..3d106c77 100644
> --- a/libxfs/xfs_trans_resv.c
> +++ b/libxfs/xfs_trans_resv.c
> @@ -517,7 +517,7 @@ xfs_calc_remove_reservation(
>  		max((xfs_calc_inode_res(mp, 2) +

Looks fine, but why the discrepancy between here and the commit message?

>  		     xfs_calc_buf_res(XFS_DIROP_LOG_COUNT(mp),
>  				      XFS_FSB_TO_B(mp, 1))),
> -		    (xfs_calc_buf_res(4, mp->m_sb.sb_sectsize) +
> +		    (xfs_calc_buf_res(5, mp->m_sb.sb_sectsize) +

Also: please send patches against the kernel, not xfsprogs.

--D

>  		     xfs_calc_buf_res(xfs_allocfree_block_count(mp, 2),
>  				      XFS_FSB_TO_B(mp, 1))));
>  }
> -- 
> 2.27.0
> 

      reply	other threads:[~2023-02-09  1:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-06 13:09 [PATCH v1] libxfs: fix reservation space for removing transaction Xiaole He
2023-02-09  1:43 ` Darrick J. Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y+RPsT3kKwB7HaVR@magnolia \
    --to=djwong@kernel.org \
    --cc=chandan.babu@oracle.com \
    --cc=dchinner@redhat.com \
    --cc=hexiaole1994@126.com \
    --cc=hexiaole@kylinos.cn \
    --cc=linux-xfs@vger.kernel.org \
    --cc=zhangshida@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox