Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f86ffed authored by Guoqing Jiang's avatar Guoqing Jiang Committed by Shaohua Li
Browse files

md-cluster/bitmap: fix wrong calcuation of offset



The offset is wrong in bitmap_storage_alloc, we should
set it like below in bitmap_init_from_disk().

node_offset = bitmap->cluster_slot * (DIV_ROUND_UP(store->bytes, PAGE_SIZE));

Because 'offset' is only assigned to 'page->index' and
that is usually over-written by read_sb_page. So it does
not cause problem in general, but it still need to be fixed.

Reviewed-by: default avatarNeilBrown <neilb@suse.com>
Signed-off-by: default avatarGuoqing Jiang <gqjiang@suse.com>
Signed-off-by: default avatarShaohua Li <shli@fb.com>
parent 18c9ff7f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -759,7 +759,7 @@ static int bitmap_storage_alloc(struct bitmap_storage *store,
		bytes += sizeof(bitmap_super_t);

	num_pages = DIV_ROUND_UP(bytes, PAGE_SIZE);
	offset = slot_number * (num_pages - 1);
	offset = slot_number * num_pages;

	store->filemap = kmalloc(sizeof(struct page *)
				 * num_pages, GFP_KERNEL);