Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 258605
b: refs/heads/master
c: 0f79960
h: refs/heads/master
i:
  258603: d0f36e6
v: v3
  • Loading branch information
Mike Snitzer authored and Jens Axboe committed Jul 6, 2011
1 parent 70d1fb1 commit 521ffeb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 390192b300570b2bc721d77067ca133f58015ae8
refs/heads/master: 0f79960391a5a1e3679956024e18aeeb0369ac44
5 changes: 4 additions & 1 deletion trunk/block/blk-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
* granularity
*/
max_discard_sectors = min(q->limits.max_discard_sectors, UINT_MAX >> 9);
if (q->limits.discard_granularity) {
if (!unlikely(!max_discard_sectors)) {
/* Avoid infinite loop below. Being cautious never hurts. */
return -EOPNOTSUPP;
} else if (q->limits.discard_granularity) {
unsigned int disc_sects = q->limits.discard_granularity >> 9;

max_discard_sectors &= ~(disc_sects - 1);
Expand Down

0 comments on commit 521ffeb

Please sign in to comment.