[Ocfs2-tools-devel] [PATCH]libocfs2: Modify ocfs2_delete_inode to delete system inodes.

tao.ma tao.ma at oracle.com
Sun May 27 22:44:05 PDT 2007


Current ocfs2_delete_inode fails to delete the system inode because of 
some bugs. So fix it.
-------------- next part --------------
Index: libocfs2/alloc.c
===================================================================
--- libocfs2/alloc.c	(revision 1355)
+++ libocfs2/alloc.c	(working copy)
@@ -279,7 +279,7 @@ errcode_t ocfs2_delete_inode(ocfs2_files
 	errcode_t ret;
 	char *buf;
 	struct ocfs2_dinode *di;
-	int slot;
+	int16_t slot;
 	ocfs2_cached_inode **inode_alloc;
 
 	ret = ocfs2_malloc_block(fs->fs_io, &buf);
@@ -292,13 +292,17 @@ errcode_t ocfs2_delete_inode(ocfs2_files
 	di = (struct ocfs2_dinode *)buf;
 	slot = di->i_suballoc_slot;
 
-	if (slot == OCFS2_INVALID_SLOT)
+	if (slot == OCFS2_INVALID_SLOT) {
 		inode_alloc = &fs->fs_system_inode_alloc;
-	else
+		ret = ocfs2_load_allocator(fs, GLOBAL_INODE_ALLOC_SYSTEM_INODE,
+					   0, inode_alloc);
+	}
+	else {
 		inode_alloc = &fs->fs_inode_allocs[slot];
+		ret = ocfs2_load_allocator(fs, INODE_ALLOC_SYSTEM_INODE, slot,
+					   inode_alloc);
+	}
 
-	ret = ocfs2_load_allocator(fs, INODE_ALLOC_SYSTEM_INODE, slot,
-				   inode_alloc);
 	if (ret)
 		goto out;
 


More information about the Ocfs2-tools-devel mailing list