Btrfs: only clear dirty on the buffer if it is marked as dirty
authorJosef Bacik <jbacik@fusionio.com>
Mon, 15 Oct 2012 17:33:54 +0000 (13:33 -0400)
committerChris Mason <chris.mason@fusionio.com>
Mon, 17 Dec 2012 01:46:25 +0000 (20:46 -0500)
No reason to set the path blocking or loop through all of the pages if the
extent buffer isn't actually marked dirty.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/disk-io.c

index b8f7f04a64078b1358075b7424dbae12fb3ffcfc..65f03670a9528873e575545b18cbbd6a7ae12ebb 100644 (file)
@@ -1142,11 +1142,11 @@ void clean_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
                                          root->fs_info->dirty_metadata_bytes);
                        }
                        spin_unlock(&root->fs_info->delalloc_lock);
-               }
 
-               /* ugh, clear_extent_buffer_dirty needs to lock the page */
-               btrfs_set_lock_blocking(buf);
-               clear_extent_buffer_dirty(buf);
+                       /* ugh, clear_extent_buffer_dirty needs to lock the page */
+                       btrfs_set_lock_blocking(buf);
+                       clear_extent_buffer_dirty(buf);
+               }
        }
 }