]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Btrfs: cast bio->bi_sector to a u64 before shifting
authorChris Mason <chris.mason@oracle.com>
Fri, 3 Oct 2008 20:31:08 +0000 (16:31 -0400)
committerChris Mason <chris.mason@oracle.com>
Fri, 3 Oct 2008 20:31:08 +0000 (16:31 -0400)
On 32 bit machines without CONFIG_LBD, the bi_sector field is only 32 bits.
Btrfs needs to cast it before shifting up, or we end up doing IO into
the wrong place.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/inode.c
fs/btrfs/volumes.c

index e5c9261dcbaa162dbf2573abcef16fe7060855a4..ff0c35976657586b2fe2c7a180c7f08d04f36e7f 100644 (file)
@@ -386,7 +386,7 @@ int btrfs_merge_bio_hook(struct page *page, unsigned long offset,
 {
        struct btrfs_root *root = BTRFS_I(page->mapping->host)->root;
        struct btrfs_mapping_tree *map_tree;
-       u64 logical = bio->bi_sector << 9;
+       u64 logical = (u64)bio->bi_sector << 9;
        u64 length = 0;
        u64 map_length;
        int ret;
index f63cf7621a01a3b46665fa87100dd31939e6c459..2eed7f91f51a3dca150ba8d2f61d746991167ef1 100644 (file)
@@ -2187,7 +2187,7 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio,
        struct btrfs_mapping_tree *map_tree;
        struct btrfs_device *dev;
        struct bio *first_bio = bio;
-       u64 logical = bio->bi_sector << 9;
+       u64 logical = (u64)bio->bi_sector << 9;
        u64 length = 0;
        u64 map_length;
        struct btrfs_multi_bio *multi = NULL;