Commit 1ec885cd authored by NeilBrown's avatar NeilBrown

md/bitmap: move some fields of 'struct bitmap' into a 'storage' substruct.

This new 'struct bitmap_storage' reflects the external storage of the
bitmap.
Having this clearly defined will make it easier to change the storage
used while the array is active.
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent d189122d
This diff is collapsed.
...@@ -188,12 +188,17 @@ struct bitmap { ...@@ -188,12 +188,17 @@ struct bitmap {
/* bitmap spinlock */ /* bitmap spinlock */
spinlock_t lock; spinlock_t lock;
struct bitmap_storage {
struct file *file; /* backing disk file */ struct file *file; /* backing disk file */
struct page *sb_page; /* cached copy of the bitmap file superblock */ struct page *sb_page; /* cached copy of the bitmap
struct page **filemap; /* list of cache pages for the file */ * file superblock */
unsigned long *filemap_attr; /* attributes associated w/ filemap pages */ struct page **filemap; /* list of cache pages for
unsigned long file_pages; /* number of pages in the file */ * the file */
unsigned long *filemap_attr; /* attributes associated
* w/ filemap pages */
unsigned long file_pages; /* number of pages in the file*/
int last_page_size; /* bytes in the last page */ int last_page_size; /* bytes in the last page */
} storage;
unsigned long flags; unsigned long flags;
......
...@@ -1989,7 +1989,7 @@ super_1_allow_new_offset(struct md_rdev *rdev, ...@@ -1989,7 +1989,7 @@ super_1_allow_new_offset(struct md_rdev *rdev,
bitmap = rdev->mddev->bitmap; bitmap = rdev->mddev->bitmap;
if (bitmap && !rdev->mddev->bitmap_info.file && if (bitmap && !rdev->mddev->bitmap_info.file &&
rdev->sb_start + rdev->mddev->bitmap_info.offset + rdev->sb_start + rdev->mddev->bitmap_info.offset +
bitmap->file_pages * (PAGE_SIZE>>9) > new_offset) bitmap->storage.file_pages * (PAGE_SIZE>>9) > new_offset)
return 0; return 0;
if (rdev->badblocks.sector + rdev->badblocks.size > new_offset) if (rdev->badblocks.sector + rdev->badblocks.size > new_offset)
return 0; return 0;
...@@ -5649,7 +5649,7 @@ static int get_bitmap_file(struct mddev * mddev, void __user * arg) ...@@ -5649,7 +5649,7 @@ static int get_bitmap_file(struct mddev * mddev, void __user * arg)
goto out; goto out;
/* bitmap disabled, zero the first byte and copy out */ /* bitmap disabled, zero the first byte and copy out */
if (!mddev->bitmap || !mddev->bitmap->file) { if (!mddev->bitmap || !mddev->bitmap->storage.file) {
file->pathname[0] = '\0'; file->pathname[0] = '\0';
goto copy_out; goto copy_out;
} }
...@@ -5658,7 +5658,8 @@ static int get_bitmap_file(struct mddev * mddev, void __user * arg) ...@@ -5658,7 +5658,8 @@ static int get_bitmap_file(struct mddev * mddev, void __user * arg)
if (!buf) if (!buf)
goto out; goto out;
ptr = d_path(&mddev->bitmap->file->f_path, buf, sizeof(file->pathname)); ptr = d_path(&mddev->bitmap->storage.file->f_path,
buf, sizeof(file->pathname));
if (IS_ERR(ptr)) if (IS_ERR(ptr))
goto out; goto out;
...@@ -6299,7 +6300,7 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info) ...@@ -6299,7 +6300,7 @@ static int update_array_info(struct mddev *mddev, mdu_array_info_t *info)
/* remove the bitmap */ /* remove the bitmap */
if (!mddev->bitmap) if (!mddev->bitmap)
return -ENOENT; return -ENOENT;
if (mddev->bitmap->file) if (mddev->bitmap->storage.file)
return -EINVAL; return -EINVAL;
mddev->pers->quiesce(mddev, 1); mddev->pers->quiesce(mddev, 1);
bitmap_destroy(mddev); bitmap_destroy(mddev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment