Btrfs: i386 fixes from axboe
[linux-2.6-block.git] / fs / btrfs / disk-io.c
index 96bf3ef3a798f17f42c551ff23ecc226a2c0e406..b0ebba6f2e467b119d3cdaa4d662f12b56928d4a 100644 (file)
@@ -1,3 +1,21 @@
+/*
+ * Copyright (C) 2007 Oracle.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
 #include <linux/module.h>
 #include <linux/fs.h>
 #include <linux/blkdev.h>
@@ -20,8 +38,9 @@ static int check_tree_block(struct btrfs_root *root, struct buffer_head *buf)
 {
        struct btrfs_node *node = btrfs_buffer_node(buf);
        if (bh_blocknr(buf) != btrfs_header_blocknr(&node->header)) {
-               printk(KERN_CRIT "bh_blocknr(buf) is %Lu, header is %Lu\n",
-                      bh_blocknr(buf), btrfs_header_blocknr(&node->header));
+               printk(KERN_CRIT "bh_blocknr(buf) is %llu, header is %llu\n",
+                      (unsigned long long)bh_blocknr(buf),
+                      (unsigned long long)btrfs_header_blocknr(&node->header));
                return 1;
        }
        return 0;
@@ -87,7 +106,7 @@ struct buffer_head *btrfs_find_create_tree_block(struct btrfs_root *root,
        int err;
        u64 first_block = index << (PAGE_CACHE_SHIFT - blockbits);
 
-       page = grab_cache_page(mapping, index);
+       page = find_or_create_page(mapping, index, GFP_NOFS);
        if (!page)
                return NULL;
 
@@ -157,8 +176,9 @@ static int csum_tree_block(struct btrfs_root *root, struct buffer_head *bh,
                return ret;
        if (verify) {
                if (memcmp(bh->b_data, result, BTRFS_CRC32_SIZE)) {
-                       printk("checksum verify failed on %Lu\n",
-                              bh_blocknr(bh));
+                       printk("btrfs: %s checksum verify failed on %llu\n",
+                              root->fs_info->sb->s_id,
+                              (unsigned long long)bh_blocknr(bh));
                        return 1;
                }
        } else {