Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
[linux-2.6-microblaze.git] / fs / ext4 / namei.c
index 877c602..686bf98 100644 (file)
@@ -731,6 +731,29 @@ struct stats dx_show_entries(struct dx_hash_info *hinfo, struct inode *dir,
                       (space/bcount)*100/blocksize);
        return (struct stats) { names, space, bcount};
 }
+
+/*
+ * Linear search cross check
+ */
+static inline void htree_rep_invariant_check(struct dx_entry *at,
+                                            struct dx_entry *target,
+                                            u32 hash, unsigned int n)
+{
+       while (n--) {
+               dxtrace(printk(KERN_CONT ","));
+               if (dx_get_hash(++at) > hash) {
+                       at--;
+                       break;
+               }
+       }
+       ASSERT(at == target - 1);
+}
+#else /* DX_DEBUG */
+static inline void htree_rep_invariant_check(struct dx_entry *at,
+                                            struct dx_entry *target,
+                                            u32 hash, unsigned int n)
+{
+}
 #endif /* DX_DEBUG */
 
 /*
@@ -827,20 +850,7 @@ dx_probe(struct ext4_filename *fname, struct inode *dir,
                                p = m + 1;
                }
 
-               if (0) { // linear search cross check
-                       unsigned n = count - 1;
-                       at = entries;
-                       while (n--)
-                       {
-                               dxtrace(printk(KERN_CONT ","));
-                               if (dx_get_hash(++at) > hash)
-                               {
-                                       at--;
-                                       break;
-                               }
-                       }
-                       ASSERT(at == p - 1);
-               }
+               htree_rep_invariant_check(entries, p, hash, count - 1);
 
                at = p - 1;
                dxtrace(printk(KERN_CONT " %x->%u\n",
@@ -2401,11 +2411,10 @@ again:
                                                   (frame - 1)->bh);
                        if (err)
                                goto journal_error;
-                       if (restart) {
-                               err = ext4_handle_dirty_dx_node(handle, dir,
-                                                          frame->bh);
+                       err = ext4_handle_dirty_dx_node(handle, dir,
+                                                       frame->bh);
+                       if (err)
                                goto journal_error;
-                       }
                } else {
                        struct dx_root *dxroot;
                        memcpy((char *) entries2, (char *) entries,