Skip to content

Commit 3dd9141

Browse files
YuKuai-huaweiliu-song-6
authored andcommitted
md/md-bitmap: merge md_bitmap_copy_from_slot() into struct bitmap_operation.
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 57d6024 commit 3dd9141

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

drivers/md/md-bitmap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2088,8 +2088,8 @@ static struct bitmap *bitmap_get_from_slot(struct mddev *mddev, int slot)
20882088
/* Loads the bitmap associated with slot and copies the resync information
20892089
* to our bitmap
20902090
*/
2091-
int md_bitmap_copy_from_slot(struct mddev *mddev, int slot,
2092-
sector_t *low, sector_t *high, bool clear_bits)
2091+
static int bitmap_copy_from_slot(struct mddev *mddev, int slot, sector_t *low,
2092+
sector_t *high, bool clear_bits)
20932093
{
20942094
int rv = 0, i, j;
20952095
sector_t block, lo = 0, hi = 0;
@@ -2131,7 +2131,6 @@ int md_bitmap_copy_from_slot(struct mddev *mddev, int slot,
21312131

21322132
return rv;
21332133
}
2134-
EXPORT_SYMBOL_GPL(md_bitmap_copy_from_slot);
21352134

21362135
void md_bitmap_set_pages(struct bitmap *bitmap, unsigned long pages)
21372136
{
@@ -2782,6 +2781,7 @@ static struct bitmap_operations bitmap_ops = {
27822781

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

27872787
void mddev_set_bitmap_ops(struct mddev *mddev)

drivers/md/md-bitmap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,15 +277,15 @@ struct bitmap_operations {
277277
sector_t old_lo, sector_t old_hi,
278278
sector_t new_lo, sector_t new_hi);
279279
struct bitmap *(*get_from_slot)(struct mddev *mddev, int slot);
280+
int (*copy_from_slot)(struct mddev *mddev, int slot, sector_t *lo,
281+
sector_t *hi, bool clear_bits);
280282
};
281283

282284
/* the bitmap API */
283285
void mddev_set_bitmap_ops(struct mddev *mddev);
284286

285287
/* these are exported */
286288

287-
int md_bitmap_copy_from_slot(struct mddev *mddev, int slot,
288-
sector_t *lo, sector_t *hi, bool clear_bits);
289289
void md_bitmap_set_pages(struct bitmap *bitmap, unsigned long pages);
290290
void md_bitmap_free(struct bitmap *bitmap);
291291
void md_bitmap_wait_behind_writes(struct mddev *mddev);

drivers/md/md-cluster.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ static void recover_bitmaps(struct md_thread *thread)
317317
str, ret);
318318
goto clear_bit;
319319
}
320-
ret = md_bitmap_copy_from_slot(mddev, slot, &lo, &hi, true);
320+
ret = mddev->bitmap_ops->copy_from_slot(mddev, slot, &lo, &hi, true);
321321
if (ret) {
322322
pr_err("md-cluster: Could not copy data from bitmap %d\n", slot);
323323
goto clear_bit;
@@ -857,7 +857,7 @@ static int gather_all_resync_info(struct mddev *mddev, int total_slots)
857857
}
858858

859859
/* Read the disk bitmap sb and check if it needs recovery */
860-
ret = md_bitmap_copy_from_slot(mddev, i, &lo, &hi, false);
860+
ret = mddev->bitmap_ops->copy_from_slot(mddev, i, &lo, &hi, false);
861861
if (ret) {
862862
pr_warn("md-cluster: Could not gather bitmaps from slot %d", i);
863863
lockres_free(bm_lockres);
@@ -1600,7 +1600,7 @@ static int gather_bitmaps(struct md_rdev *rdev)
16001600
for (sn = 0; sn < mddev->bitmap_info.nodes; sn++) {
16011601
if (sn == (cinfo->slot_number - 1))
16021602
continue;
1603-
err = md_bitmap_copy_from_slot(mddev, sn, &lo, &hi, false);
1603+
err = mddev->bitmap_ops->copy_from_slot(mddev, sn, &lo, &hi, false);
16041604
if (err) {
16051605
pr_warn("md-cluster: Could not gather bitmaps from slot %d", sn);
16061606
goto out;

0 commit comments

Comments
 (0)