提交 e5dcdd80 编写于 作者: N NeilBrown 提交者: Linus Torvalds

[PATCH] md: fail IO request to md that require a barrier.

md does not yet support BIO_RW_BARRIER, so be honest about it and fail
(-EOPNOTSUPP) any such requests.
Signed-off-by: NNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 3ec67ac1
...@@ -238,6 +238,11 @@ static int linear_make_request (request_queue_t *q, struct bio *bio) ...@@ -238,6 +238,11 @@ static int linear_make_request (request_queue_t *q, struct bio *bio)
dev_info_t *tmp_dev; dev_info_t *tmp_dev;
sector_t block; sector_t block;
if (unlikely(bio_barrier(bio))) {
bio_endio(bio, bio->bi_size, -EOPNOTSUPP);
return 0;
}
if (bio_data_dir(bio)==WRITE) { if (bio_data_dir(bio)==WRITE) {
disk_stat_inc(mddev->gendisk, writes); disk_stat_inc(mddev->gendisk, writes);
disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bio)); disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bio));
......
...@@ -169,6 +169,11 @@ static int multipath_make_request (request_queue_t *q, struct bio * bio) ...@@ -169,6 +169,11 @@ static int multipath_make_request (request_queue_t *q, struct bio * bio)
struct multipath_bh * mp_bh; struct multipath_bh * mp_bh;
struct multipath_info *multipath; struct multipath_info *multipath;
if (unlikely(bio_barrier(bio))) {
bio_endio(bio, bio->bi_size, -EOPNOTSUPP);
return 0;
}
mp_bh = mempool_alloc(conf->pool, GFP_NOIO); mp_bh = mempool_alloc(conf->pool, GFP_NOIO);
mp_bh->master_bio = bio; mp_bh->master_bio = bio;
......
...@@ -404,6 +404,11 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio) ...@@ -404,6 +404,11 @@ static int raid0_make_request (request_queue_t *q, struct bio *bio)
unsigned long chunk; unsigned long chunk;
sector_t block, rsect; sector_t block, rsect;
if (unlikely(bio_barrier(bio))) {
bio_endio(bio, bio->bi_size, -EOPNOTSUPP);
return 0;
}
if (bio_data_dir(bio)==WRITE) { if (bio_data_dir(bio)==WRITE) {
disk_stat_inc(mddev->gendisk, writes); disk_stat_inc(mddev->gendisk, writes);
disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bio)); disk_stat_add(mddev->gendisk, write_sectors, bio_sectors(bio));
......
...@@ -555,6 +555,10 @@ static int make_request(request_queue_t *q, struct bio * bio) ...@@ -555,6 +555,10 @@ static int make_request(request_queue_t *q, struct bio * bio)
unsigned long flags; unsigned long flags;
struct bio_list bl; struct bio_list bl;
if (unlikely(bio_barrier(bio))) {
bio_endio(bio, bio->bi_size, -EOPNOTSUPP);
return 0;
}
/* /*
* Register the new request and wait if the reconstruction * Register the new request and wait if the reconstruction
......
...@@ -669,6 +669,11 @@ static int make_request(request_queue_t *q, struct bio * bio) ...@@ -669,6 +669,11 @@ static int make_request(request_queue_t *q, struct bio * bio)
int i; int i;
int chunk_sects = conf->chunk_mask + 1; int chunk_sects = conf->chunk_mask + 1;
if (unlikely(bio_barrier(bio))) {
bio_endio(bio, bio->bi_size, -EOPNOTSUPP);
return 0;
}
/* If this request crosses a chunk boundary, we need to /* If this request crosses a chunk boundary, we need to
* split it. This will only happen for 1 PAGE (or less) requests. * split it. This will only happen for 1 PAGE (or less) requests.
*/ */
......
...@@ -1411,6 +1411,11 @@ static int make_request (request_queue_t *q, struct bio * bi) ...@@ -1411,6 +1411,11 @@ static int make_request (request_queue_t *q, struct bio * bi)
sector_t logical_sector, last_sector; sector_t logical_sector, last_sector;
struct stripe_head *sh; struct stripe_head *sh;
if (unlikely(bio_barrier(bi))) {
bio_endio(bi, bi->bi_size, -EOPNOTSUPP);
return 0;
}
md_write_start(mddev, bi); md_write_start(mddev, bi);
if (bio_data_dir(bi)==WRITE) { if (bio_data_dir(bi)==WRITE) {
......
...@@ -1570,6 +1570,11 @@ static int make_request (request_queue_t *q, struct bio * bi) ...@@ -1570,6 +1570,11 @@ static int make_request (request_queue_t *q, struct bio * bi)
sector_t logical_sector, last_sector; sector_t logical_sector, last_sector;
struct stripe_head *sh; struct stripe_head *sh;
if (unlikely(bio_barrier(bi))) {
bio_endio(bi, bi->bi_size, -EOPNOTSUPP);
return 0;
}
md_write_start(mddev, bi); md_write_start(mddev, bi);
if (bio_data_dir(bi)==WRITE) { if (bio_data_dir(bi)==WRITE) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册