do_radix_tree() function in filesys.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I notice that there is a function to look at radix trees in filesys.c, but it's not called by anything in the crash executable from what I can see. In fact when I wrote a small extension to call it, I see that it simply doesn't work for several reasons (wrong structures, incorrect dereferencing of pointers). Attached is a patch which addresses these. I've tested it on i686, x86_64 and ia64.

If you think that this type of ("utility") code is best left out of crash, then let's just remove this from the source and not clutter it with dead code. Personally, I think it's nice to have it there... when it works.

Regards,

Alan Tyson, HP.
--- a/filesys.c	2008-01-11 19:35:32.000000000 +0000
+++ b/filesys.c	2008-01-21 16:21:20.000000000 +0000
@@ -3484,10 +3484,14 @@ cleanup_memory_driver(void)
 #define RADIX_TREE_MAP_SHIFT  6
 #define RADIX_TREE_MAP_SIZE  (1UL << RADIX_TREE_MAP_SHIFT)
 #define RADIX_TREE_MAP_MASK  (RADIX_TREE_MAP_SIZE-1)
+#define RADIX_TREE_TAGS         2
+#define RADIX_TREE_TAG_LONGS    \
+	((RADIX_TREE_MAP_SIZE + BITS_PER_LONG - 1) / BITS_PER_LONG)
 
 struct radix_tree_node {
         unsigned int    count;
         void            *slots[RADIX_TREE_MAP_SIZE];
+	unsigned long	tags[RADIX_TREE_TAGS][RADIX_TREE_TAG_LONGS];
 };
 
 /*
@@ -3639,16 +3643,15 @@ static void *
 radix_tree_lookup(ulong root_rnode, ulong index, int height)
 {
 	unsigned int shift;
-	struct radix_tree_node **slot;
+	void *slot;
 	struct radix_tree_node slotbuf;
-	void **kslotp, **uslotp;
 
 	shift = (height-1) * RADIX_TREE_MAP_SHIFT;
-	kslotp = (void **)root_rnode;
+
+	readmem(root_rnode, KVADDR, &slot, sizeof(void *),
+		"radix_tree_root rnode", FAULT_ON_ERROR);
 
 	while (height > 0) {
-		readmem((ulong)kslotp, KVADDR, &slot, sizeof(void *),
-			"radix_tree_node slot", FAULT_ON_ERROR);
 
 		if (slot == NULL)
 			return NULL;
@@ -3657,15 +3660,13 @@ radix_tree_lookup(ulong root_rnode, ulon
 			sizeof(struct radix_tree_node),
 			"radix_tree_node struct", FAULT_ON_ERROR);
 
-		uslotp = (void **)
-		    (slotbuf.slots + ((index >> shift) & RADIX_TREE_MAP_MASK));
-		kslotp = *uslotp;
-
+		slot = slotbuf.slots[((index >> shift) & RADIX_TREE_MAP_MASK)];
+		
 		shift -= RADIX_TREE_MAP_SHIFT;
 		height--;
 	}
 
-	return (void *) kslotp;
+	return slot;
 }
 
 int
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux