diff options
Diffstat (limited to 'block/blk-settings.c')
-rw-r--r-- | block/blk-settings.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c index 779bb7646bcd..c50ecf0ea3b1 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c | |||
@@ -611,7 +611,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
611 | bottom = b->discard_granularity + alignment; | 611 | bottom = b->discard_granularity + alignment; |
612 | 612 | ||
613 | /* Verify that top and bottom intervals line up */ | 613 | /* Verify that top and bottom intervals line up */ |
614 | if (max(top, bottom) & (min(top, bottom) - 1)) | 614 | if ((max(top, bottom) % min(top, bottom)) != 0) |
615 | t->discard_misaligned = 1; | 615 | t->discard_misaligned = 1; |
616 | } | 616 | } |
617 | 617 | ||
@@ -619,8 +619,8 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, | |||
619 | b->max_discard_sectors); | 619 | b->max_discard_sectors); |
620 | t->discard_granularity = max(t->discard_granularity, | 620 | t->discard_granularity = max(t->discard_granularity, |
621 | b->discard_granularity); | 621 | b->discard_granularity); |
622 | t->discard_alignment = lcm(t->discard_alignment, alignment) & | 622 | t->discard_alignment = lcm(t->discard_alignment, alignment) % |
623 | (t->discard_granularity - 1); | 623 | t->discard_granularity; |
624 | } | 624 | } |
625 | 625 | ||
626 | return ret; | 626 | return ret; |