From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Allison Henderson <allison.henderson@oracle.com>
Cc: linux-xfs@vger.kernel.org, Dave Chinner <dchinner@redhat.com>
Subject: Re: [PATCH 14/17] xfs: remove parent pointers in unlink
Date: Thu, 19 Oct 2017 12:43:10 -0700 [thread overview]
Message-ID: <20171019194310.GI4755@magnolia> (raw)
In-Reply-To: <1508367333-3237-15-git-send-email-allison.henderson@oracle.com>
On Wed, Oct 18, 2017 at 03:55:30PM -0700, Allison Henderson wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> [bfoster: rebase, use VFS inode generation]
> [achender: rebased, changed __unint32_t to xfs_dir2_dataptr_t
> implemented xfs_attr_remove_parent]
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
> ---
> fs/xfs/libxfs/xfs_attr.c | 15 +++++++++++++++
> fs/xfs/libxfs/xfs_parent.c | 22 ++++++++++++++++++++++
> fs/xfs/xfs_attr.h | 7 +++++++
> fs/xfs/xfs_inode.c | 10 +++++++++-
> fs/xfs/xfs_qm.c | 2 +-
> fs/xfs/xfs_qm.h | 1 +
> 6 files changed, 55 insertions(+), 2 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_attr.c b/fs/xfs/libxfs/xfs_attr.c
> index e7692ef..7547eb7 100644
> --- a/fs/xfs/libxfs/xfs_attr.c
> +++ b/fs/xfs/libxfs/xfs_attr.c
> @@ -42,6 +42,7 @@
> #include "xfs_quota.h"
> #include "xfs_trans_space.h"
> #include "xfs_trace.h"
> +#include "xfs_qm.h"
>
> /*
> * xfs_attr.c
> @@ -571,6 +572,20 @@ xfs_attr_set_deferred(
> return 0;
> }
>
> +int
> +xfs_attr_remove_parent(
> + struct xfs_trans *tp,
> + struct xfs_inode *dp,
> + struct xfs_parent_name_rec *rec,
> + int reclen,
> + struct xfs_defer_ops *dfops,
> + xfs_fsblock_t *firstblock)
> +{
> + int flags = ATTR_PARENT;
> +
> + return xfs_attr_remove_deferred(dp, dfops, (char *) rec, reclen, flags);
return xfs_attr_remove_deferred(dp, dfops, (char *) rec, reclen, ATTR_PARENT); ?
What do you think of changing these prototypes to take (void *) so you
don't have to cast so much? The name and value are (more or less) a
dumb array of bytes to the filesystem.
Also kinda wondering if the corresponding routines in xfs_parent.c could
just call the xfs_attr functions directly instead of jumping through
single line helpers...
> +}
> +
> /*
> * Generic handler routine to remove a name from an attribute list.
> * Transitions attribute list from Btree to shortform as necessary.
> diff --git a/fs/xfs/libxfs/xfs_parent.c b/fs/xfs/libxfs/xfs_parent.c
> index 0707336..ca695c4 100644
> --- a/fs/xfs/libxfs/xfs_parent.c
> +++ b/fs/xfs/libxfs/xfs_parent.c
> @@ -139,3 +139,25 @@ xfs_parent_add(
>
> return xfs_parent_add_nrec(tp, child, &nrec, dfops, firstblock);
> }
> +
> +/*
> + * Remove a parent record from a child inode.
> + */
> +int
> +xfs_parent_remove(
> + struct xfs_trans *tp,
> + struct xfs_inode *parent,
> + struct xfs_inode *child,
> + xfs_dir2_dataptr_t diroffset,
> + struct xfs_defer_ops *dfops,
> + xfs_fsblock_t *firstblock)
> +{
> + struct xfs_parent_name_rec rec;
> +
> + rec.p_ino = cpu_to_be64(parent->i_ino);
> + rec.p_gen = cpu_to_be32(VFS_I(parent)->i_generation);
> + rec.p_diroffset = cpu_to_be32(diroffset);
> +
> + return xfs_attr_remove_parent(tp, child, &rec, sizeof(rec),
> + dfops, firstblock);
> +}
> diff --git a/fs/xfs/xfs_attr.h b/fs/xfs/xfs_attr.h
> index acb6157..7a3bf8b 100644
> --- a/fs/xfs/xfs_attr.h
> +++ b/fs/xfs/xfs_attr.h
> @@ -207,4 +207,11 @@ int xfs_attr_set_parent(struct xfs_trans *tp, struct xfs_inode *ip,
> const char *value, int valuelen,
> struct xfs_defer_ops *dfops, xfs_fsblock_t *firstblock);
>
> +int xfs_parent_remove(struct xfs_trans *tp, struct xfs_inode *parent,
> + struct xfs_inode *child, xfs_dir2_dataptr_t diroffset,
> + struct xfs_defer_ops *dfops, xfs_fsblock_t *firstblock);
> +int xfs_attr_remove_parent(struct xfs_trans *tp, struct xfs_inode *ip,
> + struct xfs_parent_name_rec *rec, int reclen,
> + struct xfs_defer_ops *dfops, xfs_fsblock_t *firstblock);
> +
> #endif /* __XFS_ATTR_H__ */
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index 51b623b..a360c3d 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -2612,6 +2612,7 @@ xfs_remove(
> struct xfs_defer_ops dfops;
> xfs_fsblock_t first_block;
> uint resblks;
> + uint32_t dir_offset;
>
> trace_xfs_remove(dp, name);
>
> @@ -2692,12 +2693,19 @@ xfs_remove(
>
> xfs_defer_init(&dfops, &first_block);
> error = xfs_dir_removename(tp, dp, name, ip->i_ino, &first_block,
> - &dfops, resblks, NULL);
> + &dfops, resblks, &dir_offset);
> if (error) {
> ASSERT(error != -ENOENT);
> goto out_bmap_cancel;
> }
>
> + if (xfs_sb_version_hasparent(&mp->m_sb)) {
> + error = xfs_parent_remove(tp, dp, ip, dir_offset, &dfops,
> + &first_block);
> + if (error)
> + goto out_bmap_cancel;
> + }
> +
> /*
> * If this is a synchronous mount, make sure that the
> * remove transaction goes to disk before returning to
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index 010a13a..a047f0f 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -307,7 +307,7 @@ xfs_qm_dqattach_one(
> return 0;
> }
>
> -static bool
> +bool
> xfs_qm_need_dqattach(
> struct xfs_inode *ip)
> {
> diff --git a/fs/xfs/xfs_qm.h b/fs/xfs/xfs_qm.h
> index 2975a82..9976369 100644
> --- a/fs/xfs/xfs_qm.h
> +++ b/fs/xfs/xfs_qm.h
> @@ -176,6 +176,7 @@ extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint,
> struct qc_dqblk *);
> extern int xfs_qm_scall_quotaon(struct xfs_mount *, uint);
> extern int xfs_qm_scall_quotaoff(struct xfs_mount *, uint);
> +extern bool xfs_qm_need_dqattach(struct xfs_inode *ip);
Huh?
--D
>
> static inline struct xfs_def_quota *
> xfs_get_defquota(struct xfs_dquot *dqp, struct xfs_quotainfo *qi)
> --
> 2.7.4
>
> --
> 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:[~2017-10-19 19:43 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-18 22:55 [PATCH 00/17] Parent Pointers V3 Allison Henderson
2017-10-18 22:55 ` [PATCH 01/17] Add helper functions xfs_attr_set_args and xfs_attr_remove_args Allison Henderson
2017-10-19 20:03 ` Darrick J. Wong
2017-10-21 1:14 ` Allison Henderson
2017-10-18 22:55 ` [PATCH 02/17] Set up infastructure for deferred attribute operations Allison Henderson
2017-10-19 19:02 ` Darrick J. Wong
2017-10-21 1:08 ` Allison Henderson
2017-10-18 22:55 ` [PATCH 03/17] Add xfs_attr_set_defered and xfs_attr_remove_defered Allison Henderson
2017-10-19 19:13 ` Darrick J. Wong
2017-10-21 1:08 ` Allison Henderson
2017-10-18 22:55 ` [PATCH 04/17] Remove all strlen calls in all xfs_attr_* functions for attr names Allison Henderson
2017-10-19 19:15 ` Darrick J. Wong
2017-10-21 1:10 ` Allison Henderson
2017-10-18 22:55 ` [PATCH 05/17] xfs: get directory offset when adding directory name Allison Henderson
2017-10-18 22:55 ` [PATCH 06/17] xfs: get directory offset when removing " Allison Henderson
2017-10-19 19:17 ` Darrick J. Wong
2017-10-21 1:11 ` Allison Henderson
2017-10-18 22:55 ` [PATCH 07/17] xfs: get directory offset when replacing a " Allison Henderson
2017-10-18 22:55 ` [PATCH 08/17] xfs: add parent pointer support to attribute code Allison Henderson
2017-10-18 22:55 ` [PATCH 09/17] xfs: define parent pointer xattr format Allison Henderson
2017-10-18 22:55 ` [PATCH 10/17] :xfs: extent transaction reservations for parent attributes Allison Henderson
2017-10-19 18:24 ` Darrick J. Wong
[not found] ` <8680e0c1-ada8-06e3-e397-61a5076030be@oracle.com>
2017-10-20 23:45 ` Darrick J. Wong
2017-10-21 0:12 ` Allison Henderson
2017-10-21 1:07 ` Allison Henderson
2017-10-18 22:55 ` [PATCH 11/17] Add the extra space requirements for parent pointer attributes when calculating the minimum log size during mkfs Allison Henderson
2017-10-19 18:13 ` Darrick J. Wong
2017-10-21 1:07 ` Allison Henderson
2017-10-18 22:55 ` [PATCH 12/17] xfs: parent pointer attribute creation Allison Henderson
2017-10-19 19:36 ` Darrick J. Wong
[not found] ` <9185d3e8-4b41-b2d8-294b-934f7d3409f0@oracle.com>
2017-10-21 0:03 ` Darrick J. Wong
2017-10-21 1:11 ` Allison Henderson
2017-10-18 22:55 ` [PATCH 13/17] xfs: add parent attributes to link Allison Henderson
2017-10-19 19:40 ` Darrick J. Wong
2017-10-21 1:12 ` Allison Henderson
2017-10-18 22:55 ` [PATCH 14/17] xfs: remove parent pointers in unlink Allison Henderson
2017-10-19 19:43 ` Darrick J. Wong [this message]
2017-10-21 1:12 ` Allison Henderson
2017-10-18 22:55 ` [PATCH 15/17] xfs_bmap_add_attrfork(): re-add error handling from set_attrforkoff() call Allison Henderson
2017-10-19 19:43 ` Darrick J. Wong
2017-10-21 1:13 ` Allison Henderson
2017-10-18 22:55 ` [PATCH 16/17] Add parent pointers to rename Allison Henderson
2017-10-18 22:55 ` [PATCH 17/17] Add the parent pointer support to the superblock version 5 Allison Henderson
2017-10-19 3:57 ` Amir Goldstein
2017-10-19 20:06 ` Darrick J. Wong
2017-10-20 3:18 ` Amir Goldstein
2017-10-19 19:45 ` Darrick J. Wong
2017-10-21 1:13 ` Allison Henderson
2017-10-19 4:11 ` [PATCH 00/17] Parent Pointers V3 Amir Goldstein
2017-10-20 3:22 ` Amir Goldstein
2017-10-21 1:06 ` Allison Henderson
2017-10-20 22:41 ` Dave Chinner
2017-10-21 7:34 ` Amir Goldstein
2017-10-22 23:27 ` Dave Chinner
2017-10-23 4:30 ` Amir Goldstein
2017-10-23 5:32 ` Dave Chinner
2017-10-23 6:48 ` Amir Goldstein
2017-10-23 8:40 ` Dave Chinner
2017-10-23 9:06 ` Amir Goldstein
2017-10-23 17:14 ` Darrick J. Wong
2017-10-23 19:20 ` Amir Goldstein
-- strict thread matches above, loose matches on Subject: below --
2017-10-06 22:05 [PATCH 00/17] Parent Pointers V2 Allison Henderson
2017-10-06 22:05 ` [PATCH 14/17] xfs: remove parent pointers in unlink Allison Henderson
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=20171019194310.GI4755@magnolia \
--to=darrick.wong@oracle.com \
--cc=allison.henderson@oracle.com \
--cc=dchinner@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox