From: Allison Henderson <allison.henderson@oracle.com>
To: linux-xfs@vger.kernel.org
Cc: Allison Henderson <allison.henderson@oracle.com>
Subject: [RFC PATCH 12/13] Add parent pointers to rename
Date: Wed, 9 Aug 2017 18:41:32 -0700 [thread overview]
Message-ID: <1502329293-4091-13-git-send-email-allison.henderson@oracle.com> (raw)
In-Reply-To: <1502329293-4091-1-git-send-email-allison.henderson@oracle.com>
Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
---
:100644 100644 f5d0d3d... bd99ae2... M fs/xfs/libxfs/xfs_dir2.c
:100644 100644 0654ad8b.. 2bdade2... 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 f5d0d3d..bd99ae2 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 0654ad8b..2bdade2 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2971,6 +2971,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);
@@ -3073,13 +3075,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)
@@ -3113,7 +3114,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;
@@ -3148,7 +3149,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;
@@ -3187,11 +3188,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;
@@ -3221,6 +3223,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-08-10 1:43 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-10 1:41 [RFC PATCH 00/13] Add parent pointer attributes Allison Henderson
2017-08-10 1:41 ` [RFC PATCH 01/13] xfs: get directory offset when adding directory name Allison Henderson
2017-08-10 1:41 ` [RFC PATCH 02/13] xfs: get directory offset when removing " Allison Henderson
2017-08-14 23:56 ` Darrick J. Wong
2017-08-15 3:23 ` Dave Chinner
2017-08-15 5:47 ` Dave Chinner
2017-08-15 3:54 ` Allison Henderson
2017-08-10 1:41 ` [RFC PATCH 03/13] xfs: get directory offset when replacing a " Allison Henderson
2017-08-10 1:41 ` [RFC PATCH 04/13] xfs: add parent pointer support to attribute code Allison Henderson
2017-08-10 1:41 ` [RFC PATCH 05/13] xfs: define parent pointer xattr format Allison Henderson
2017-08-14 23:59 ` Darrick J. Wong
2017-08-15 4:05 ` Allison Henderson
2017-08-10 1:41 ` [RFC PATCH 06/13] :xfs: extent transaction reservations for parent attributes Allison Henderson
2017-08-10 1:41 ` [RFC PATCH 07/13] Add the extra space requirements for parent pointer attributes when calculating the minimum log size during mkfs Allison Henderson
2017-08-10 1:41 ` [RFC PATCH 08/13] xfs: parent pointer attribute creation Allison Henderson
2017-08-15 0:06 ` Darrick J. Wong
2017-08-15 3:32 ` Dave Chinner
2017-08-15 4:09 ` Allison Henderson
2017-08-10 1:41 ` [RFC PATCH 09/13] xfs: add parent attributes to link Allison Henderson
2017-08-10 1:41 ` [RFC PATCH 10/13] xfs: remove parent pointers in unlink Allison Henderson
2017-08-10 1:41 ` [RFC PATCH 11/13] xfs_bmap_add_attrfork(): re-add error handling from set_attrforkoff() call Allison Henderson
2017-08-10 1:41 ` Allison Henderson [this message]
2017-08-10 1:41 ` [RFC PATCH 13/13] Add the parent pointer support to the superblock version 5 Allison Henderson
2017-08-15 0:07 ` Darrick J. Wong
2017-08-15 4:11 ` 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=1502329293-4091-13-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 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.