Skip to content

Commit 86b1e61

Browse files
committed
Merge tag 'md-6.9-20240301' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md into for-6.9/block
Pull MD updates from Song: "The major changes are: 1. Refactor raid1 read_balance, by Yu Kuai and Paul Luse. 2. Clean up and fix for md_ioctl, by Li Nan. 3. Other small fixes, by Gui-Dong Han and Heming Zhao." * tag 'md-6.9-20240301' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md: (22 commits) md/raid1: factor out helpers to choose the best rdev from read_balance() md/raid1: factor out the code to manage sequential IO md/raid1: factor out choose_bb_rdev() from read_balance() md/raid1: factor out choose_slow_rdev() from read_balance() md/raid1: factor out read_first_rdev() from read_balance() md/raid1-10: factor out a new helper raid1_should_read_first() md/raid1-10: add a helper raid1_check_read_range() md/raid1: fix choose next idle in read_balance() md/raid1: record nonrot rdevs while adding/removing rdevs to conf md/raid1: factor out helpers to add rdev to conf md: add a new helper rdev_has_badblock() md/raid5: fix atomicity violation in raid5_cache_count md/md-bitmap: fix incorrect usage for sb_index md: check mddev->pers before calling md_set_readonly() md: clean up openers check in do_md_stop() and md_set_readonly() md: sync blockdev before stopping raid or setting readonly md: factor out a helper to sync mddev md: Don't clear MD_CLOSING when the raid is about to stop md: return directly before setting did_set_md_closing md: clean up invalid BUG_ON in md_ioctl ...
2 parents 13fe8e6 + e81faa9 commit 86b1e61

File tree

8 files changed

+549
-381
lines changed

8 files changed

+549
-381
lines changed

drivers/md/md-bitmap.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ static int __write_sb_page(struct md_rdev *rdev, struct bitmap *bitmap,
234234
sector_t doff;
235235

236236
bdev = (rdev->meta_bdev) ? rdev->meta_bdev : rdev->bdev;
237-
if (pg_index == store->file_pages - 1) {
237+
/* we compare length (page numbers), not page offset. */
238+
if ((pg_index - store->sb_index) == store->file_pages - 1) {
238239
unsigned int last_page_size = store->bytes & (PAGE_SIZE - 1);
239240

240241
if (last_page_size == 0)
@@ -438,8 +439,8 @@ static void filemap_write_page(struct bitmap *bitmap, unsigned long pg_index,
438439
struct page *page = store->filemap[pg_index];
439440

440441
if (mddev_is_clustered(bitmap->mddev)) {
441-
pg_index += bitmap->cluster_slot *
442-
DIV_ROUND_UP(store->bytes, PAGE_SIZE);
442+
/* go to node bitmap area starting point */
443+
pg_index += store->sb_index;
443444
}
444445

445446
if (store->file)
@@ -952,6 +953,7 @@ static void md_bitmap_file_set_bit(struct bitmap *bitmap, sector_t block)
952953
unsigned long index = file_page_index(store, chunk);
953954
unsigned long node_offset = 0;
954955

956+
index += store->sb_index;
955957
if (mddev_is_clustered(bitmap->mddev))
956958
node_offset = bitmap->cluster_slot * store->file_pages;
957959

@@ -982,6 +984,7 @@ static void md_bitmap_file_clear_bit(struct bitmap *bitmap, sector_t block)
982984
unsigned long index = file_page_index(store, chunk);
983985
unsigned long node_offset = 0;
984986

987+
index += store->sb_index;
985988
if (mddev_is_clustered(bitmap->mddev))
986989
node_offset = bitmap->cluster_slot * store->file_pages;
987990

0 commit comments

Comments
 (0)