From: Brian Foster <bfoster@redhat.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/6] xfs: refactor accounting updates out of xfs_bmap_btalloc
Date: Fri, 26 Jan 2018 14:06:36 -0500 [thread overview]
Message-ID: <20180126190636.GA26910@bfoster.bfoster> (raw)
In-Reply-To: <151693229417.7395.1737479240326881862.stgit@magnolia>
On Thu, Jan 25, 2018 at 06:04:54PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Move all the inode and quota accounting updates out of xfs_bmap_btalloc
> in preparation for fixing some quota accounting problems with copy on
> write.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
Modulo Christoph's comments:
Reviewed-by: Brian Foster <bfoster@redhat.com>
> fs/xfs/libxfs/xfs_bmap.c | 34 +++++++++++++++++++++-------------
> 1 file changed, 21 insertions(+), 13 deletions(-)
>
>
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index 0c9c9cd..6ad79ea 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -3337,6 +3337,26 @@ xfs_bmap_btalloc_filestreams(
> return 0;
> }
>
> +/* Update all inode and quota accounting for the allocation we just did. */
> +static void
> +xfs_bmap_btalloc_accounting(
> + struct xfs_bmalloca *ap,
> + struct xfs_alloc_arg *args)
> +{
> + if (!(ap->flags & XFS_BMAPI_COWFORK))
> + ap->ip->i_d.di_nblocks += args->len;
> + xfs_trans_log_inode(ap->tp, ap->ip, XFS_ILOG_CORE);
> + if (ap->wasdel)
> + ap->ip->i_delayed_blks -= args->len;
> + /*
> + * Adjust the disk quota also. This was reserved
> + * earlier.
> + */
> + xfs_trans_mod_dquot_byino(ap->tp, ap->ip,
> + ap->wasdel ? XFS_TRANS_DQ_DELBCOUNT : XFS_TRANS_DQ_BCOUNT,
> + (long) args->len);
> +}
> +
> STATIC int
> xfs_bmap_btalloc(
> struct xfs_bmalloca *ap) /* bmap alloc argument struct */
> @@ -3571,19 +3591,7 @@ xfs_bmap_btalloc(
> *ap->firstblock = args.fsbno;
> ASSERT(nullfb || fb_agno <= args.agno);
> ap->length = args.len;
> - if (!(ap->flags & XFS_BMAPI_COWFORK))
> - ap->ip->i_d.di_nblocks += args.len;
> - xfs_trans_log_inode(ap->tp, ap->ip, XFS_ILOG_CORE);
> - if (ap->wasdel)
> - ap->ip->i_delayed_blks -= args.len;
> - /*
> - * Adjust the disk quota also. This was reserved
> - * earlier.
> - */
> - xfs_trans_mod_dquot_byino(ap->tp, ap->ip,
> - ap->wasdel ? XFS_TRANS_DQ_DELBCOUNT :
> - XFS_TRANS_DQ_BCOUNT,
> - (long) args.len);
> + xfs_bmap_btalloc_accounting(ap, &args);
> } else {
> ap->blkno = NULLFSBLOCK;
> ap->length = 0;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2018-01-26 19:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-26 2:04 [PATCH v2 0/6] xfs: reflink/scrub/quota fixes Darrick J. Wong
2018-01-26 2:04 ` [PATCH 1/6] xfs: refactor accounting updates out of xfs_bmap_btalloc Darrick J. Wong
2018-01-26 12:19 ` Christoph Hellwig
2018-01-26 19:06 ` Brian Foster [this message]
2018-01-26 2:05 ` [PATCH 2/6] xfs: CoW fork operations should only update quota reservations Darrick J. Wong
2018-01-26 19:06 ` Brian Foster
2018-01-26 19:20 ` Darrick J. Wong
2018-01-26 2:05 ` [PATCH 3/6] xfs: track CoW blocks separately in the inode Darrick J. Wong
2018-01-26 2:05 ` [PATCH 4/6] xfs: don't screw up direct writes when freesp is fragmented Darrick J. Wong
2018-01-26 19:24 ` Brian Foster
2018-01-26 19:49 ` Darrick J. Wong
2018-01-26 2:05 ` [PATCH 5/6] xfs: skip CoW writes past EOF when writeback races with truncate Darrick J. Wong
2018-01-26 12:21 ` Christoph Hellwig
2018-01-26 2:05 ` [PATCH 6/6] xfs: don't clobber inobt/finobt cursors when xref with rmap Darrick J. Wong
2018-01-26 12:18 ` [PATCH v2 0/6] xfs: reflink/scrub/quota fixes 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=20180126190636.GA26910@bfoster.bfoster \
--to=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--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