@@ -1878,7 +1878,7 @@ void md_bitmap_destroy(struct mddev *mddev)
* if this returns an error, bitmap_destroy must be called to do clean up
* once mddev->bitmap is set
*/
-struct bitmap *md_bitmap_create(struct mddev *mddev, int slot)
+static struct bitmap *bitmap_create(struct mddev *mddev, int slot)
{
struct bitmap *bitmap;
sector_t blocks = mddev->resync_max_sectors;
@@ -2029,7 +2029,7 @@ struct bitmap *get_bitmap_from_slot(struct mddev *mddev, int slot)
int rv = 0;
struct bitmap *bitmap;
- bitmap = md_bitmap_create(mddev, slot);
+ bitmap = bitmap_create(mddev, slot);
if (IS_ERR(bitmap)) {
rv = PTR_ERR(bitmap);
return ERR_PTR(rv);
@@ -2404,7 +2404,7 @@ location_store(struct mddev *mddev, const char *buf, size_t len)
}
mddev->bitmap_info.offset = offset;
- bitmap = md_bitmap_create(mddev, -1);
+ bitmap = bitmap_create(mddev, -1);
if (IS_ERR(bitmap)) {
rv = PTR_ERR(bitmap);
goto out;
@@ -2709,6 +2709,7 @@ const struct attribute_group md_bitmap_group = {
};
static struct bitmap_operations bitmap_ops = {
+ .create = bitmap_create,
};
void mddev_set_bitmap_ops(struct mddev *mddev)
@@ -235,13 +235,21 @@ struct bitmap {
};
struct bitmap_operations {
+ struct bitmap* (*create)(struct mddev *mddev, int slot);
};
/* the bitmap API */
void mddev_set_bitmap_ops(struct mddev *mddev);
/* these are used only by md/bitmap */
-struct bitmap *md_bitmap_create(struct mddev *mddev, int slot);
+static inline struct bitmap *md_bitmap_create(struct mddev *mddev, int slot)
+{
+ if (!mddev->bitmap_ops->create)
+ return ERR_PTR(-EOPNOTSUPP);
+
+ return mddev->bitmap_ops->create(mddev, slot);
+}
+
int md_bitmap_load(struct mddev *mddev);
void md_bitmap_flush(struct mddev *mddev);
void md_bitmap_destroy(struct mddev *mddev);