Commit 248728dd authored by Yufen Yu's avatar Yufen Yu Committed by Song Liu

md/raid5: make async_copy_data() to support different page offset

ops_run_biofill() and ops_run_biodrain() will call async_copy_data()
to copy sh->dev[i].page from or to bio page. For now, it implies the
offset of dev[i].page is 0. But we want to support different page offset
in the following.

Thus, pass page offset to these functions and replace 'page_offset'
with 'page_offset + poff'.

No functional change.
Signed-off-by: default avatarYufen Yu <yuyufen@huawei.com>
Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
parent 7aba13b7
...@@ -1227,7 +1227,7 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) ...@@ -1227,7 +1227,7 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
static struct dma_async_tx_descriptor * static struct dma_async_tx_descriptor *
async_copy_data(int frombio, struct bio *bio, struct page **page, async_copy_data(int frombio, struct bio *bio, struct page **page,
sector_t sector, struct dma_async_tx_descriptor *tx, unsigned int poff, sector_t sector, struct dma_async_tx_descriptor *tx,
struct stripe_head *sh, int no_skipcopy) struct stripe_head *sh, int no_skipcopy)
{ {
struct bio_vec bvl; struct bio_vec bvl;
...@@ -1273,11 +1273,11 @@ async_copy_data(int frombio, struct bio *bio, struct page **page, ...@@ -1273,11 +1273,11 @@ async_copy_data(int frombio, struct bio *bio, struct page **page,
!no_skipcopy) !no_skipcopy)
*page = bio_page; *page = bio_page;
else else
tx = async_memcpy(*page, bio_page, page_offset, tx = async_memcpy(*page, bio_page, page_offset + poff,
b_offset, clen, &submit); b_offset, clen, &submit);
} else } else
tx = async_memcpy(bio_page, *page, b_offset, tx = async_memcpy(bio_page, *page, b_offset,
page_offset, clen, &submit); page_offset + poff, clen, &submit);
} }
/* chain the operations */ /* chain the operations */
submit.depend_tx = tx; submit.depend_tx = tx;
...@@ -1350,6 +1350,7 @@ static void ops_run_biofill(struct stripe_head *sh) ...@@ -1350,6 +1350,7 @@ static void ops_run_biofill(struct stripe_head *sh)
while (rbi && rbi->bi_iter.bi_sector < while (rbi && rbi->bi_iter.bi_sector <
dev->sector + RAID5_STRIPE_SECTORS(conf)) { dev->sector + RAID5_STRIPE_SECTORS(conf)) {
tx = async_copy_data(0, rbi, &dev->page, tx = async_copy_data(0, rbi, &dev->page,
dev->offset,
dev->sector, tx, sh, 0); dev->sector, tx, sh, 0);
rbi = r5_next_bio(conf, rbi, dev->sector); rbi = r5_next_bio(conf, rbi, dev->sector);
} }
...@@ -1790,6 +1791,7 @@ ops_run_biodrain(struct stripe_head *sh, struct dma_async_tx_descriptor *tx) ...@@ -1790,6 +1791,7 @@ ops_run_biodrain(struct stripe_head *sh, struct dma_async_tx_descriptor *tx)
set_bit(R5_Discard, &dev->flags); set_bit(R5_Discard, &dev->flags);
else { else {
tx = async_copy_data(1, wbi, &dev->page, tx = async_copy_data(1, wbi, &dev->page,
dev->offset,
dev->sector, tx, sh, dev->sector, tx, sh,
r5c_is_writeback(conf->log)); r5c_is_writeback(conf->log));
if (dev->page != dev->orig_page && if (dev->page != dev->orig_page &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment