From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 7/8] xfs: move extent zeroing to xfs_bmapi_allocate
Date: Mon, 28 Oct 2019 09:31:36 -0700 [thread overview]
Message-ID: <20191028163136.GG15222@magnolia> (raw)
In-Reply-To: <20191025150336.19411-8-hch@lst.de>
On Fri, Oct 25, 2019 at 05:03:35PM +0200, Christoph Hellwig wrote:
> Move the extent zeroing case there for the XFS_BMAPI_ZERO flag outside
> the low-level allocator and into xfs_bmapi_allocate, where is still
> is in transaction context, but outside the very lowlevel code where
> it doesn't belong.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> ---
> fs/xfs/libxfs/xfs_alloc.c | 7 -------
> fs/xfs/libxfs/xfs_alloc.h | 4 +---
> fs/xfs/libxfs/xfs_bmap.c | 10 ++++++----
> fs/xfs/xfs_bmap_util.c | 7 -------
> 4 files changed, 7 insertions(+), 21 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
> index 925eba9489d5..ff6454887ff3 100644
> --- a/fs/xfs/libxfs/xfs_alloc.c
> +++ b/fs/xfs/libxfs/xfs_alloc.c
> @@ -3083,13 +3083,6 @@ xfs_alloc_vextent(
> args->len);
> #endif
>
> - /* Zero the extent if we were asked to do so */
> - if (args->datatype & XFS_ALLOC_USERDATA_ZERO) {
> - error = xfs_zero_extent(args->ip, args->fsbno, args->len);
> - if (error)
> - goto error0;
> - }
> -
> }
> xfs_perag_put(args->pag);
> return 0;
> diff --git a/fs/xfs/libxfs/xfs_alloc.h b/fs/xfs/libxfs/xfs_alloc.h
> index d6ed5d2c07c2..626384d75c9c 100644
> --- a/fs/xfs/libxfs/xfs_alloc.h
> +++ b/fs/xfs/libxfs/xfs_alloc.h
> @@ -54,7 +54,6 @@ typedef struct xfs_alloc_arg {
> struct xfs_mount *mp; /* file system mount point */
> struct xfs_buf *agbp; /* buffer for a.g. freelist header */
> struct xfs_perag *pag; /* per-ag struct for this agno */
> - struct xfs_inode *ip; /* for userdata zeroing method */
> xfs_fsblock_t fsbno; /* file system block number */
> xfs_agnumber_t agno; /* allocation group number */
> xfs_agblock_t agbno; /* allocation group-relative block # */
> @@ -83,8 +82,7 @@ typedef struct xfs_alloc_arg {
> */
> #define XFS_ALLOC_USERDATA (1 << 0)/* allocation is for user data*/
> #define XFS_ALLOC_INITIAL_USER_DATA (1 << 1)/* special case start of file */
> -#define XFS_ALLOC_USERDATA_ZERO (1 << 2)/* zero extent on allocation */
> -#define XFS_ALLOC_NOBUSY (1 << 3)/* Busy extents not allowed */
> +#define XFS_ALLOC_NOBUSY (1 << 2)/* Busy extents not allowed */
>
> static inline bool
> xfs_alloc_is_userdata(int datatype)
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index c278eff29e82..6ec3c48abc1b 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -3555,8 +3555,6 @@ xfs_bmap_btalloc(
> args.wasdel = ap->wasdel;
> args.resv = XFS_AG_RESV_NONE;
> args.datatype = ap->datatype;
> - if (ap->datatype & XFS_ALLOC_USERDATA_ZERO)
> - args.ip = ap->ip;
>
> error = xfs_alloc_vextent(&args);
> if (error)
> @@ -4011,8 +4009,6 @@ xfs_bmap_alloc_userdata(
> * the busy list.
> */
> bma->datatype = XFS_ALLOC_NOBUSY;
> - if (bma->flags & XFS_BMAPI_ZERO)
> - bma->datatype |= XFS_ALLOC_USERDATA_ZERO;
> if (whichfork == XFS_DATA_FORK) {
> if (bma->offset == 0)
> bma->datatype |= XFS_ALLOC_INITIAL_USER_DATA;
> @@ -4071,6 +4067,12 @@ xfs_bmapi_allocate(
> if (error || bma->blkno == NULLFSBLOCK)
> return error;
>
> + if (bma->flags & XFS_BMAPI_ZERO) {
> + error = xfs_zero_extent(bma->ip, bma->blkno, bma->length);
> + if (error)
> + return error;
> + }
> +
> if ((ifp->if_flags & XFS_IFBROOT) && !bma->cur)
> bma->cur = xfs_bmbt_init_cursor(mp, bma->tp, bma->ip, whichfork);
> /*
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index 44d6b6469303..e418f9922bb1 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -165,13 +165,6 @@ xfs_bmap_rtalloc(
> xfs_trans_mod_dquot_byino(ap->tp, ap->ip,
> ap->wasdel ? XFS_TRANS_DQ_DELRTBCOUNT :
> XFS_TRANS_DQ_RTBCOUNT, (long) ralen);
> -
> - /* Zero the extent if we were asked to do so */
> - if (ap->datatype & XFS_ALLOC_USERDATA_ZERO) {
> - error = xfs_zero_extent(ap->ip, ap->blkno, ap->length);
> - if (error)
> - return error;
> - }
> } else {
> ap->length = 0;
> }
> --
> 2.20.1
>
next prev parent reply other threads:[~2019-10-28 16:31 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-25 15:03 a few iomap / bmap cleanups Christoph Hellwig
2019-10-25 15:03 ` [PATCH 1/8] xfs: simplify xfs_iomap_eof_align_last_fsb Christoph Hellwig
2019-10-28 15:55 ` Darrick J. Wong
2019-10-25 15:03 ` [PATCH 2/8] xfs: mark xfs_eof_alignment static Christoph Hellwig
2019-10-28 15:55 ` Darrick J. Wong
2019-10-25 15:03 ` [PATCH 3/8] xfs: remove the extsize argument to xfs_eof_alignment Christoph Hellwig
2019-10-28 16:06 ` Darrick J. Wong
2019-10-29 7:57 ` Christoph Hellwig
2019-10-25 15:03 ` [PATCH 4/8] xfs: don't log the inode in xfs_fs_map_blocks if it wasn't modified Christoph Hellwig
2019-10-28 16:12 ` Darrick J. Wong
2019-10-29 7:58 ` Christoph Hellwig
2019-10-30 16:12 ` Darrick J. Wong
2019-10-30 17:56 ` Christoph Hellwig
2019-10-25 15:03 ` [PATCH 5/8] xfs: simplify the xfs_iomap_write_direct calling conventions Christoph Hellwig
2019-10-28 16:25 ` Darrick J. Wong
2019-10-25 15:03 ` [PATCH 6/8] xfs: refactor xfs_bmapi_allocate Christoph Hellwig
2019-10-28 16:29 ` Darrick J. Wong
2019-10-25 15:03 ` [PATCH 7/8] xfs: move extent zeroing to xfs_bmapi_allocate Christoph Hellwig
2019-10-28 16:31 ` Darrick J. Wong [this message]
2019-10-25 15:03 ` [PATCH 8/8] xfs: cleanup use of the XFS_ALLOC_ flags Christoph Hellwig
2019-10-28 16:32 ` Darrick J. Wong
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=20191028163136.GG15222@magnolia \
--to=darrick.wong@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