From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 06/21] xfs: make xfs_bmapi_remapi work with attribute forks
Date: Fri, 6 Apr 2018 10:31:46 -0700 [thread overview]
Message-ID: <20180406173146.GK7500@magnolia> (raw)
In-Reply-To: <20180405231223.GK23861@dastard>
On Fri, Apr 06, 2018 at 09:12:23AM +1000, Dave Chinner wrote:
> On Mon, Apr 02, 2018 at 12:56:53PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Add a new flags argument to xfs_bmapi_remapi so that we can pass BMAPI
> > flags into the function. This enables us to pass in BMAPI_ATTRFORK so
> > that we can remap things into the attribute fork. Eventually the
> > online repair code will use this to rebuild attribute forks, so make it
> > non-static.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> > fs/xfs/libxfs/xfs_bmap.c | 36 +++++++++++++++++++++++-------------
> > fs/xfs/libxfs/xfs_bmap.h | 4 ++++
> > 2 files changed, 27 insertions(+), 13 deletions(-)
> >
> >
> > diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> > index 519ef9c..c676d5c 100644
> > --- a/fs/xfs/libxfs/xfs_bmap.c
> > +++ b/fs/xfs/libxfs/xfs_bmap.c
> > @@ -4512,30 +4512,37 @@ xfs_bmapi_write(
> > return error;
> > }
> >
> > -static int
> > +int
> > xfs_bmapi_remap(
> > struct xfs_trans *tp,
> > struct xfs_inode *ip,
> > xfs_fileoff_t bno,
> > xfs_filblks_t len,
> > xfs_fsblock_t startblock,
> > - struct xfs_defer_ops *dfops)
> > + struct xfs_defer_ops *dfops,
> > + int flags)
> > {
> > struct xfs_mount *mp = ip->i_mount;
> > - struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
> > + struct xfs_ifork *ifp;
> > struct xfs_btree_cur *cur = NULL;
> > xfs_fsblock_t firstblock = NULLFSBLOCK;
> > struct xfs_bmbt_irec got;
> > struct xfs_iext_cursor icur;
> > + int whichfork = xfs_bmapi_whichfork(flags);
> > int logflags = 0, error;
> >
> > + ifp = XFS_IFORK_PTR(ip, whichfork);
> > ASSERT(len > 0);
> > ASSERT(len <= (xfs_filblks_t)MAXEXTLEN);
> > ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
> > + ASSERT(!(flags & (XFS_BMAPI_DELALLOC | XFS_BMAPI_COWFORK |
> > + XFS_BMAPI_ZERO | XFS_BMAPI_CONVERT |
> > + XFS_BMAPI_IGSTATE | XFS_BMAPI_METADATA |
> > + XFS_BMAPI_ENTIRE | XFS_BMAPI_CONVERT_ONLY)));
>
> Wouldn't it be better just to assert it's a flag that is supported?
> i.e.
>
> ASSERT(!flags || (flags & XFS_BMAPI_ATTRFORK));
Yes... but I want to allow XFS_BMAPI_PREALLOC too.
Ugh, that's a gross mess.
ASSERT(!(flags & ~(XFS_BMAPI_ATTRFORK | XFS_BMAPI_PREALLOC)));
covers all four cases, I think. Granted it probably needs a further
test to screen out (ATTRFORK | PREALLOC)...
> > @@ -4569,18 +4576,21 @@ xfs_bmapi_remap(
> > got.br_startoff = bno;
> > got.br_startblock = startblock;
> > got.br_blockcount = len;
> > - got.br_state = XFS_EXT_NORM;
> > + if (flags & XFS_BMAPI_PREALLOC)
> > + got.br_state = XFS_EXT_UNWRITTEN;
> > + else
> > + got.br_state = XFS_EXT_NORM;
>
> This seems unrelated to the attr fork support change?
Oops, yeah. Will split this out into a separate patch.
--D
> Cheers,
>
> Dave.
> --
> Dave Chinner
> david@fromorbit.com
> --
> 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:[~2018-04-06 17:31 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-02 19:56 [PATCH v14.1 00/21] xfs: online repair support Darrick J. Wong
2018-04-02 19:56 ` [PATCH 01/21] xfs: add helpers to calculate btree size Darrick J. Wong
2018-04-02 19:56 ` [PATCH 02/21] xfs: expose various functions to repair code Darrick J. Wong
2018-04-02 19:56 ` [PATCH 03/21] xfs: add repair helpers for the reverse mapping btree Darrick J. Wong
2018-04-05 23:02 ` Dave Chinner
2018-04-06 16:31 ` Darrick J. Wong
2018-04-02 19:56 ` [PATCH 04/21] xfs: add repair helpers for the reference count btree Darrick J. Wong
2018-04-02 19:56 ` [PATCH 05/21] xfs: add BMAPI_NORMAP flag to perform block remapping without updating rmapbt Darrick J. Wong
2018-04-05 23:07 ` Dave Chinner
2018-04-06 16:41 ` Darrick J. Wong
2018-04-02 19:56 ` [PATCH 06/21] xfs: make xfs_bmapi_remapi work with attribute forks Darrick J. Wong
2018-04-05 23:12 ` Dave Chinner
2018-04-06 17:31 ` Darrick J. Wong [this message]
2018-04-02 19:56 ` [PATCH 07/21] xfs: halt auto-reclamation activities while rebuilding rmap Darrick J. Wong
2018-04-05 23:14 ` Dave Chinner
2018-04-02 19:57 ` [PATCH 08/21] xfs: create tracepoints for online repair Darrick J. Wong
2018-04-05 23:15 ` Dave Chinner
2018-04-02 19:57 ` [PATCH 09/21] xfs: implement the metadata repair ioctl flag Darrick J. Wong
2018-04-05 23:24 ` Dave Chinner
2018-04-02 19:57 ` [PATCH 10/21] xfs: add helper routines for the repair code Darrick J. Wong
2018-04-06 0:52 ` Dave Chinner
2018-04-07 17:55 ` Darrick J. Wong
2018-04-09 0:23 ` Dave Chinner
2018-04-09 17:19 ` Darrick J. Wong
2018-04-02 19:57 ` [PATCH 11/21] xfs: repair superblocks Darrick J. Wong
2018-04-06 1:05 ` Dave Chinner
2018-04-07 18:04 ` Darrick J. Wong
2018-04-09 0:26 ` Dave Chinner
2018-04-09 17:36 ` Darrick J. Wong
2018-04-02 19:57 ` [PATCH 12/21] xfs: repair the AGF and AGFL Darrick J. Wong
2018-04-02 19:57 ` [PATCH 13/21] xfs: repair the AGI Darrick J. Wong
2018-04-02 19:57 ` [PATCH 14/21] xfs: repair free space btrees Darrick J. Wong
2018-04-02 19:57 ` [PATCH 15/21] xfs: repair inode btrees Darrick J. Wong
2018-04-02 19:57 ` [PATCH 16/21] xfs: repair the rmapbt Darrick J. Wong
2018-04-02 19:58 ` [PATCH 17/21] xfs: repair refcount btrees Darrick J. Wong
2018-04-02 19:58 ` [PATCH 18/21] xfs: repair inode records Darrick J. Wong
2018-04-02 19:58 ` [PATCH 19/21] xfs: zap broken inode forks Darrick J. Wong
2018-04-02 19:58 ` [PATCH 20/21] xfs: repair inode block maps Darrick J. Wong
2018-04-02 19:58 ` [PATCH 21/21] xfs: repair damaged symlinks 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=20180406173146.GK7500@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;
as well as URLs for NNTP newsgroup(s).