From: 黄涛 Date: Sat, 30 Jul 2011 14:45:04 +0000 (+0800) Subject: Revert "yaffs: Better control over rename shadowing" X-Git-Tag: firefly_0821_release~9938 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=60efa09fa235da413ef5e727bbafc597faf3aa84;p=firefly-linux-kernel-4.4.55.git Revert "yaffs: Better control over rename shadowing" This reverts commit 703932d07237252c0aca76ab693463664f0a71a3. --- diff --git a/fs/yaffs2/yaffs_guts.c b/fs/yaffs2/yaffs_guts.c index 968223eb3e31..a565b08e6116 100644 --- a/fs/yaffs2/yaffs_guts.c +++ b/fs/yaffs2/yaffs_guts.c @@ -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 */ diff --git a/fs/yaffs2/yaffs_guts.h b/fs/yaffs2/yaffs_guts.h index 1305909ecc03..c47a319445ce 100644 --- a/fs/yaffs2/yaffs_guts.h +++ b/fs/yaffs2/yaffs_guts.h @@ -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 */