aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2017-04-05 00:05:50 -0400
committerShaohua Li <shli@fb.com>2017-04-11 13:08:47 -0400
commitcb83efcfd26a28b76eef8815a41158c1896fc5ba (patch)
tree092bd3e26ca8d832bffbaa94d501845e81ca39ad
parentc230e7e53526c223a3e1caf40747d6e37c0e4394 (diff)
md/raid1: simplify alloc_behind_master_bio()
Now that we always always pass an offset of 0 and a size that matches the bio to alloc_behind_master_bio(), we can remove the offset/size args and simplify the code. We could probably remove bio_copy_data_partial() too. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Shaohua Li <shli@fb.com>
-rw-r--r--drivers/md/raid1.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 94f1d754aa09..18af00c86b42 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1091,9 +1091,9 @@ static void unfreeze_array(struct r1conf *conf)
1091} 1091}
1092 1092
1093static struct bio *alloc_behind_master_bio(struct r1bio *r1_bio, 1093static struct bio *alloc_behind_master_bio(struct r1bio *r1_bio,
1094 struct bio *bio, 1094 struct bio *bio)
1095 int offset, int size)
1096{ 1095{
1096 int size = bio->bi_iter.bi_size;
1097 unsigned vcnt = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; 1097 unsigned vcnt = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
1098 int i = 0; 1098 int i = 0;
1099 struct bio *behind_bio = NULL; 1099 struct bio *behind_bio = NULL;
@@ -1120,8 +1120,7 @@ static struct bio *alloc_behind_master_bio(struct r1bio *r1_bio,
1120 i++; 1120 i++;
1121 } 1121 }
1122 1122
1123 bio_copy_data_partial(behind_bio, bio, offset, 1123 bio_copy_data(behind_bio, bio);
1124 behind_bio->bi_iter.bi_size);
1125skip_copy: 1124skip_copy:
1126 r1_bio->behind_master_bio = behind_bio;; 1125 r1_bio->behind_master_bio = behind_bio;;
1127 set_bit(R1BIO_BehindIO, &r1_bio->state); 1126 set_bit(R1BIO_BehindIO, &r1_bio->state);
@@ -1462,9 +1461,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
1462 (atomic_read(&bitmap->behind_writes) 1461 (atomic_read(&bitmap->behind_writes)
1463 < mddev->bitmap_info.max_write_behind) && 1462 < mddev->bitmap_info.max_write_behind) &&
1464 !waitqueue_active(&bitmap->behind_wait)) { 1463 !waitqueue_active(&bitmap->behind_wait)) {
1465 mbio = alloc_behind_master_bio(r1_bio, bio, 1464 mbio = alloc_behind_master_bio(r1_bio, bio);
1466 0,
1467 max_sectors << 9);
1468 } 1465 }
1469 1466
1470 bitmap_startwrite(bitmap, r1_bio->sector, 1467 bitmap_startwrite(bitmap, r1_bio->sector,