From: "Darrick J. Wong" <djwong@kernel.org>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org, allison.henderson@oracle.com
Subject: Re: [PATCH 5/3] xfs: replace inode fork size macros with functions
Date: Tue, 5 Jul 2022 18:09:58 -0700 [thread overview]
Message-ID: <YsTg5hdmJtdHZTfO@magnolia> (raw)
In-Reply-To: <20220706002555.GI227878@dread.disaster.area>
On Wed, Jul 06, 2022 at 10:25:55AM +1000, Dave Chinner wrote:
> 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?
They should, but there are a surprising number of files that don't
include xfs_inode.h before xfs_inode_fork.h, which causes a ton of
compilation errors. I'll respin this series with a gigantic pile
of #include changes, but I wanted to get reviews of the main changes
in this series (patches #2 and #3) before spending time on that.
--D
> Cheers,
>
> Dave.
> --
> Dave Chinner
> david@fromorbit.com
prev parent reply other threads:[~2022-07-06 1:10 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
2022-07-06 1:09 ` Darrick J. Wong [this message]
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=YsTg5hdmJtdHZTfO@magnolia \
--to=djwong@kernel.org \
--cc=allison.henderson@oracle.com \
--cc=david@fromorbit.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 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.