Skip to content

Commit

Permalink
md/md-bitmap: merge md_bitmap_set_pages() into struct bitmap_operations
Browse files Browse the repository at this point in the history
o that the implementation won't be exposed, and it'll be possible
o invent a new bitmap by replacing bitmap_operations.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20240826074452.1490072-39-yukuai1@huaweicloud.com
Signed-off-by: Song Liu <song@kernel.org>
  • Loading branch information
Yu Kuai authored and Song Liu committed Aug 27, 2024
1 parent 3dd9141 commit ef1c400
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions drivers/md/md-bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2132,11 +2132,10 @@ static int bitmap_copy_from_slot(struct mddev *mddev, int slot, sector_t *low,
return rv;
}

void md_bitmap_set_pages(struct bitmap *bitmap, unsigned long pages)
static void bitmap_set_pages(struct bitmap *bitmap, unsigned long pages)
{
bitmap->counts.pages = pages;
}
EXPORT_SYMBOL_GPL(md_bitmap_set_pages);

static int bitmap_get_stats(struct bitmap *bitmap, struct md_bitmap_stats *stats)
{
Expand Down Expand Up @@ -2782,6 +2781,7 @@ static struct bitmap_operations bitmap_ops = {
.sync_with_cluster = bitmap_sync_with_cluster,
.get_from_slot = bitmap_get_from_slot,
.copy_from_slot = bitmap_copy_from_slot,
.set_pages = bitmap_set_pages,
};

void mddev_set_bitmap_ops(struct mddev *mddev)
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/md-bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,14 @@ struct bitmap_operations {
struct bitmap *(*get_from_slot)(struct mddev *mddev, int slot);
int (*copy_from_slot)(struct mddev *mddev, int slot, sector_t *lo,
sector_t *hi, bool clear_bits);
void (*set_pages)(struct bitmap *bitmap, unsigned long pages);
};

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

/* these are exported */

void md_bitmap_set_pages(struct bitmap *bitmap, unsigned long pages);
void md_bitmap_free(struct bitmap *bitmap);
void md_bitmap_wait_behind_writes(struct mddev *mddev);

Expand Down
2 changes: 1 addition & 1 deletion drivers/md/md-cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,7 @@ static int resize_bitmaps(struct mddev *mddev, sector_t newsize, sector_t oldsiz
bm_lockres->flags |= DLM_LKF_NOQUEUE;
rv = dlm_lock_sync(bm_lockres, DLM_LOCK_PW);
if (!rv)
md_bitmap_set_pages(bitmap, my_pages);
mddev->bitmap_ops->set_pages(bitmap, my_pages);
lockres_free(bm_lockres);

if (my_pages != stats.pages)
Expand Down

0 comments on commit ef1c400

Please sign in to comment.