From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 01/15] xfs: add a xfs_bmap_fork_to_state helper
Date: Thu, 19 Oct 2017 15:48:39 -0700 [thread overview]
Message-ID: <20171019224839.GQ4755@magnolia> (raw)
In-Reply-To: <20171019065942.18813-2-hch@lst.de>
On Thu, Oct 19, 2017 at 08:59:28AM +0200, Christoph Hellwig wrote:
> This creates the right initial bmap state from the passed in inode
> fork enum.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/libxfs/xfs_bmap.c | 45 +++++++++------------------------------------
> fs/xfs/libxfs/xfs_bmap.h | 12 ++++++++++++
> 2 files changed, 21 insertions(+), 36 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index 6c2ae3011964..676fc8aed67f 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -499,12 +499,7 @@ xfs_bmap_trace_exlist(
> {
> xfs_extnum_t idx; /* extent record index */
> xfs_ifork_t *ifp; /* inode fork pointer */
> - int state = 0;
> -
> - if (whichfork == XFS_ATTR_FORK)
> - state |= BMAP_ATTRFORK;
> - else if (whichfork == XFS_COW_FORK)
> - state |= BMAP_COWFORK;
> + int state = xfs_bmap_fork_to_state(whichfork);
>
> ifp = XFS_IFORK_PTR(ip, whichfork);
> ASSERT(cnt == xfs_iext_count(ifp));
> @@ -925,8 +920,7 @@ xfs_bmap_local_to_extents(
> rec.br_state = XFS_EXT_NORM;
> xfs_iext_insert(ip, 0, 1, &rec, 0);
>
> - trace_xfs_bmap_post_update(ip, 0,
> - whichfork == XFS_ATTR_FORK ? BMAP_ATTRFORK : 0,
> + trace_xfs_bmap_post_update(ip, 0, xfs_bmap_fork_to_state(whichfork),
> _THIS_IP_);
> XFS_IFORK_NEXT_SET(ip, whichfork, 1);
> ip->i_d.di_nblocks = 1;
> @@ -1571,7 +1565,7 @@ xfs_bmap_add_extent_delay_real(
> xfs_bmbt_irec_t r[3]; /* neighbor extent entries */
> /* left is 0, right is 1, prev is 2 */
> int rval=0; /* return value (logging flags) */
> - int state = 0;/* state bits, accessed thru macros */
> + int state = xfs_bmap_fork_to_state(whichfork);
> xfs_filblks_t da_new; /* new count del alloc blocks used */
> xfs_filblks_t da_old; /* old count del alloc blocks used */
> xfs_filblks_t temp=0; /* value for da_new calculations */
> @@ -1598,9 +1592,6 @@ xfs_bmap_add_extent_delay_real(
> #define RIGHT r[1]
> #define PREV r[2]
>
> - if (whichfork == XFS_COW_FORK)
> - state |= BMAP_COWFORK;
> -
> /*
> * Set up a bunch of variables to make the tests simpler.
> */
> @@ -2108,7 +2099,7 @@ xfs_bmap_add_extent_unwritten_real(
> xfs_bmbt_irec_t r[3]; /* neighbor extent entries */
> /* left is 0, right is 1, prev is 2 */
> int rval=0; /* return value (logging flags) */
> - int state = 0;/* state bits, accessed thru macros */
> + int state = xfs_bmap_fork_to_state(whichfork);
> struct xfs_mount *mp = ip->i_mount;
> struct xfs_bmbt_irec old;
>
> @@ -2116,8 +2107,6 @@ xfs_bmap_add_extent_unwritten_real(
>
> cur = *curp;
> ifp = XFS_IFORK_PTR(ip, whichfork);
> - if (whichfork == XFS_COW_FORK)
> - state |= BMAP_COWFORK;
>
> ASSERT(*idx >= 0);
> ASSERT(*idx <= xfs_iext_count(ifp));
> @@ -2601,13 +2590,10 @@ xfs_bmap_add_extent_hole_delay(
> xfs_filblks_t newlen=0; /* new indirect size */
> xfs_filblks_t oldlen=0; /* old indirect size */
> xfs_bmbt_irec_t right; /* right neighbor extent entry */
> - int state; /* state bits, accessed thru macros */
> + int state = xfs_bmap_fork_to_state(whichfork);
> xfs_filblks_t temp; /* temp for indirect calculations */
>
> ifp = XFS_IFORK_PTR(ip, whichfork);
> - state = 0;
> - if (whichfork == XFS_COW_FORK)
> - state |= BMAP_COWFORK;
> ASSERT(isnullstartblock(new->br_startblock));
>
> /*
> @@ -2760,7 +2746,7 @@ xfs_bmap_add_extent_hole_real(
> xfs_bmbt_irec_t left; /* left neighbor extent entry */
> xfs_bmbt_irec_t right; /* right neighbor extent entry */
> int rval=0; /* return value (logging flags) */
> - int state; /* state bits, accessed thru macros */
> + int state = xfs_bmap_fork_to_state(whichfork);
> struct xfs_bmbt_irec old;
>
> ASSERT(*idx >= 0);
> @@ -2770,12 +2756,6 @@ xfs_bmap_add_extent_hole_real(
>
> XFS_STATS_INC(mp, xs_add_exlist);
>
> - state = 0;
> - if (whichfork == XFS_ATTR_FORK)
> - state |= BMAP_ATTRFORK;
> - if (whichfork == XFS_COW_FORK)
> - state |= BMAP_COWFORK;
> -
> /*
> * Check and set flags if this segment has a left neighbor.
> */
> @@ -4737,7 +4717,8 @@ xfs_bmap_del_extent_delay(
> int64_t da_old, da_new, da_diff = 0;
> xfs_fileoff_t del_endoff, got_endoff;
> xfs_filblks_t got_indlen, new_indlen, stolen;
> - int error = 0, state = 0;
> + int state = xfs_bmap_fork_to_state(whichfork);
> + int error = 0;
> bool isrt;
>
> XFS_STATS_INC(mp, xs_del_exlist);
> @@ -4773,9 +4754,6 @@ xfs_bmap_del_extent_delay(
> return error;
> ip->i_delayed_blks -= del->br_blockcount;
>
> - if (whichfork == XFS_COW_FORK)
> - state |= BMAP_COWFORK;
> -
> if (got->br_startoff == del->br_startoff)
> state |= BMAP_LEFT_FILLING;
> if (got_endoff == del_endoff)
> @@ -4969,17 +4947,12 @@ xfs_bmap_del_extent_real(
> xfs_bmbt_irec_t new; /* new record to be inserted */
> /* REFERENCED */
> uint qfield; /* quota field to update */
> - int state = 0;
> + int state = xfs_bmap_fork_to_state(whichfork);
> struct xfs_bmbt_irec old;
>
> mp = ip->i_mount;
> XFS_STATS_INC(mp, xs_del_exlist);
>
> - if (whichfork == XFS_ATTR_FORK)
> - state |= BMAP_ATTRFORK;
> - else if (whichfork == XFS_COW_FORK)
> - state |= BMAP_COWFORK;
> -
> ifp = XFS_IFORK_PTR(ip, whichfork);
> ASSERT((*idx >= 0) && (*idx < xfs_iext_count(ifp)));
> ASSERT(del->br_blockcount > 0);
> diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h
> index 851982a5dfbc..a61c5480b6ad 100644
> --- a/fs/xfs/libxfs/xfs_bmap.h
> +++ b/fs/xfs/libxfs/xfs_bmap.h
> @@ -277,4 +277,16 @@ int xfs_bmap_map_extent(struct xfs_mount *mp, struct xfs_defer_ops *dfops,
> int xfs_bmap_unmap_extent(struct xfs_mount *mp, struct xfs_defer_ops *dfops,
> struct xfs_inode *ip, struct xfs_bmbt_irec *imap);
>
> +static inline int xfs_bmap_fork_to_state(int whichfork)
> +{
> + switch (whichfork) {
> + case XFS_ATTR_FORK:
> + return BMAP_ATTRFORK;
> + case XFS_COW_FORK:
> + return BMAP_COWFORK;
> + default:
> + return 0;
> + }
> +}
> +
> #endif /* __XFS_BMAP_H__ */
> --
> 2.14.1
>
> --
> 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-10-19 22:48 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-19 6:59 more extent mapping cleanups Christoph Hellwig
2017-10-19 6:59 ` [PATCH 01/15] xfs: add a xfs_bmap_fork_to_state helper Christoph Hellwig
2017-10-19 22:48 ` Darrick J. Wong [this message]
2017-10-19 6:59 ` [PATCH 02/15] xfs: make better use of the 'state' variable in xfs_bmap_del_extent_real Christoph Hellwig
2017-10-19 22:49 ` Darrick J. Wong
2017-10-19 6:59 ` [PATCH 03/15] xfs: remove post-bmap tracing in xfs_bmap_local_to_extents Christoph Hellwig
2017-10-19 22:49 ` Darrick J. Wong
2017-10-19 6:59 ` [PATCH 04/15] xfs: move pre/post-bmap tracing into xfs_iext_update_extent Christoph Hellwig
2017-10-19 22:50 ` Darrick J. Wong
2017-10-19 6:59 ` [PATCH 05/15] xfs: remove XFS_BMAP_TRACE_EXLIST Christoph Hellwig
2017-10-19 22:50 ` Darrick J. Wong
2017-10-19 6:59 ` [PATCH 06/15] xfs: remove the never fully implemented UUID fork format Christoph Hellwig
2017-10-19 22:48 ` Darrick J. Wong
2017-10-20 7:02 ` Christoph Hellwig
2017-10-20 16:52 ` Darrick J. Wong
2017-10-19 6:59 ` [PATCH 07/15] xfs: remove if_rdev Christoph Hellwig
2017-10-19 22:52 ` Darrick J. Wong
2017-10-19 6:59 ` [PATCH 08/15] xfs: inline xfs_shift_file_space into callers Christoph Hellwig
2017-10-21 0:07 ` Darrick J. Wong
2017-10-21 8:13 ` Christoph Hellwig
2017-10-21 18:06 ` Darrick J. Wong
2017-10-19 6:59 ` [PATCH 09/15] xfs: remove XFS_BMAP_MAX_SHIFT_EXTENTS Christoph Hellwig
2017-10-21 0:10 ` Darrick J. Wong
2017-10-19 6:59 ` [PATCH 10/15] xfs: split xfs_bmap_shift_extents Christoph Hellwig
2017-10-21 0:22 ` Darrick J. Wong
2017-10-19 6:59 ` [PATCH 11/15] xfs: remove xfs_bmse_shift_one Christoph Hellwig
2017-10-21 0:25 ` Darrick J. Wong
2017-10-19 6:59 ` [PATCH 12/15] xfs: update got in xfs_bmap_shift_update_extent Christoph Hellwig
2017-10-21 0:25 ` Darrick J. Wong
2017-10-19 6:59 ` [PATCH 13/15] xfs: don't rely on extent indices in xfs_bmap_collapse_extents Christoph Hellwig
2017-10-21 0:26 ` Darrick J. Wong
2017-10-19 6:59 ` [PATCH 14/15] xfs: don't rely on extent indices in xfs_bmap_insert_extents Christoph Hellwig
2017-10-21 0:27 ` Darrick J. Wong
2017-10-19 6:59 ` [PATCH 15/15] xfs: rewrite xfs_bmap_first_unused to make better use of xfs_iext_get_extent Christoph Hellwig
2017-10-21 0:27 ` Darrick J. Wong
2017-10-19 20:04 ` more extent mapping cleanups 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=20171019224839.GQ4755@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;
as well as URLs for NNTP newsgroup(s).