]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
btrfs: silence warning in raid array setup
authorDavid Sterba <dsterba@suse.cz>
Fri, 7 Oct 2011 16:06:13 +0000 (18:06 +0200)
committerDavid Sterba <dsterba@suse.cz>
Wed, 15 Feb 2012 15:40:25 +0000 (16:40 +0100)
Raid array setup code creates an extent buffer in an usual way. When the
PAGE_CACHE_SIZE is > super block size, the extent pages are not marked
up-to-date, which triggers a WARN_ON in the following
write_extent_buffer call. Add an explicit up-to-date call to silence the
warning.

Signed-off-by: David Sterba <dsterba@suse.cz>
fs/btrfs/volumes.c

index 7ffdb154daec5620745ca0ba4f961f243e5a5f57..d8f282b5baa993b881cc6a91506d666825b34b96 100644 (file)
@@ -4357,6 +4357,20 @@ int btrfs_read_sys_array(struct btrfs_root *root)
                return -ENOMEM;
        btrfs_set_buffer_uptodate(sb);
        btrfs_set_buffer_lockdep_class(root->root_key.objectid, sb, 0);
+       /*
+        * The sb extent buffer is artifical and just used to read the system array.
+        * btrfs_set_buffer_uptodate() call does not properly mark all it's
+        * pages up-to-date when the page is larger: extent does not cover the
+        * whole page and consequently check_page_uptodate does not find all
+        * the page's extents up-to-date (the hole beyond sb),
+        * write_extent_buffer then triggers a WARN_ON.
+        *
+        * Regular short extents go through mark_extent_buffer_dirty/writeback cycle,
+        * but sb spans only this function. Add an explicit SetPageUptodate call
+        * to silence the warning eg. on PowerPC 64.
+        */
+       if (PAGE_CACHE_SIZE > BTRFS_SUPER_INFO_SIZE)
+               SetPageUptodate(sb->first_page);
 
        write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE);
        array_size = btrfs_super_sys_array_size(super_copy);