@@ -1654,7 +1654,7 @@ static void bitmap_end_sync(struct bitmap *bitmap, sector_t offset,
spin_unlock_irqrestore(&bitmap->counts.lock, flags);
}
-void md_bitmap_close_sync(struct bitmap *bitmap)
+static void bitmap_close_sync(struct bitmap *bitmap)
{
/* Sync has finished, and any bitmap chunks that weren't synced
* properly have been aborted. It remains to us to clear the
@@ -1662,14 +1662,12 @@ void md_bitmap_close_sync(struct bitmap *bitmap)
*/
sector_t sector = 0;
sector_t blocks;
- if (!bitmap)
- return;
+
while (sector < bitmap->mddev->resync_max_sectors) {
bitmap_end_sync(bitmap, sector, &blocks, 0);
sector += blocks;
}
}
-EXPORT_SYMBOL(md_bitmap_close_sync);
void md_bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector, bool force)
{
@@ -1986,7 +1984,7 @@ static int bitmap_load(struct mddev *mddev)
bitmap_start_sync(bitmap, sector, &blocks, 0);
sector += blocks;
}
- md_bitmap_close_sync(bitmap);
+ bitmap_close_sync(bitmap);
if (mddev->degraded == 0
|| bitmap->events_cleared == mddev->events)
@@ -2714,6 +2712,7 @@ static struct bitmap_operations bitmap_ops = {
.endwrite = bitmap_endwrite,
.start_sync = bitmap_start_sync,
.end_sync = bitmap_end_sync,
+ .close_sync = bitmap_close_sync,
.update_sb = bitmap_update_sb,
};
@@ -251,6 +251,7 @@ struct bitmap_operations {
sector_t *blocks, int degraded);
void (*end_sync)(struct bitmap *bitmap, sector_t offset,
sector_t *blocks, int aborted);
+ void (*close_sync)(struct bitmap *bitmap);
void (*update_sb)(struct bitmap *bitmap);
};
@@ -367,7 +368,14 @@ static inline void md_bitmap_end_sync(struct mddev *mddev, sector_t offset,
mddev->bitmap_ops->end_sync(mddev->bitmap, offset, blocks, aborted);
}
-void md_bitmap_close_sync(struct bitmap *bitmap);
+static inline void md_bitmap_close_sync(struct mddev *mddev)
+{
+ if (!mddev->bitmap || !mddev->bitmap_ops->close_sync)
+ return;
+
+ mddev->bitmap_ops->close_sync(mddev->bitmap);
+}
+
void md_bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector, bool force);
void md_bitmap_sync_with_cluster(struct mddev *mddev,
sector_t old_lo, sector_t old_hi,
@@ -2787,7 +2787,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
else /* completed sync */
conf->fullsync = 0;
- md_bitmap_close_sync(mddev->bitmap);
+ md_bitmap_close_sync(mddev);
close_sync(conf);
if (mddev_is_clustered(mddev)) {
@@ -3216,7 +3216,7 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr,
}
conf->fullsync = 0;
}
- md_bitmap_close_sync(mddev->bitmap);
+ md_bitmap_close_sync(mddev);
close_sync(conf);
*skipped = 1;
return sectors_skipped;
@@ -6501,7 +6501,7 @@ static inline sector_t raid5_sync_request(struct mddev *mddev, sector_t sector_n
&sync_blocks, 1);
else /* completed sync */
conf->fullsync = 0;
- md_bitmap_close_sync(mddev->bitmap);
+ md_bitmap_close_sync(mddev);
return 0;
}