All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Brian Foster <bfoster@redhat.com>
Cc: linux-xfs@vger.kernel.org, allison.henderson@oracle.com
Subject: Re: [PATCH 3/9] xfs: introduce new v5 bulkstat structure
Date: Wed, 3 Jul 2019 07:42:08 -0700	[thread overview]
Message-ID: <20190703144208.GT1404256@magnolia> (raw)
In-Reply-To: <20190703132346.GC26057@bfoster>

On Wed, Jul 03, 2019 at 09:23:46AM -0400, Brian Foster wrote:
> On Wed, Jun 26, 2019 at 01:45:52PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> > 
> > Introduce a new version of the in-core bulkstat structure that supports
> > our new v5 format features.  This structure also fills the gaps in the
> > previous structure.  We leave wiring up the ioctls for the next patch.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > Reviewed-by: Allison Collins <allison.henderson@oracle.com>
> > ---
> >  fs/xfs/libxfs/xfs_fs.h     |   48 ++++++++++++++++++++++++++++
> >  fs/xfs/libxfs/xfs_health.h |    2 +
> >  fs/xfs/xfs_health.c        |    2 +
> >  fs/xfs/xfs_ioctl.c         |    9 ++++-
> >  fs/xfs/xfs_ioctl.h         |    2 +
> >  fs/xfs/xfs_ioctl32.c       |   10 ++++--
> >  fs/xfs/xfs_itable.c        |   75 +++++++++++++++++++++++++++++++++-----------
> >  fs/xfs/xfs_itable.h        |    4 ++
> >  fs/xfs/xfs_ondisk.h        |    2 +
> >  9 files changed, 124 insertions(+), 30 deletions(-)
> > 
> > 
> ...
> > diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
> > index 45f0618efb8d..50c2bb8e13c4 100644
> > --- a/fs/xfs/xfs_itable.c
> > +++ b/fs/xfs/xfs_itable.c
> ...
> > @@ -266,6 +266,43 @@ xfs_bulkstat(
> >  	return error;
> >  }
> >  
> > +/* Convert bulkstat (v5) to bstat (v1). */
> > +void
> > +xfs_bulkstat_to_bstat(
> > +	struct xfs_mount		*mp,
> > +	struct xfs_bstat		*bs1,
> > +	const struct xfs_bulkstat	*bstat)
> > +{
> > +	bs1->bs_ino = bstat->bs_ino;
> > +	bs1->bs_mode = bstat->bs_mode;
> > +	bs1->bs_nlink = bstat->bs_nlink;
> > +	bs1->bs_uid = bstat->bs_uid;
> > +	bs1->bs_gid = bstat->bs_gid;
> > +	bs1->bs_rdev = bstat->bs_rdev;
> > +	bs1->bs_blksize = bstat->bs_blksize;
> > +	bs1->bs_size = bstat->bs_size;
> > +	bs1->bs_atime.tv_sec = bstat->bs_atime;
> > +	bs1->bs_mtime.tv_sec = bstat->bs_mtime;
> > +	bs1->bs_ctime.tv_sec = bstat->bs_ctime;
> > +	bs1->bs_atime.tv_nsec = bstat->bs_atime_nsec;
> > +	bs1->bs_mtime.tv_nsec = bstat->bs_mtime_nsec;
> > +	bs1->bs_ctime.tv_nsec = bstat->bs_ctime_nsec;
> > +	bs1->bs_blocks = bstat->bs_blocks;
> > +	bs1->bs_xflags = bstat->bs_xflags;
> > +	bs1->bs_extsize = bstat->bs_extsize_blks << mp->m_sb.sb_blocklog;
> > +	bs1->bs_extents = bstat->bs_extents;
> > +	bs1->bs_gen = bstat->bs_gen;
> > +	bs1->bs_projid_lo = bstat->bs_projectid & 0xFFFF;
> > +	bs1->bs_forkoff = bstat->bs_forkoff;
> > +	bs1->bs_projid_hi = bstat->bs_projectid >> 16;
> > +	bs1->bs_sick = bstat->bs_sick;
> > +	bs1->bs_checked = bstat->bs_checked;
> > +	bs1->bs_cowextsize = bstat->bs_cowextsize_blks << mp->m_sb.sb_blocklog;
> > +	bs1->bs_dmevmask = 0;
> > +	bs1->bs_dmstate = 0;
> 
> Any particular reason these fields are now stubbed out?
> Deprecated/unused? It looks like we at least still have a mechanism to
> set these values, but I have no idea if there are any users (or what
> they're for for that matter :P).

Those fields were for DMAPI hierarchal storage management, but upstream
XFS has never supported it so I didn't see much point in adding them
back.  If we do decide to support it there's plenty of space in the v5
structure.

> Also, should we zero the padding space in bs1 here? It looks like the
> callers allocate bs1 on the stack without any initialization, do the
> conversion and immediately copy to userspace.

Yes, we shouldn't be leaking unset memory contents here.  I'll change
the conversion functions to memset since the same problem happens in
userspace.

--D

> Brian
> 
> > +	bs1->bs_aextents = bstat->bs_aextents;
> > +}
> > +
> >  struct xfs_inumbers_chunk {
> >  	inumbers_fmt_pf		formatter;
> >  	struct xfs_ibulk	*breq;
> > diff --git a/fs/xfs/xfs_itable.h b/fs/xfs/xfs_itable.h
> > index cfd3c93226f3..60e259192056 100644
> > --- a/fs/xfs/xfs_itable.h
> > +++ b/fs/xfs/xfs_itable.h
> > @@ -38,10 +38,12 @@ xfs_ibulk_advance(
> >   */
> >  
> >  typedef int (*bulkstat_one_fmt_pf)(struct xfs_ibulk *breq,
> > -		const struct xfs_bstat *bstat);
> > +		const struct xfs_bulkstat *bstat);
> >  
> >  int xfs_bulkstat_one(struct xfs_ibulk *breq, bulkstat_one_fmt_pf formatter);
> >  int xfs_bulkstat(struct xfs_ibulk *breq, bulkstat_one_fmt_pf formatter);
> > +void xfs_bulkstat_to_bstat(struct xfs_mount *mp, struct xfs_bstat *bs1,
> > +		const struct xfs_bulkstat *bstat);
> >  
> >  typedef int (*inumbers_fmt_pf)(struct xfs_ibulk *breq,
> >  		const struct xfs_inogrp *igrp);
> > diff --git a/fs/xfs/xfs_ondisk.h b/fs/xfs/xfs_ondisk.h
> > index c8ba98fae30a..0b4cdda68524 100644
> > --- a/fs/xfs/xfs_ondisk.h
> > +++ b/fs/xfs/xfs_ondisk.h
> > @@ -146,6 +146,8 @@ xfs_check_ondisk_structs(void)
> >  	XFS_CHECK_OFFSET(struct xfs_dir3_data_hdr, hdr.magic,	0);
> >  	XFS_CHECK_OFFSET(struct xfs_dir3_free, hdr.hdr.magic,	0);
> >  	XFS_CHECK_OFFSET(struct xfs_attr3_leafblock, hdr.info.hdr, 0);
> > +
> > +	XFS_CHECK_STRUCT_SIZE(struct xfs_bulkstat,		192);
> >  }
> >  
> >  #endif /* __XFS_ONDISK_H */
> > 

  reply	other threads:[~2019-07-03 14:42 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-26 20:45 [PATCH v6 0/9] xfs: introduce new BULKSTAT and INUMBERS ioctls Darrick J. Wong
2019-06-26 20:45 ` [PATCH 1/9] xfs: remove various bulk request typedef usage Darrick J. Wong
2019-07-03 13:22   ` Brian Foster
2019-06-26 20:45 ` [PATCH 2/9] xfs: rename bulkstat functions Darrick J. Wong
2019-07-03 13:22   ` Brian Foster
2019-06-26 20:45 ` [PATCH 3/9] xfs: introduce new v5 bulkstat structure Darrick J. Wong
2019-07-03 13:23   ` Brian Foster
2019-07-03 14:42     ` Darrick J. Wong [this message]
2019-07-03 15:32   ` [PATCH v2 " Darrick J. Wong
2019-07-03 16:31     ` Brian Foster
2019-06-26 20:45 ` [PATCH 4/9] xfs: introduce v5 inode group structure Darrick J. Wong
2019-07-03 13:23   ` Brian Foster
2019-06-26 20:46 ` [PATCH 5/9] xfs: wire up new v5 bulkstat ioctls Darrick J. Wong
2019-07-03 13:24   ` Brian Foster
2019-06-26 20:46 ` [PATCH 6/9] xfs: wire up the new v5 bulkstat_single ioctl Darrick J. Wong
2019-07-03 13:24   ` Brian Foster
2019-07-03 14:52     ` Darrick J. Wong
2019-07-03 16:11       ` Brian Foster
2019-07-03 20:01         ` Darrick J. Wong
2019-07-05 11:05           ` Brian Foster
2019-07-05 16:26             ` Darrick J. Wong
2019-06-26 20:46 ` [PATCH 7/9] xfs: wire up the v5 INUMBERS ioctl Darrick J. Wong
2019-07-03 13:24   ` Brian Foster
2019-06-26 20:46 ` [PATCH 8/9] xfs: specify AG in bulk req Darrick J. Wong
2019-07-03 13:25   ` Brian Foster
2019-06-26 20:46 ` [PATCH 9/9] xfs: allow bulkstat_single of special inodes Darrick J. Wong
2019-07-03 13:25   ` Brian Foster
2019-07-03 15:09     ` Darrick J. Wong
2019-07-03 15:34   ` [PATCH v2 " Darrick J. Wong
2019-07-03 16:32     ` Brian Foster
2019-07-04  6:51   ` [PATCH v3 " Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2019-06-12  6:49 [PATCH v5 0/9] xfs: introduce new BULKSTAT and INUMBERS ioctls Darrick J. Wong
2019-06-12  6:49 ` [PATCH 3/9] xfs: introduce new v5 bulkstat structure Darrick J. Wong
2019-05-29 22:27 [PATCH 0/9] xfs: introduce new BULKSTAT and INUMBERS ioctls Darrick J. Wong
2019-05-29 22:27 ` [PATCH 3/9] xfs: introduce new v5 bulkstat structure Darrick J. Wong
2019-06-05 22:29   ` Allison Collins
2019-06-06 20:17     ` Darrick J. Wong
2019-06-06 22:41       ` Allison Collins

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=20190703144208.GT1404256@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=allison.henderson@oracle.com \
    --cc=bfoster@redhat.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.