Skip to content

Commit 57d6024

Browse files
YuKuai-huaweiliu-song-6
authored andcommitted
md/md-bitmap: merge get_bitmap_from_slot() into bitmap_operations
So that the implementation won't be exposed, and it'll be possible to invent a new bitmap by replacing bitmap_operations. Signed-off-by: Yu Kuai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Song Liu <[email protected]>
1 parent 77c0964 commit 57d6024

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

drivers/md/md-bitmap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,7 +2065,7 @@ static int bitmap_load(struct mddev *mddev)
20652065
}
20662066

20672067
/* caller need to free returned bitmap with md_bitmap_free() */
2068-
struct bitmap *get_bitmap_from_slot(struct mddev *mddev, int slot)
2068+
static struct bitmap *bitmap_get_from_slot(struct mddev *mddev, int slot)
20692069
{
20702070
int rv = 0;
20712071
struct bitmap *bitmap;
@@ -2084,7 +2084,6 @@ struct bitmap *get_bitmap_from_slot(struct mddev *mddev, int slot)
20842084

20852085
return bitmap;
20862086
}
2087-
EXPORT_SYMBOL(get_bitmap_from_slot);
20882087

20892088
/* Loads the bitmap associated with slot and copies the resync information
20902089
* to our bitmap
@@ -2097,7 +2096,7 @@ int md_bitmap_copy_from_slot(struct mddev *mddev, int slot,
20972096
struct bitmap_counts *counts;
20982097
struct bitmap *bitmap;
20992098

2100-
bitmap = get_bitmap_from_slot(mddev, slot);
2099+
bitmap = bitmap_get_from_slot(mddev, slot);
21012100
if (IS_ERR(bitmap)) {
21022101
pr_err("%s can't get bitmap from slot %d\n", __func__, slot);
21032102
return -1;
@@ -2782,6 +2781,7 @@ static struct bitmap_operations bitmap_ops = {
27822781
.get_stats = bitmap_get_stats,
27832782

27842783
.sync_with_cluster = bitmap_sync_with_cluster,
2784+
.get_from_slot = bitmap_get_from_slot,
27852785
};
27862786

27872787
void mddev_set_bitmap_ops(struct mddev *mddev)

drivers/md/md-bitmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,14 +276,14 @@ struct bitmap_operations {
276276
void (*sync_with_cluster)(struct mddev *mddev,
277277
sector_t old_lo, sector_t old_hi,
278278
sector_t new_lo, sector_t new_hi);
279+
struct bitmap *(*get_from_slot)(struct mddev *mddev, int slot);
279280
};
280281

281282
/* the bitmap API */
282283
void mddev_set_bitmap_ops(struct mddev *mddev);
283284

284285
/* these are exported */
285286

286-
struct bitmap *get_bitmap_from_slot(struct mddev *mddev, int slot);
287287
int md_bitmap_copy_from_slot(struct mddev *mddev, int slot,
288288
sector_t *lo, sector_t *hi, bool clear_bits);
289289
void md_bitmap_set_pages(struct bitmap *bitmap, unsigned long pages);

drivers/md/md-cluster.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ static int resize_bitmaps(struct mddev *mddev, sector_t newsize, sector_t oldsiz
11691169
if (i == md_cluster_ops->slot_number(mddev))
11701170
continue;
11711171

1172-
bitmap = get_bitmap_from_slot(mddev, i);
1172+
bitmap = mddev->bitmap_ops->get_from_slot(mddev, i);
11731173
if (IS_ERR(bitmap)) {
11741174
pr_err("can't get bitmap from slot %d\n", i);
11751175
bitmap = NULL;
@@ -1236,7 +1236,7 @@ static int cluster_check_sync_size(struct mddev *mddev)
12361236
if (i == current_slot)
12371237
continue;
12381238

1239-
bitmap = get_bitmap_from_slot(mddev, i);
1239+
bitmap = mddev->bitmap_ops->get_from_slot(mddev, i);
12401240
if (IS_ERR(bitmap)) {
12411241
pr_err("can't get bitmap from slot %d\n", i);
12421242
return -1;

0 commit comments

Comments
 (0)