From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Chandan Babu R <chandan.babu@oracle.com>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/6] xfs: fold xfs_bmap_alloc_userdata into xfs_bmapi_allocate
Date: Wed, 21 Aug 2024 08:59:03 -0700 [thread overview]
Message-ID: <20240821155903.GY865349@frogsfrogsfrogs> (raw)
In-Reply-To: <20240820170517.528181-5-hch@lst.de>
On Tue, Aug 20, 2024 at 07:04:55PM +0200, Christoph Hellwig wrote:
> Userdata and metadata allocations end up in the same allocation helpers.
> Remove the separate xfs_bmap_alloc_userdata function to make this more
> clear.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Makes sense to combine these
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> fs/xfs/libxfs/xfs_bmap.c | 73 +++++++++++++++-------------------------
> 1 file changed, 28 insertions(+), 45 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index a63be14a9873e8..1db9d084a44c47 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -4167,43 +4167,6 @@ xfs_bmapi_reserve_delalloc(
> return error;
> }
>
> -static int
> -xfs_bmap_alloc_userdata(
> - struct xfs_bmalloca *bma)
> -{
> - struct xfs_mount *mp = bma->ip->i_mount;
> - int whichfork = xfs_bmapi_whichfork(bma->flags);
> - int error;
> -
> - /*
> - * Set the data type being allocated. For the data fork, the first data
> - * in the file is treated differently to all other allocations. For the
> - * attribute fork, we only need to ensure the allocated range is not on
> - * the busy list.
> - */
> - bma->datatype = XFS_ALLOC_NOBUSY;
> - if (whichfork == XFS_DATA_FORK || whichfork == XFS_COW_FORK) {
> - bma->datatype |= XFS_ALLOC_USERDATA;
> - if (bma->offset == 0)
> - bma->datatype |= XFS_ALLOC_INITIAL_USER_DATA;
> -
> - if (mp->m_dalign && bma->length >= mp->m_dalign) {
> - error = xfs_bmap_isaeof(bma, whichfork);
> - if (error)
> - return error;
> - }
> -
> - if (XFS_IS_REALTIME_INODE(bma->ip))
> - return xfs_bmap_rtalloc(bma);
> - }
> -
> - if (unlikely(XFS_TEST_ERROR(false, mp,
> - XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT)))
> - return xfs_bmap_exact_minlen_extent_alloc(bma);
> -
> - return xfs_bmap_btalloc(bma);
> -}
> -
> static int
> xfs_bmapi_allocate(
> struct xfs_bmalloca *bma)
> @@ -4221,15 +4184,35 @@ xfs_bmapi_allocate(
> else
> bma->minlen = 1;
>
> - if (bma->flags & XFS_BMAPI_METADATA) {
> - if (unlikely(XFS_TEST_ERROR(false, mp,
> - XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT)))
> - error = xfs_bmap_exact_minlen_extent_alloc(bma);
> - else
> - error = xfs_bmap_btalloc(bma);
> - } else {
> - error = xfs_bmap_alloc_userdata(bma);
> + if (!(bma->flags & XFS_BMAPI_METADATA)) {
> + /*
> + * For the data and COW fork, the first data in the file is
> + * treated differently to all other allocations. For the
> + * attribute fork, we only need to ensure the allocated range
> + * is not on the busy list.
> + */
> + bma->datatype = XFS_ALLOC_NOBUSY;
> + if (whichfork == XFS_DATA_FORK || whichfork == XFS_COW_FORK) {
> + bma->datatype |= XFS_ALLOC_USERDATA;
> + if (bma->offset == 0)
> + bma->datatype |= XFS_ALLOC_INITIAL_USER_DATA;
> +
> + if (mp->m_dalign && bma->length >= mp->m_dalign) {
> + error = xfs_bmap_isaeof(bma, whichfork);
> + if (error)
> + return error;
> + }
> + }
> }
> +
> + if ((bma->datatype & XFS_ALLOC_USERDATA) &&
> + XFS_IS_REALTIME_INODE(bma->ip))
> + error = xfs_bmap_rtalloc(bma);
> + else if (unlikely(XFS_TEST_ERROR(false, mp,
> + XFS_ERRTAG_BMAP_ALLOC_MINLEN_EXTENT)))
> + error = xfs_bmap_exact_minlen_extent_alloc(bma);
> + else
> + error = xfs_bmap_btalloc(bma);
> if (error)
> return error;
> if (bma->blkno == NULLFSBLOCK)
> --
> 2.43.0
>
>
next prev parent reply other threads:[~2024-08-21 15:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-20 17:04 fix a DEBUG-only assert failure in xfs/538 Christoph Hellwig
2024-08-20 17:04 ` [PATCH 1/6] xfs: merge xfs_attr_leaf_try_add into xfs_attr_leaf_addname Christoph Hellwig
2024-08-21 15:52 ` Darrick J. Wong
2024-08-20 17:04 ` [PATCH 2/6] xfs: return bool from xfs_attr3_leaf_add Christoph Hellwig
2024-08-21 15:56 ` Darrick J. Wong
2024-08-20 17:04 ` [PATCH 3/6] xfs: distinguish extra split from real ENOSPC from xfs_attr3_leaf_split Christoph Hellwig
2024-08-21 15:57 ` Darrick J. Wong
2024-08-22 3:40 ` Christoph Hellwig
2024-08-20 17:04 ` [PATCH 4/6] xfs: fold xfs_bmap_alloc_userdata into xfs_bmapi_allocate Christoph Hellwig
2024-08-21 15:59 ` Darrick J. Wong [this message]
2024-08-20 17:04 ` [PATCH 5/6] xfs: call xfs_bmap_exact_minlen_extent_alloc from xfs_bmap_btalloc Christoph Hellwig
2024-08-21 8:24 ` Christoph Hellwig
2024-08-21 16:04 ` Darrick J. Wong
2024-08-20 17:04 ` [PATCH 6/6] xfs: support lowmode allocations in xfs_bmap_exact_minlen_extent_alloc Christoph Hellwig
2024-08-21 16:07 ` Darrick J. Wong
2024-08-22 3:41 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2024-08-24 3:40 fix a DEBUG-only assert failure in xfs/538 v2 Christoph Hellwig
2024-08-24 3:40 ` [PATCH 4/6] xfs: fold xfs_bmap_alloc_userdata into xfs_bmapi_allocate Christoph Hellwig
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=20240821155903.GY865349@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=chandan.babu@oracle.com \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
/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