Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 334233
b: refs/heads/master
c: f1cad2b
h: refs/heads/master
i:
  334231: 130f66c
v: v3
  • Loading branch information
Shaohua Li authored and NeilBrown committed Oct 11, 2012
1 parent 63f9ebb commit 7b64ecc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bc78c57388e7f447f58e30d60b1505ddaaaf3a7d
refs/heads/master: f1cad2b68ed12c0f82d3f56e150691f62b6f5edf
16 changes: 16 additions & 0 deletions trunk/drivers/md/linear.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ static struct linear_conf *linear_conf(struct mddev *mddev, int raid_disks)
struct linear_conf *conf;
struct md_rdev *rdev;
int i, cnt;
bool discard_supported = false;

conf = kzalloc (sizeof (*conf) + raid_disks*sizeof(struct dev_info),
GFP_KERNEL);
Expand Down Expand Up @@ -171,13 +172,20 @@ static struct linear_conf *linear_conf(struct mddev *mddev, int raid_disks)
conf->array_sectors += rdev->sectors;
cnt++;

if (blk_queue_discard(bdev_get_queue(rdev->bdev)))
discard_supported = true;
}
if (cnt != raid_disks) {
printk(KERN_ERR "md/linear:%s: not enough drives present. Aborting!\n",
mdname(mddev));
goto out;
}

if (!discard_supported)
queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
else
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);

/*
* Here we calculate the device offsets.
*/
Expand Down Expand Up @@ -331,6 +339,14 @@ static void linear_make_request(struct mddev *mddev, struct bio *bio)
bio->bi_sector = bio->bi_sector - start_sector
+ tmp_dev->rdev->data_offset;
rcu_read_unlock();

if (unlikely((bio->bi_rw & REQ_DISCARD) &&
!blk_queue_discard(bdev_get_queue(bio->bi_bdev)))) {
/* Just ignore it */
bio_endio(bio, 0);
return;
}

generic_make_request(bio);
}

Expand Down

0 comments on commit 7b64ecc

Please sign in to comment.