aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/xen-blkfront.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-09-03 05:56:16 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-09-10 06:35:36 -0400
commit4913efe456c987057e5d36a3f0a55422a9072cae (patch)
tree295f04a7214e1933df3301dd42c12ff3f282a22c /drivers/block/xen-blkfront.c
parent6958f145459ca7ad9715024de97445addacb8510 (diff)
block: deprecate barrier and replace blk_queue_ordered() with blk_queue_flush()
Barrier is deemed too heavy and will soon be replaced by FLUSH/FUA requests. Deprecate barrier. All REQ_HARDBARRIERs are failed with -EOPNOTSUPP and blk_queue_ordered() is replaced with simpler blk_queue_flush(). blk_queue_flush() takes combinations of REQ_FLUSH and FUA. If a device has write cache and can flush it, it should set REQ_FLUSH. If the device can handle FUA writes, it should also set REQ_FUA. All blk_queue_ordered() users are converted. * ORDERED_DRAIN is mapped to 0 which is the default value. * ORDERED_DRAIN_FLUSH is mapped to REQ_FLUSH. * ORDERED_DRAIN_FLUSH_FUA is mapped to REQ_FLUSH | REQ_FUA. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Boaz Harrosh <bharrosh@panasas.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Nick Piggin <npiggin@kernel.dk> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Jeremy Fitzhardinge <jeremy@xensource.com> Cc: Chris Wright <chrisw@sous-sol.org> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com> Cc: David S. Miller <davem@davemloft.net> Cc: Alasdair G Kergon <agk@redhat.com> Cc: Pierre Ossman <drzeus@drzeus.cx> Cc: Stefan Weinhuber <wein@de.ibm.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/block/xen-blkfront.c')
-rw-r--r--drivers/block/xen-blkfront.c43
1 files changed, 12 insertions, 31 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index 50ec6f834996..0b1eea643262 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -95,7 +95,7 @@ struct blkfront_info
95 struct gnttab_free_callback callback; 95 struct gnttab_free_callback callback;
96 struct blk_shadow shadow[BLK_RING_SIZE]; 96 struct blk_shadow shadow[BLK_RING_SIZE];
97 unsigned long shadow_free; 97 unsigned long shadow_free;
98 int feature_barrier; 98 unsigned int feature_flush;
99 int is_ready; 99 int is_ready;
100}; 100};
101 101
@@ -418,25 +418,12 @@ static int xlvbd_init_blk_queue(struct gendisk *gd, u16 sector_size)
418} 418}
419 419
420 420
421static int xlvbd_barrier(struct blkfront_info *info) 421static void xlvbd_flush(struct blkfront_info *info)
422{ 422{
423 int err; 423 blk_queue_flush(info->rq, info->feature_flush);
424 const char *barrier;
425
426 switch (info->feature_barrier) {
427 case QUEUE_ORDERED_DRAIN: barrier = "enabled"; break;
428 case QUEUE_ORDERED_NONE: barrier = "disabled"; break;
429 default: return -EINVAL;
430 }
431
432 err = blk_queue_ordered(info->rq, info->feature_barrier);
433
434 if (err)
435 return err;
436
437 printk(KERN_INFO "blkfront: %s: barriers %s\n", 424 printk(KERN_INFO "blkfront: %s: barriers %s\n",
438 info->gd->disk_name, barrier); 425 info->gd->disk_name,
439 return 0; 426 info->feature_flush ? "enabled" : "disabled");
440} 427}
441 428
442 429
@@ -515,7 +502,7 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity,
515 info->rq = gd->queue; 502 info->rq = gd->queue;
516 info->gd = gd; 503 info->gd = gd;
517 504
518 xlvbd_barrier(info); 505 xlvbd_flush(info);
519 506
520 if (vdisk_info & VDISK_READONLY) 507 if (vdisk_info & VDISK_READONLY)
521 set_disk_ro(gd, 1); 508 set_disk_ro(gd, 1);
@@ -661,8 +648,8 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)
661 printk(KERN_WARNING "blkfront: %s: write barrier op failed\n", 648 printk(KERN_WARNING "blkfront: %s: write barrier op failed\n",
662 info->gd->disk_name); 649 info->gd->disk_name);
663 error = -EOPNOTSUPP; 650 error = -EOPNOTSUPP;
664 info->feature_barrier = QUEUE_ORDERED_NONE; 651 info->feature_flush = 0;
665 xlvbd_barrier(info); 652 xlvbd_flush(info);
666 } 653 }
667 /* fall through */ 654 /* fall through */
668 case BLKIF_OP_READ: 655 case BLKIF_OP_READ:
@@ -1075,19 +1062,13 @@ static void blkfront_connect(struct blkfront_info *info)
1075 /* 1062 /*
1076 * If there's no "feature-barrier" defined, then it means 1063 * If there's no "feature-barrier" defined, then it means
1077 * we're dealing with a very old backend which writes 1064 * we're dealing with a very old backend which writes
1078 * synchronously; draining will do what needs to get done. 1065 * synchronously; nothing to do.
1079 * 1066 *
1080 * If there are barriers, then we use flush. 1067 * If there are barriers, then we use flush.
1081 *
1082 * If barriers are not supported, then there's no much we can
1083 * do, so just set ordering to NONE.
1084 */ 1068 */
1085 if (err) 1069 info->feature_flush = 0;
1086 info->feature_barrier = QUEUE_ORDERED_DRAIN; 1070 if (!err && barrier)
1087 else if (barrier) 1071 info->feature_flush = REQ_FLUSH;
1088 info->feature_barrier = QUEUE_ORDERED_DRAIN_FLUSH;
1089 else
1090 info->feature_barrier = QUEUE_ORDERED_NONE;
1091 1072
1092 err = xlvbd_alloc_gendisk(sectors, info, binfo, sector_size); 1073 err = xlvbd_alloc_gendisk(sectors, info, binfo, sector_size);
1093 if (err) { 1074 if (err) {