Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 179680
b: refs/heads/master
c: dd3d145
h: refs/heads/master
v: v3
  • Loading branch information
Martin K. Petersen authored and Jens Axboe committed Jan 11, 2010
1 parent 59fcaf2 commit 847bf7f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 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: fe0b393f2c0a0d23a9bc9ed7dc51a1ee511098bd
refs/heads/master: dd3d145d49c5816b79acc6761ebbd842bc50b0ee
2 changes: 1 addition & 1 deletion trunk/block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ static ssize_t disk_discard_alignment_show(struct device *dev,
{
struct gendisk *disk = dev_to_disk(dev);

return sprintf(buf, "%u\n", queue_discard_alignment(disk->queue));
return sprintf(buf, "%d\n", queue_discard_alignment(disk->queue));
}

static DEVICE_ATTR(range, S_IRUGO, disk_range_show, NULL);
Expand Down
7 changes: 5 additions & 2 deletions trunk/include/linux/blkdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -1148,8 +1148,11 @@ static inline int queue_discard_alignment(struct request_queue *q)
static inline int queue_sector_discard_alignment(struct request_queue *q,
sector_t sector)
{
return ((sector << 9) - q->limits.discard_alignment)
& (q->limits.discard_granularity - 1);
struct queue_limits *lim = &q->limits;
unsigned int alignment = (sector << 9) & (lim->discard_granularity - 1);

return (lim->discard_granularity + lim->discard_alignment - alignment)
& (lim->discard_granularity - 1);
}

static inline unsigned int queue_discard_zeroes_data(struct request_queue *q)
Expand Down

0 comments on commit 847bf7f

Please sign in to comment.