diff options
author | NeilBrown <neilb@cse.unsw.edu.au> | 2005-06-21 20:17:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-21 22:07:44 -0400 |
commit | bc7f77de2cd81718dd789a2cfe68a7cf1b48f016 (patch) | |
tree | a338f066db763fbc29cff388c5a443332ca67739 /drivers | |
parent | d80a138c013f81c1b9383c83983934e34e380a2d (diff) |
[PATCH] md: minor code rearrangement in bitmap_init_from_disk
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/bitmap.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index c43fd031aafe..62fac2b38000 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -781,7 +781,9 @@ static int bitmap_init_from_disk(struct bitmap *bitmap) | |||
781 | "recovery\n", bmname(bitmap)); | 781 | "recovery\n", bmname(bitmap)); |
782 | 782 | ||
783 | bytes = (chunks + 7) / 8; | 783 | bytes = (chunks + 7) / 8; |
784 | num_pages = (bytes + PAGE_SIZE - 1) / PAGE_SIZE; | 784 | |
785 | num_pages = (bytes + sizeof(bitmap_super_t) + PAGE_SIZE - 1) / PAGE_SIZE + 1; | ||
786 | |||
785 | if (i_size_read(file->f_mapping->host) < bytes + sizeof(bitmap_super_t)) { | 787 | if (i_size_read(file->f_mapping->host) < bytes + sizeof(bitmap_super_t)) { |
786 | printk(KERN_INFO "%s: bitmap file too short %lu < %lu\n", | 788 | printk(KERN_INFO "%s: bitmap file too short %lu < %lu\n", |
787 | bmname(bitmap), | 789 | bmname(bitmap), |
@@ -789,18 +791,16 @@ static int bitmap_init_from_disk(struct bitmap *bitmap) | |||
789 | bytes + sizeof(bitmap_super_t)); | 791 | bytes + sizeof(bitmap_super_t)); |
790 | goto out; | 792 | goto out; |
791 | } | 793 | } |
792 | num_pages++; | 794 | |
795 | ret = -ENOMEM; | ||
796 | |||
793 | bitmap->filemap = kmalloc(sizeof(struct page *) * num_pages, GFP_KERNEL); | 797 | bitmap->filemap = kmalloc(sizeof(struct page *) * num_pages, GFP_KERNEL); |
794 | if (!bitmap->filemap) { | 798 | if (!bitmap->filemap) |
795 | ret = -ENOMEM; | ||
796 | goto out; | 799 | goto out; |
797 | } | ||
798 | 800 | ||
799 | bitmap->filemap_attr = kmalloc(sizeof(long) * num_pages, GFP_KERNEL); | 801 | bitmap->filemap_attr = kmalloc(sizeof(long) * num_pages, GFP_KERNEL); |
800 | if (!bitmap->filemap_attr) { | 802 | if (!bitmap->filemap_attr) |
801 | ret = -ENOMEM; | ||
802 | goto out; | 803 | goto out; |
803 | } | ||
804 | 804 | ||
805 | memset(bitmap->filemap_attr, 0, sizeof(long) * num_pages); | 805 | memset(bitmap->filemap_attr, 0, sizeof(long) * num_pages); |
806 | 806 | ||