Revert "yaffs: Better control over rename shadowing"
author黄涛 <huangtao@rock-chips.com>
Sat, 30 Jul 2011 14:45:04 +0000 (22:45 +0800)
committer黄涛 <huangtao@rock-chips.com>
Sat, 30 Jul 2011 14:45:04 +0000 (22:45 +0800)
This reverts commit 703932d07237252c0aca76ab693463664f0a71a3.

fs/yaffs2/yaffs_guts.c
fs/yaffs2/yaffs_guts.h

index 968223eb3e31c6aa4f0851bd0d8b3db3010e6359..a565b08e6116108d401263d6ec5421d70c85ab48 100644 (file)
@@ -2465,8 +2465,6 @@ int yaffs_RenameObject(yaffs_Object *oldDir, const YCHAR *oldName,
        yaffs_Object *obj = NULL;
        yaffs_Object *existingTarget = NULL;
        int force = 0;
-       int result;
-       yaffs_Device *dev;
 
 
        if (!oldDir || oldDir->variantType != YAFFS_OBJECT_TYPE_DIRECTORY)
@@ -2474,8 +2472,6 @@ int yaffs_RenameObject(yaffs_Object *oldDir, const YCHAR *oldName,
        if (!newDir || newDir->variantType != YAFFS_OBJECT_TYPE_DIRECTORY)
                YBUG();
 
-       dev = oldDir->myDev;
-
 #ifdef CONFIG_YAFFS_CASE_INSENSITIVE
        /* Special case for case insemsitive systems (eg. WinCE).
         * While look-up is case insensitive, the name isn't.
@@ -2485,7 +2481,7 @@ int yaffs_RenameObject(yaffs_Object *oldDir, const YCHAR *oldName,
                force = 1;
 #endif
 
-       if(yaffs_strlen(newName) > YAFFS_MAX_NAME_LENGTH)
+       else if (yaffs_strlen(newName) > YAFFS_MAX_NAME_LENGTH)
                /* ENAMETOOLONG */
                return YAFFS_FAIL;
 
@@ -2503,26 +2499,17 @@ int yaffs_RenameObject(yaffs_Object *oldDir, const YCHAR *oldName,
                        return YAFFS_FAIL;      /* EEXIST or ENOTEMPTY */
                } else if (existingTarget && existingTarget != obj) {
                        /* Nuke the target first, using shadowing,
-                        * but only if it isn't the same object.
-                        *
-                        * Note we must disable gc otherwise it can mess up the shadowing.
-                        *
+                        * but only if it isn't the same object
                         */
-                       dev->isDoingGC=1;
                        yaffs_ChangeObjectName(obj, newDir, newName, force,
                                                existingTarget->objectId);
-                       existingTarget->isShadowed = 1;
                        yaffs_UnlinkObject(existingTarget);
-                       dev->isDoingGC=0;
                }
-
-               result = yaffs_ChangeObjectName(obj, newDir, newName, 1, 0);
-
                yaffs_UpdateParent(oldDir);
                if(newDir != oldDir)
                        yaffs_UpdateParent(newDir);
 
-               return result;
+               return yaffs_ChangeObjectName(obj, newDir, newName, 1, 0);
        }
        return YAFFS_FAIL;
 }
@@ -3121,7 +3108,6 @@ static int yaffs_GarbageCollectBlock(yaffs_Device *dev, int block,
                                        if (tags.chunkId == 0) {
                                                /* It is an object Id,
                                                 * We need to nuke the shrinkheader flags first
-                                                * Also need to clean up shadowing.
                                                 * We no longer want the shrinkHeader flag since its work is done
                                                 * and if it is left in place it will mess up scanning.
                                                 */
@@ -3130,9 +3116,6 @@ static int yaffs_GarbageCollectBlock(yaffs_Device *dev, int block,
                                                oh = (yaffs_ObjectHeader *)buffer;
                                                oh->isShrink = 0;
                                                tags.extraIsShrinkHeader = 0;
-                                               oh->shadowsObject = 0;
-                                               oh->inbandShadowsObject = 0;
-                                               tags.extraShadows = 0;
 
                                                yaffs_VerifyObjectHeader(object, oh, &tags, 1);
                                        }
@@ -5047,13 +5030,11 @@ int yaffs_ResizeFile(yaffs_Object *in, loff_t newSize)
        }
 
 
-       /* Write a new object header to reflect the resize.
+       /* Write a new object header.
         * show we've shrunk the file, if need be
-        * Do this only if the file is not in the deleted directories
-        * and is not shadowed.
+        * Do this only if the file is not in the deleted directories.
         */
        if (in->parent &&
-           !in->isShadowed &&
            in->parent->objectId != YAFFS_OBJECTID_UNLINKED &&
            in->parent->objectId != YAFFS_OBJECTID_DELETED)
                yaffs_UpdateObjectHeader(in, NULL, 0,
@@ -5364,8 +5345,7 @@ static void yaffs_HandleShadowedObject(yaffs_Device *dev, int objId,
                /* Handle YAFFS2 case (backward scanning)
                 * If the shadowed object exists then ignore.
                 */
-               obj = yaffs_FindObjectByNumber(dev, objId);
-               if(obj)
+               if (yaffs_FindObjectByNumber(dev, objId))
                        return;
        }
 
@@ -5377,7 +5357,6 @@ static void yaffs_HandleShadowedObject(yaffs_Device *dev, int objId,
                                             YAFFS_OBJECT_TYPE_FILE);
        if (!obj)
                return;
-       obj->isShadowed = 1;
        yaffs_AddObjectToDirectory(dev->unlinkedDir, obj);
        obj->variant.fileVariant.shrinkSize = 0;
        obj->valid = 1;         /* So that we don't read any other info for this file */
index 1305909ecc03a38b1689da60ea840345873dbd17..c47a319445ceb8ef49b2efd5dbbce81ba8696066 100644 (file)
@@ -424,7 +424,6 @@ struct yaffs_ObjectStruct {
                                 * until the inode is released.
                                 */
        __u8 beingCreated:1;    /* This object is still being created so skip some checks. */
-       __u8 isShadowed:1;      /* This object is shadowed on the way to being renamed. */
 
        __u8 serial;            /* serial number of chunk in NAND. Cached here */
        __u16 sum;              /* sum of the name to speed searching */