From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 8/8] xfs: replace xfs_qm_get_rtblks with a direct call to xfs_bmap_count_leaves
Date: Tue, 29 Aug 2017 11:44:21 -0700 [thread overview]
Message-ID: <20170829184421.GA4757@magnolia> (raw)
In-Reply-To: <20170829174835.2218-9-hch@lst.de>
On Tue, Aug 29, 2017 at 07:48:35PM +0200, Christoph Hellwig wrote:
> Use the existing functionality instead of directly poking into the extent
> list.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/xfs_qm.c | 44 ++++++++++++--------------------------------
> 1 file changed, 12 insertions(+), 32 deletions(-)
>
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index 15751dc2a27d..010a13a201aa 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -31,6 +31,7 @@
> #include "xfs_error.h"
> #include "xfs_bmap.h"
> #include "xfs_bmap_btree.h"
> +#include "xfs_bmap_util.h"
> #include "xfs_trans.h"
> #include "xfs_trans_space.h"
> #include "xfs_qm.h"
> @@ -1120,31 +1121,6 @@ xfs_qm_quotacheck_dqadjust(
> return 0;
> }
>
> -STATIC int
> -xfs_qm_get_rtblks(
> - xfs_inode_t *ip,
> - xfs_qcnt_t *O_rtblks)
> -{
> - xfs_filblks_t rtblks; /* total rt blks */
> - xfs_extnum_t idx; /* extent record index */
> - xfs_ifork_t *ifp; /* inode fork pointer */
> - xfs_extnum_t nextents; /* number of extent entries */
> - int error;
> -
> - ASSERT(XFS_IS_REALTIME_INODE(ip));
> - ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
> - if (!(ifp->if_flags & XFS_IFEXTENTS)) {
> - if ((error = xfs_iread_extents(NULL, ip, XFS_DATA_FORK)))
> - return error;
> - }
> - rtblks = 0;
> - nextents = xfs_iext_count(ifp);
> - for (idx = 0; idx < nextents; idx++)
> - rtblks += xfs_bmbt_get_blockcount(xfs_iext_get_ext(ifp, idx));
> - *O_rtblks = (xfs_qcnt_t)rtblks;
> - return 0;
> -}
> -
> /*
> * callback routine supplied to bulkstat(). Given an inumber, find its
> * dquots and update them to account for resources taken by that inode.
> @@ -1160,7 +1136,8 @@ xfs_qm_dqusage_adjust(
> int *res) /* result code value */
> {
> xfs_inode_t *ip;
> - xfs_qcnt_t nblks, rtblks = 0;
> + xfs_qcnt_t nblks;
> + xfs_filblks_t rtblks = 0; /* total rt blks */
> int error;
>
> ASSERT(XFS_IS_QUOTA_RUNNING(mp));
> @@ -1190,12 +1167,15 @@ xfs_qm_dqusage_adjust(
> ASSERT(ip->i_delayed_blks == 0);
>
> if (XFS_IS_REALTIME_INODE(ip)) {
> - /*
> - * Walk thru the extent list and count the realtime blocks.
> - */
> - error = xfs_qm_get_rtblks(ip, &rtblks);
> - if (error)
> - goto error0;
> + struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
> +
> + if (!(ifp->if_flags & XFS_IFEXTENTS)) {
> + error = xfs_iread_extents(NULL, ip, XFS_DATA_FORK);
> + if (error)
> + goto error0;
> + }
> +
> + xfs_bmap_count_leaves(ifp, &rtblks);
> }
>
> nblks = (xfs_qcnt_t)ip->i_d.di_nblocks - rtblks;
> --
> 2.11.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:[~2017-08-29 18:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-29 17:48 a few extent lookup cleanups Christoph Hellwig
2017-08-29 17:48 ` [PATCH 1/8] xfs: add a xfs_iext_update_extent helper Christoph Hellwig
2017-08-29 18:09 ` Darrick J. Wong
2017-08-29 17:48 ` [PATCH 2/8] xfs: switch xfs_bmap_local_to_extents to use xfs_iext_insert Christoph Hellwig
2017-08-29 18:13 ` Darrick J. Wong
2017-08-29 17:48 ` [PATCH 3/8] xfs: use xfs_iext_get_extent in xfs_bmap_first_unused Christoph Hellwig
2017-08-29 18:41 ` Darrick J. Wong
2017-09-01 20:06 ` Christoph Hellwig
2017-09-01 20:08 ` Darrick J. Wong
2017-08-29 17:48 ` [PATCH 4/8] xfs: move some code around inside xfs_bmap_shift_extents Christoph Hellwig
2017-08-29 19:35 ` Darrick J. Wong
2017-08-29 17:48 ` [PATCH 5/8] xfs: use xfs_iext_*_extent helpers in xfs_bmap_shift_extents Christoph Hellwig
2017-08-30 0:05 ` Darrick J. Wong
2017-08-30 23:03 ` Darrick J. Wong
2017-08-29 17:48 ` [PATCH 6/8] xfs: use xfs_iext_*_extent helpers in xfs_bmap_split_extent_at Christoph Hellwig
2017-08-29 18:42 ` Darrick J. Wong
2017-08-29 17:48 ` [PATCH 7/8] xfs: rewrite xfs_bmap_count_leaves using xfs_iext_get_extent Christoph Hellwig
2017-08-29 18:43 ` Darrick J. Wong
2017-08-29 17:48 ` [PATCH 8/8] xfs: replace xfs_qm_get_rtblks with a direct call to xfs_bmap_count_leaves Christoph Hellwig
2017-08-29 18:44 ` Darrick J. Wong [this message]
2017-08-30 23:10 ` [PATCH 9/8] xfs: simplify the rmap code in xfs_bmse_merge Darrick J. Wong
2017-08-31 13:31 ` 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=20170829184421.GA4757@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