All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org, allison.henderson@oracle.com
Subject: Re: [PATCH 5/3] xfs: replace inode fork size macros with functions
Date: Wed, 6 Jul 2022 10:25:55 +1000	[thread overview]
Message-ID: <20220706002555.GI227878@dread.disaster.area> (raw)
In-Reply-To: <YsTG/Juy45im6Wzv@magnolia>

On Tue, Jul 05, 2022 at 04:19:24PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Replace the shouty macros here with typechecked helper functions.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>

looks good.

Reviewed-by: Dave Chinner <dchinner@redhat.com>

.....
> diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
> index 2badbf9bb80d..7ff828504b3c 100644
> --- a/fs/xfs/xfs_inode.h
> +++ b/fs/xfs/xfs_inode.h
> @@ -102,6 +102,41 @@ xfs_ifork_ptr(
>  	}
>  }
>  
> +static inline unsigned int xfs_inode_fork_boff(struct xfs_inode *ip)
> +{
> +	return ip->i_forkoff << 3;
> +}
> +
> +static inline unsigned int xfs_inode_data_fork_size(struct xfs_inode *ip)
> +{
> +	if (xfs_inode_has_attr_fork(ip))
> +		return xfs_inode_fork_boff(ip);
> +
> +	return XFS_LITINO(ip->i_mount);
> +}
> +
> +static inline unsigned int xfs_inode_attr_fork_size(struct xfs_inode *ip)
> +{
> +	if (xfs_inode_has_attr_fork(ip))
> +		return XFS_LITINO(ip->i_mount) - xfs_inode_fork_boff(ip);
> +	return 0;
> +}
> +
> +static inline unsigned int
> +xfs_inode_fork_size(
> +	struct xfs_inode	*ip,
> +	int			whichfork)
> +{
> +	switch (whichfork) {
> +	case XFS_DATA_FORK:
> +		return xfs_inode_data_fork_size(ip);
> +	case XFS_ATTR_FORK:
> +		return xfs_inode_attr_fork_size(ip);
> +	default:
> +		return 0;
> +	}
> +}

As an aside, one of the things I noticed when doing the 5.19 libxfs
sync was that there's some generic xfs_inode stuff in
fs/xfs/xfs_inode.h that is duplicated in include/xfs_inode.h in
userspace. I suspect all this new stuff here will end up being
duplicated, too.

Hence I'm wondering if these new functions should end up in
libxfs/xfs_inode_fork.h rather than xfs_inode.h?

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2022-07-06  0:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-05 22:09 [PATCHSET 0/3] xfs: make attr forks permanent Darrick J. Wong
2022-07-05 22:09 ` [PATCH 1/3] xfs: convert XFS_IFORK_PTR to a static inline helper Darrick J. Wong
2022-07-05 22:44   ` Dave Chinner
2022-07-05 22:09 ` [PATCH 2/3] xfs: make inode attribute forks a permanent part of struct xfs_inode Darrick J. Wong
2022-07-08  4:30   ` Dave Chinner
2022-07-05 22:09 ` [PATCH 3/3] xfs: use XFS_IFORK_Q to determine the presence of an xattr fork Darrick J. Wong
2022-07-05 22:43   ` Dave Chinner
2022-07-05 22:59     ` Darrick J. Wong
2022-07-05 23:18 ` [PATCH 4/3] xfs: replace XFS_IFORK_Q with a proper predicate function Darrick J. Wong
2022-07-06  0:18   ` Dave Chinner
2022-07-05 23:19 ` [PATCH 5/3] xfs: replace inode fork size macros with functions Darrick J. Wong
2022-07-06  0:25   ` Dave Chinner [this message]
2022-07-06  1:09     ` 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=20220706002555.GI227878@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=allison.henderson@oracle.com \
    --cc=djwong@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.