mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH md-6.13 0/5] md/md-bitmap: move bitmap_{start,end}write to md upper layer
@ 2024-11-18 11:41 Yu Kuai
  2024-11-18 11:41 ` [PATCH md-6.13 1/5] md/md-bitmap: factor behind write counters out from bitmap_{start/end}write() Yu Kuai
                   ` (4 more replies)
  0 siblings, 5 replies; 28+ messages in thread
From: Yu Kuai @ 2024-11-18 11:41 UTC (permalink / raw)
  To: song, xni; +Cc: linux-raid, linux-kernel, yukuai3, yukuai1, yi.zhang, yangerkun

From: Yu Kuai <yukuai3@huawei.com>

While reviewing raid5 code, it's found that bitmap operations can be
optimized. For example, for a 4 disks raid5, with chunksize=8k, if user
issue a IO (0 + 48k) to the array:

┌────────────────────────────────────────────────────────────┐
│chunk 0                                                     │
│      ┌────────────┬─────────────┬─────────────┬────────────┼
│  sh0 │A0: 0 + 4k  │A1: 8k + 4k  │A2: 16k + 4k │A3: P       │
│      ┼────────────┼─────────────┼─────────────┼────────────┼
│  sh1 │B0: 4k + 4k │B1: 12k + 4k │B2: 20k + 4k │B3: P       │
┼──────┴────────────┴─────────────┴─────────────┴────────────┼
│chunk 1                                                     │
│      ┌────────────┬─────────────┬─────────────┬────────────┤
│  sh2 │C0: 24k + 4k│C1: 32k + 4k │C2: P        │C3: 40k + 4k│
│      ┼────────────┼─────────────┼─────────────┼────────────┼
│  sh3 │D0: 28k + 4k│D1: 36k + 4k │D2: P        │D3: 44k + 4k│
└──────┴────────────┴─────────────┴─────────────┴────────────┘

Before this set, 4 stripe head will be used, and each sh will attach
bio for 3 disks, and each attached bio will trigger
bitmap_startwrite() once, which means total 12 times.
 - 3 times (0 + 4k), for (A0, A1 and A2)
 - 3 times (4 + 4k), for (B0, B1 and B2)
 - 3 times (8 + 4k), for (C0, C1 and C3)
 - 3 times (12 + 4k), for (D0, D1 and D3)

After this set, md upper layer will calculate that IO range (0 + 48k)
is corresponding to the bitmap (0 + 16k), and call bitmap_startwrite()
just once.

Noted that this patch will align bitmap ranges to the chunks, for example,
if user issue a IO (0 + 4k) to array:

- Before this set, 1 time (0 + 4k), for A0;
- After this set, 1 time (0 + 8k) for chunk 0;

Usually, one bitmap bit will represent more than one disk chunk, and this
doesn't have any difference. And even if user really created a array
that one chunk contain multiple bits, the overhead is that more data
will be recovered after power failure.

Yu Kuai (5):
  md/md-bitmap: factor behind write counters out from
    bitmap_{start/end}write()
  md/md-bitmap: remove the last parameter for bimtap_ops->endwrite()
  md: add a new callback pers->bitmap_sector()
  md/raid5: implement pers->bitmap_sector()
  md/md-bitmap: move bitmap_{start, end}write to md upper layer

 drivers/md/md-bitmap.c   | 74 ++++++++++++++++++++++++----------------
 drivers/md/md-bitmap.h   |  7 ++--
 drivers/md/md.c          | 29 ++++++++++++++++
 drivers/md/md.h          |  5 +++
 drivers/md/raid1.c       | 11 +++---
 drivers/md/raid10.c      |  6 ----
 drivers/md/raid5-cache.c |  4 ---
 drivers/md/raid5.c       | 48 ++++++++++++--------------
 8 files changed, 109 insertions(+), 75 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2024-11-25  1:16 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-18 11:41 [PATCH md-6.13 0/5] md/md-bitmap: move bitmap_{start,end}write to md upper layer Yu Kuai
2024-11-18 11:41 ` [PATCH md-6.13 1/5] md/md-bitmap: factor behind write counters out from bitmap_{start/end}write() Yu Kuai
2024-11-22  2:16   ` Xiao Ni
2024-11-18 11:41 ` [PATCH md-6.13 2/5] md/md-bitmap: remove the last parameter for bimtap_ops->endwrite() Yu Kuai
2024-11-18 11:41 ` [PATCH md-6.13 3/5] md: add a new callback pers->bitmap_sector() Yu Kuai
2024-11-22  2:17   ` Xiao Ni
2024-11-18 11:41 ` [PATCH md-6.13 4/5] md/raid5: implement pers->bitmap_sector() Yu Kuai
2024-11-18 11:41 ` [PATCH md-6.13 5/5] md/md-bitmap: move bitmap_{start, end}write to md upper layer Yu Kuai
2024-11-19  9:49   ` [PATCH md-6.13 4/5] md/raid5: implement pers->bitmap_sector() Jack Wang
2024-11-19 10:58     ` Yu Kuai
2024-11-19 15:29       ` Jack Wang
2024-11-21  8:10         ` Jinpu Wang
2024-11-21  8:33           ` Yu Kuai
2024-11-21  8:40             ` Jinpu Wang
2024-11-21  8:44               ` Yu Kuai
2024-11-21  8:46                 ` Jinpu Wang
2024-11-21  9:30             ` Christian Theune
2024-11-21 11:01               ` Yu Kuai
2024-11-21 12:05                 ` Christian Theune
2024-11-21 12:21             ` Christian Theune
2024-11-21 12:37               ` Yu Kuai
2024-11-21 16:14                 ` Christian Theune
2024-11-22  2:06   ` [PATCH md-6.13 5/5] md/md-bitmap: move bitmap_{start, end}write to md upper layer Xiao Ni
2024-11-22  2:45     ` Yu Kuai
2024-11-22  3:14       ` Xiao Ni
2024-11-22  8:32         ` Yu Kuai
2024-11-23  3:55           ` Xiao Ni
2024-11-25  1:15             ` Yu Kuai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®