From: Allison Henderson <allison.henderson@oracle.com>
To: linux-xfs@vger.kernel.org
Cc: Allison Henderson <allison.henderson@oracle.com>
Subject: [PATCH 16/17] Add parent pointers to rename
Date: Fri, 6 Oct 2017 15:05:47 -0700 [thread overview]
Message-ID: <1507327548-3221-17-git-send-email-allison.henderson@oracle.com> (raw)
In-Reply-To: <1507327548-3221-1-git-send-email-allison.henderson@oracle.com>
Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
---
:100644 100644 486f808... 35667fd... M fs/xfs/libxfs/xfs_dir2.c
:100644 100644 7718481... fe0cb9f... M fs/xfs/xfs_inode.c
fs/xfs/libxfs/xfs_dir2.c | 6 ++++--
fs/xfs/xfs_inode.c | 26 ++++++++++++++++++++------
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_dir2.c b/fs/xfs/libxfs/xfs_dir2.c
index 486f808..35667fd 100644
--- a/fs/xfs/libxfs/xfs_dir2.c
+++ b/fs/xfs/libxfs/xfs_dir2.c
@@ -324,10 +324,11 @@ xfs_dir_createname(
else
rval = xfs_dir2_node_addname(args);
+out_free:
/* return the location that this entry was place in the parent inode */
if (offset)
*offset = args->offset;
-out_free:
+
kmem_free(args);
return rval;
}
@@ -496,9 +497,10 @@ xfs_dir_removename(
rval = xfs_dir2_leaf_removename(args);
else
rval = xfs_dir2_node_removename(args);
+out_free:
if (offset)
*offset = args->offset;
-out_free:
+
kmem_free(args);
return rval;
}
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 7718481..fe0cb9f 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2989,6 +2989,8 @@ xfs_rename(
bool src_is_directory = S_ISDIR(VFS_I(src_ip)->i_mode);
int spaceres;
int error;
+ xfs_dir2_dataptr_t new_diroffset;
+ xfs_dir2_dataptr_t old_diroffset;
trace_xfs_rename(src_dp, target_dp, src_name, target_name);
@@ -3091,13 +3093,12 @@ xfs_rename(
*/
error = xfs_dir_createname(tp, target_dp, target_name,
src_ip->i_ino, &first_block, &dfops,
- spaceres, NULL);
+ spaceres, &new_diroffset);
if (error)
goto out_bmap_cancel;
xfs_trans_ichgtime(tp, target_dp,
XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
-
if (new_parent && src_is_directory) {
error = xfs_bumplink(tp, target_dp);
if (error)
@@ -3131,7 +3132,7 @@ xfs_rename(
*/
error = xfs_dir_replace(tp, target_dp, target_name,
src_ip->i_ino, &first_block, &dfops,
- spaceres, NULL);
+ spaceres, &new_diroffset);
if (error)
goto out_bmap_cancel;
@@ -3166,7 +3167,7 @@ xfs_rename(
*/
error = xfs_dir_replace(tp, src_ip, &xfs_name_dotdot,
target_dp->i_ino, &first_block, &dfops,
- spaceres, NULL);
+ spaceres, &new_diroffset);
ASSERT(error != -EEXIST);
if (error)
goto out_bmap_cancel;
@@ -3205,11 +3206,12 @@ xfs_rename(
*/
if (wip) {
error = xfs_dir_replace(tp, src_dp, src_name, wip->i_ino,
- &first_block, &dfops, spaceres, NULL);
+ &first_block, &dfops, spaceres,
+ &old_diroffset);
} else
error = xfs_dir_removename(tp, src_dp, src_name, src_ip->i_ino,
&first_block, &dfops, spaceres,
- NULL);
+ &old_diroffset);
if (error)
goto out_bmap_cancel;
@@ -3239,6 +3241,18 @@ xfs_rename(
VFS_I(wip)->i_state &= ~I_LINKABLE;
}
+ if (new_parent && xfs_sb_version_hasparent(&mp->m_sb)) {
+ error = xfs_parent_add(tp, target_dp, src_ip, target_name,
+ new_diroffset, &dfops, &first_block);
+ if (error)
+ goto out_bmap_cancel;
+
+ error = xfs_parent_remove(tp, src_dp, src_ip,
+ old_diroffset, &dfops, &first_block);
+ if (error)
+ goto out_bmap_cancel;
+ }
+
xfs_trans_ichgtime(tp, src_dp, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG);
xfs_trans_log_inode(tp, src_dp, XFS_ILOG_CORE);
if (new_parent)
--
2.7.4
next prev parent reply other threads:[~2017-10-06 22:08 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-06 22:05 [PATCH 00/17] Parent Pointers V2 Allison Henderson
2017-10-06 22:05 ` [PATCH 01/17] Add helper functions xfs_attr_set_args and xfs_attr_remove_args Allison Henderson
2017-10-06 22:05 ` [PATCH 02/17] Set up infastructure for deferred attribute operations Allison Henderson
2017-10-09 4:20 ` Dave Chinner
2017-10-09 21:25 ` Allison Henderson
2017-10-09 22:51 ` Allison Henderson
2017-10-09 23:27 ` Dave Chinner
2017-10-06 22:05 ` [PATCH 03/17] Add xfs_attr_set_defered and xfs_attr_remove_defered Allison Henderson
2017-10-12 4:38 ` Darrick J. Wong
2017-10-06 22:05 ` [PATCH 04/17] Remove all strlen calls in all xfs_attr_* functions for attr names Allison Henderson
2017-10-06 22:05 ` [PATCH 05/17] xfs: get directory offset when adding directory name Allison Henderson
2017-10-06 22:05 ` [PATCH 06/17] xfs: get directory offset when removing " Allison Henderson
2017-10-06 22:05 ` [PATCH 07/17] xfs: get directory offset when replacing a " Allison Henderson
2017-10-06 22:05 ` [PATCH 08/17] xfs: add parent pointer support to attribute code Allison Henderson
2017-10-06 22:05 ` [PATCH 09/17] xfs: define parent pointer xattr format Allison Henderson
2017-10-06 22:05 ` [PATCH 10/17] :xfs: extent transaction reservations for parent attributes Allison Henderson
2017-10-06 22:05 ` [PATCH 11/17] Add the extra space requirements for parent pointer attributes when calculating the minimum log size during mkfs Allison Henderson
2017-10-06 22:05 ` [PATCH 12/17] xfs: parent pointer attribute creation Allison Henderson
2017-10-06 22:05 ` [PATCH 13/17] xfs: add parent attributes to link Allison Henderson
2017-10-06 22:05 ` [PATCH 14/17] xfs: remove parent pointers in unlink Allison Henderson
2017-10-06 22:05 ` [PATCH 15/17] xfs_bmap_add_attrfork(): re-add error handling from set_attrforkoff() call Allison Henderson
2017-10-06 22:05 ` Allison Henderson [this message]
2017-10-06 22:05 ` [PATCH 17/17] Add the parent pointer support to the superblock version 5 Allison Henderson
-- strict thread matches above, loose matches on Subject: below --
2017-10-18 22:55 [PATCH 00/17] Parent Pointers V3 Allison Henderson
2017-10-18 22:55 ` [PATCH 16/17] Add parent pointers to rename 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=1507327548-3221-17-git-send-email-allison.henderson@oracle.com \
--to=allison.henderson@oracle.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).