From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 3/3] xfs: make struct xfs_buf_log_format have a consistent size
Date: Wed, 8 Jan 2020 14:33:45 -0800 [thread overview]
Message-ID: <20200108223345.GL5552@magnolia> (raw)
In-Reply-To: <20200108215120.GG23128@dread.disaster.area>
On Thu, Jan 09, 2020 at 08:51:20AM +1100, Dave Chinner wrote:
> On Tue, Jan 07, 2020 at 08:18:25PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Increase XFS_BLF_DATAMAP_SIZE by 1 to fill in the implied padding at the
> > end of struct xfs_buf_log_format. This makes the size consistent so
> > that we can check it in xfs_ondisk.h, and will be needed once we start
> > logging attribute values.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> > fs/xfs/libxfs/xfs_log_format.h | 9 +++++----
> > fs/xfs/xfs_ondisk.h | 1 +
> > 2 files changed, 6 insertions(+), 4 deletions(-)
> >
> >
> > diff --git a/fs/xfs/libxfs/xfs_log_format.h b/fs/xfs/libxfs/xfs_log_format.h
> > index 8ef31d71a9c7..5d8eb8978c33 100644
> > --- a/fs/xfs/libxfs/xfs_log_format.h
> > +++ b/fs/xfs/libxfs/xfs_log_format.h
> > @@ -462,11 +462,12 @@ static inline uint xfs_log_dinode_size(int version)
> > #define XFS_BLF_GDQUOT_BUF (1<<4)
> >
> > /*
> > - * This is the structure used to lay out a buf log item in the
> > - * log. The data map describes which 128 byte chunks of the buffer
> > - * have been logged.
> > + * This is the structure used to lay out a buf log item in the log. The data
> > + * map describes which 128 byte chunks of the buffer have been logged. Note
> > + * that XFS_BLF_DATAMAP_SIZE is an odd number so that the structure size will
> > + * be consistent between 32-bit and 64-bit platforms.
> > */
> > -#define XFS_BLF_DATAMAP_SIZE ((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / NBWORD)
> > +#define XFS_BLF_DATAMAP_SIZE (1 + ((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / NBWORD))
>
> Shouldn't this do something like:
>
> #define __XFS_BLF_DATAMAP_SIZE ((XFS_MAX_BLOCKSIZE / XFS_BLF_CHUNK) / NBWORD)
> #define XFS_BLF_DATAMAP_SIZE (__XFS_BLF_DATAMAP_SIZE + (__XFS_BLF_DATAMAP_SIZE & 1))
>
> or use an appropriate round up macro so that if we change the log
> chunk size or the max block size, it still evaluates correctly for
> all platforms?
Ok, works for me.
> /me has prototype patches around somewhere that change
> XFS_BLF_CHUNK...
I remember those...
--D
> Cheers,
>
> Dave.
> --
> Dave Chinner
> david@fromorbit.com
prev parent reply other threads:[~2020-01-08 22:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-08 4:18 [PATCH 0/3] xfs: fix buf log item memory corruption on non-amd64 Darrick J. Wong
2020-01-08 4:18 ` [PATCH 1/3] xfs: refactor remote attr value buffer invalidation Darrick J. Wong
2020-01-08 8:49 ` Christoph Hellwig
2020-01-08 17:06 ` Darrick J. Wong
2020-01-08 4:18 ` [PATCH 2/3] xfs: complain if anyone tries to create a too-large buffer log item Darrick J. Wong
2020-01-08 8:51 ` Christoph Hellwig
2020-01-08 17:22 ` Darrick J. Wong
2020-01-08 4:18 ` [PATCH 3/3] xfs: make struct xfs_buf_log_format have a consistent size Darrick J. Wong
2020-01-08 8:54 ` Christoph Hellwig
2020-01-08 16:32 ` Darrick J. Wong
2020-01-08 17:17 ` Darrick J. Wong
2020-01-08 21:51 ` Dave Chinner
2020-01-08 22:33 ` 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=20200108223345.GL5552@magnolia \
--to=darrick.wong@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox