From: Eric Sandeen <sandeen@sandeen.net>
To: Dave Chinner <david@fromorbit.com>, xfs@oss.sgi.com
Subject: Re: [PATCH 3/5] xfs: factor out xfs_rename_finish()
Date: Tue, 24 Mar 2015 16:04:38 -0500 [thread overview]
Message-ID: <5511D166.7050201@sandeen.net> (raw)
In-Reply-To: <1427194771-3105-4-git-send-email-david@fromorbit.com>
On 3/24/15 5:59 AM, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> Rather than use a jump label for the final transaction commit in
> the rename, factor it into a simple helper function and call it
> appropriately. This slightly reduces the spaghetti nature of
> xfs_rename.
Nit, subject should be "xfs_finish_rename" not "xfs_rename_finish"
-Eric
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
> fs/xfs/xfs_inode.c | 48 +++++++++++++++++++++++++++---------------------
> 1 file changed, 27 insertions(+), 21 deletions(-)
>
> diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
> index 981e036..4a13a48 100644
> --- a/fs/xfs/xfs_inode.c
> +++ b/fs/xfs/xfs_inode.c
> @@ -2716,6 +2716,31 @@ xfs_sort_for_rename(
> }
> }
>
> +static int
> +xfs_finish_rename(
> + struct xfs_trans *tp,
> + struct xfs_bmap_free *free_list)
> +{
> + int committed = 0;
> + int error;
> +
> + /*
> + * If this is a synchronous mount, make sure that the rename transaction
> + * goes to disk before returning to the user.
> + */
> + if (tp->t_mountp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC))
> + xfs_trans_set_sync(tp);
> +
> + error = xfs_bmap_finish(&tp, free_list, &committed);
> + if (error) {
> + xfs_bmap_cancel(free_list);
> + xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES|XFS_TRANS_ABORT);
> + return error;
> + }
> +
> + return xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
> +}
> +
> /*
> * xfs_cross_rename()
> *
> @@ -2855,7 +2880,6 @@ xfs_rename(
> xfs_bmap_free_t free_list;
> xfs_fsblock_t first_block;
> int cancel_flags = 0;
> - int committed;
> xfs_inode_t *inodes[__XFS_SORT_INODES];
> int num_inodes = __XFS_SORT_INODES;
> int spaceres;
> @@ -2932,7 +2956,7 @@ xfs_rename(
> &free_list, &first_block, spaceres);
> if (error)
> goto out_trans_abort;
> - goto finish_rename;
> + return xfs_finish_rename(tp, &free_list);
> }
>
> /*
> @@ -3074,25 +3098,7 @@ xfs_rename(
> if (new_parent)
> xfs_trans_log_inode(tp, target_dp, XFS_ILOG_CORE);
>
> -finish_rename:
> - /*
> - * If this is a synchronous mount, make sure that the
> - * rename transaction goes to disk before returning to
> - * the user.
> - */
> - if (mp->m_flags & (XFS_MOUNT_WSYNC|XFS_MOUNT_DIRSYNC)) {
> - xfs_trans_set_sync(tp);
> - }
> -
> - error = xfs_bmap_finish(&tp, &free_list, &committed);
> - if (error)
> - goto out_trans_abort;
> -
> - /*
> - * trans_commit will unlock src_ip, target_ip & decrement
> - * the vnode references.
> - */
> - return xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
> + return xfs_finish_rename(tp, &free_list);
>
> out_trans_abort:
> cancel_flags |= XFS_TRANS_ABORT;
>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-03-24 21:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-24 10:59 [PATCH 0/5 V2] xfs: RENAME_WHITEOUT support Dave Chinner
2015-03-24 10:59 ` [PATCH 1/5] xfs: clean up inode locking for RENAME_WHITEOUT Dave Chinner
2015-03-24 21:11 ` Eric Sandeen
2015-03-24 21:26 ` Dave Chinner
2015-03-24 10:59 ` [PATCH 2/5] xfs: cleanup xfs_rename error handling Dave Chinner
2015-03-24 10:59 ` [PATCH 3/5] xfs: factor out xfs_rename_finish() Dave Chinner
2015-03-24 21:04 ` Eric Sandeen [this message]
2015-03-24 21:27 ` Dave Chinner
2015-03-24 10:59 ` [PATCH 4/5] xfs: make xfs_cross_rename() complete fully Dave Chinner
2015-03-24 10:59 ` [PATCH 5/5] xfs: add RENAME_WHITEOUT support Dave Chinner
2015-03-24 19:41 ` [PATCH 0/5 V2] xfs: " Brian Foster
2015-03-24 21:12 ` Eric Sandeen
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=5511D166.7050201@sandeen.net \
--to=sandeen@sandeen.net \
--cc=david@fromorbit.com \
--cc=xfs@oss.sgi.com \
/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