]> git.neil.brown.name Git - LaFS.git/commitdiff
roll: change handling of distinction between rename to existing and non-existing...
authorNeilBrown <neilb@suse.de>
Fri, 4 Mar 2011 01:47:29 +0000 (12:47 +1100)
committerNeilBrown <neilb@suse.de>
Fri, 4 Mar 2011 01:47:29 +0000 (12:47 +1100)
Having DIROP_REN_TARGET_OLD and DIROP_REN_TARGET_NEW is not needed as
the miniblock also holds the inode number from the target which can be
zero or non-zero.
So remove that distinction and just use the inode number.

Signed-off-by: NeilBrown <neilb@suse.de>
dir.c
layout.h
roll.c

diff --git a/dir.c b/dir.c
index 713ccb21932bc0254f7bdf61da0bf5a0dbb803e3..ae1d083a906a1d78d9fe7f4193428db51d3bb34f 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -605,8 +605,7 @@ static void dir_log_commit(struct update_handle *uh,
                han = hancnt;
                *handle = han;
                break;
-       case DIROP_REN_NEW_TARGET:
-       case DIROP_REN_OLD_TARGET:
+       case DIROP_REN_TARGET:
                han = *handle;
                break;
        default:
@@ -1235,8 +1234,8 @@ retry:
        dir_log_commit(&old_uh, fs, old_dir, &old_dentry->d_name,
                       old_inode->i_ino, DIROP_REN_SOURCE, &renhandle);
        dir_log_commit(&new_uh, fs, new_dir, &new_dentry->d_name,
-                      0,
-                      new_inode ? DIROP_REN_OLD_TARGET : DIROP_REN_NEW_TARGET,
+                      new_inode ? new_inode->i_ino : 0,
+                      DIROP_REN_TARGET,
                       &renhandle);
        if (S_ISDIR(old_inode->i_mode)) {
                inode_dec_link_count(old_dir);
index 5c6ba0eb7e8d94a465cb6981e67f067d685005d8..fed1473127e572ff9644ebb40e544926298a6782 100644 (file)
--- a/layout.h
+++ b/layout.h
@@ -252,8 +252,7 @@ struct dirheader {
 #define DIROP_LINK             0
 #define        DIROP_UNLINK            1
 #define        DIROP_REN_SOURCE        2
-#define        DIROP_REN_NEW_TARGET    3
-#define        DIROP_REN_OLD_TARGET    4
+#define        DIROP_REN_TARGET        3
 
 /*
  * The orphan file has a very simple structure with
diff --git a/roll.c b/roll.c
index e558552296872a8b7fe1097ce85804380ce7f2ef..d4207984b3984507988c3b38b0ba37f8e38fd091 100644 (file)
--- a/roll.c
+++ b/roll.c
@@ -249,12 +249,24 @@ roll_mini(struct fs *fs, int fsnum, int inum, int trunc,
         * different objects.
         *
         * inode-files: meta-data updates, including size, are allowed.
-        *     index update and data update are not (data update must
+        *      index update and data update are not (data update must
         *      go through the file).  Implied creation requires
         *      orphan handling
-        * regular-files: just over-write data, possibly extending size
+        * regular-files: could just over-write data, possibly extending size
+        *      but there doesn't seem to be any reason to create such updates
+        *      so we don't bother to try handling them.
         * symlink,dev,pipe: as with reg-files
-        * directory: add/remove entries.
+        * directory: add/remove entries.  Each miniblock has an address and
+        *      identifies a name, an inode number, and one of:
+        *        LINK  - create a link with this name to the inode
+        *        UNLINK - remove the link
+        *        REN_SOURCE - record this info against the 'address' which must
+        *            be unique in this checkpoint across all directories
+        *        REN_TARGET - The source with matching 'address' is being
+        *            renamed to here.  So unlink the source and either create the
+        *            target (if inode is zero) or replace the target.  This
+        *            miniblock could be in a different directory to the matching
+        *            REN_SOURCE.
         */
 
        inode = lafs_iget_fs(fs, fsnum, inum, SYNC);