aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorZhao Lei <zhaolei@cn.fujitsu.com>2014-12-08 06:55:57 -0500
committerChris Mason <clm@fb.com>2016-01-20 10:22:15 -0500
commitbfca9a6d4b1322ba36235e8a652f05a9668ef59b (patch)
tree863e7cad45616ddc8a5417919d696ced884ddd2e /fs
parente1746e8381cd2af421f75557b5cae3604fc18b35 (diff)
btrfs: Fix calculation of rbio->dbitmap's size calculation
Current code is trying to calculate rbio->dbitmap's size to make it align to sizeof(long), but implement haven't achived this object, it is align to sizeof(char) instead. This patch fixed above calculation, and use sizeof(long) instead of fixed "8" to increate compatibility. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/raid56.c4
-rw-r--r--fs/btrfs/scrub.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
index 6d707545f775..9ee11b41ba5d 100644
--- a/fs/btrfs/raid56.c
+++ b/fs/btrfs/raid56.c
@@ -966,8 +966,8 @@ static struct btrfs_raid_bio *alloc_rbio(struct btrfs_root *root,
966 void *p; 966 void *p;
967 967
968 rbio = kzalloc(sizeof(*rbio) + num_pages * sizeof(struct page *) * 2 + 968 rbio = kzalloc(sizeof(*rbio) + num_pages * sizeof(struct page *) * 2 +
969 DIV_ROUND_UP(stripe_npages, BITS_PER_LONG / 8), 969 DIV_ROUND_UP(stripe_npages, BITS_PER_LONG) *
970 GFP_NOFS); 970 sizeof(long), GFP_NOFS);
971 if (!rbio) 971 if (!rbio)
972 return ERR_PTR(-ENOMEM); 972 return ERR_PTR(-ENOMEM);
973 973
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 681db07f25ea..b1a68530e911 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -2813,7 +2813,7 @@ out:
2813 2813
2814static inline int scrub_calc_parity_bitmap_len(int nsectors) 2814static inline int scrub_calc_parity_bitmap_len(int nsectors)
2815{ 2815{
2816 return DIV_ROUND_UP(nsectors, BITS_PER_LONG) * (BITS_PER_LONG / 8); 2816 return DIV_ROUND_UP(nsectors, BITS_PER_LONG) * sizeof(long);
2817} 2817}
2818 2818
2819static void scrub_parity_get(struct scrub_parity *sparity) 2819static void scrub_parity_get(struct scrub_parity *sparity)