summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Ellenberg <lars@linbit.com>2016-06-14 00:26:29 +0200
committerJens Axboe <axboe@fb.com>2016-06-13 21:43:06 -0600
commit65f5be3579a69c6a057eeb99620999788982bff6 (patch)
tree116ce9c598cce7bc43b837e1e36e1fab0db35c52
parentaf61494ad4725ed78bd6b3f159a32463d80fdd60 (diff)
drbd: discard_zeroes_if_aligned allows "thin" resync for discard_zeroes_data=0
Even if discard_zeroes_data != 0, if discard_zeroes_if_aligned is set, we assume we can reliably zero-out/discard using the drbd_issue_peer_discard() helper. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--drivers/block/drbd/drbd_nl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index e5fdcc6c2e67..169e3e15a30e 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -1408,9 +1408,12 @@ static void sanitize_disk_conf(struct drbd_device *device, struct disk_conf *dis
if (disk_conf->al_extents > drbd_al_extents_max(nbc))
disk_conf->al_extents = drbd_al_extents_max(nbc);
- if (!blk_queue_discard(q) || !q->limits.discard_zeroes_data) {
- disk_conf->rs_discard_granularity = 0; /* disable feature */
- drbd_info(device, "rs_discard_granularity feature disabled\n");
+ if (!blk_queue_discard(q)
+ || (!q->limits.discard_zeroes_data && !disk_conf->discard_zeroes_if_aligned)) {
+ if (disk_conf->rs_discard_granularity) {
+ disk_conf->rs_discard_granularity = 0; /* disable feature */
+ drbd_info(device, "rs_discard_granularity feature disabled\n");
+ }
}
if (disk_conf->rs_discard_granularity) {