summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Reisner <philipp.reisner@linbit.com>2011-11-17 13:12:31 +0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2012-11-08 19:58:11 +0400
commitd60de03a6694302b691bdf858ede9cbdfb7112d6 (patch)
tree030c1b5a84f5f23f9bad023b042391163be9bed5
parent380207d08e7c4d1b19c0323777278992b4fbf9d6 (diff)
downloadlinux-d60de03a6694302b691bdf858ede9cbdfb7112d6.tar.xz
drbd: Load balancing method: striping
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r--drivers/block/drbd/drbd_req.c13
-rw-r--r--include/linux/drbd.h6
2 files changed, 17 insertions, 2 deletions
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index 98251e2a7fb7..5b28de0c5960 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -745,10 +745,11 @@ static bool drbd_may_do_local_read(struct drbd_conf *mdev, sector_t sector, int
return drbd_bm_count_bits(mdev, sbnr, ebnr) == 0;
}
-static bool remote_due_to_read_balancing(struct drbd_conf *mdev)
+static bool remote_due_to_read_balancing(struct drbd_conf *mdev, sector_t sector)
{
enum drbd_read_balancing rbm;
struct backing_dev_info *bdi;
+ int stripe_shift;
if (mdev->state.pdsk < D_UP_TO_DATE)
return false;
@@ -764,6 +765,14 @@ static bool remote_due_to_read_balancing(struct drbd_conf *mdev)
case RB_LEAST_PENDING:
return atomic_read(&mdev->local_cnt) >
atomic_read(&mdev->ap_pending_cnt) + atomic_read(&mdev->rs_pending_cnt);
+ case RB_32K_STRIPING: /* stripe_shift = 15 */
+ case RB_64K_STRIPING:
+ case RB_128K_STRIPING:
+ case RB_256K_STRIPING:
+ case RB_512K_STRIPING:
+ case RB_1M_STRIPING: /* stripe_shift = 20 */
+ stripe_shift = (rbm - RB_32K_STRIPING + 15);
+ return (sector >> (stripe_shift - 9)) & 1;
case RB_ROUND_ROBIN:
return test_and_change_bit(READ_BALANCE_RR, &mdev->flags);
case RB_PREFER_REMOTE:
@@ -841,7 +850,7 @@ int __drbd_make_request(struct drbd_conf *mdev, struct bio *bio, unsigned long s
bio_put(req->private_bio);
req->private_bio = NULL;
put_ldev(mdev);
- } else if (remote_due_to_read_balancing(mdev)) {
+ } else if (remote_due_to_read_balancing(mdev, sector)) {
/* Keep the private bio in case we need it
for a local retry */
local = 0;
diff --git a/include/linux/drbd.h b/include/linux/drbd.h
index 157ba3d74dc7..1e86156c10f7 100644
--- a/include/linux/drbd.h
+++ b/include/linux/drbd.h
@@ -108,6 +108,12 @@ enum drbd_read_balancing {
RB_ROUND_ROBIN,
RB_LEAST_PENDING,
RB_CONGESTED_REMOTE,
+ RB_32K_STRIPING,
+ RB_64K_STRIPING,
+ RB_128K_STRIPING,
+ RB_256K_STRIPING,
+ RB_512K_STRIPING,
+ RB_1M_STRIPING,
};
/* KEEP the order, do not delete or insert. Only append. */