linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: fix DISCARD_BARRIER requests
@ 2010-06-17  7:54 Christoph Hellwig
  2010-06-17  8:10 ` Jens Axboe
  0 siblings, 1 reply; 10+ messages in thread
From: Christoph Hellwig @ 2010-06-17  7:54 UTC (permalink / raw)
  To: axboe; +Cc: linux-fsdevel

Filesystems assume that DISCARD_BARRIER are full barriers, so that they
don't have to track in-progress discard operation when submitting new I/O.
But currently we only treat them as elevator barriers, which don't
actually do the nessecary queue drains.

Also remove the unlikely around both the DISCARD and BARRIER requests -
the happen far too often for a static mispredict.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/block/blk-core.c
===================================================================
--- linux-2.6.orig/block/blk-core.c	2010-06-17 09:42:23.924004448 +0200
+++ linux-2.6/block/blk-core.c	2010-06-17 09:45:46.727004030 +0200
@@ -1149,13 +1149,10 @@ void init_request_from_bio(struct reques
 	else
 		req->cmd_flags |= bio->bi_rw & REQ_FAILFAST_MASK;
 
-	if (unlikely(bio_rw_flagged(bio, BIO_RW_DISCARD))) {
+	if (bio_rw_flagged(bio, BIO_RW_DISCARD))
 		req->cmd_flags |= REQ_DISCARD;
-		if (bio_rw_flagged(bio, BIO_RW_BARRIER))
-			req->cmd_flags |= REQ_SOFTBARRIER;
-	} else if (unlikely(bio_rw_flagged(bio, BIO_RW_BARRIER)))
+	if (bio_rw_flagged(bio, BIO_RW_BARRIER))
 		req->cmd_flags |= REQ_HARDBARRIER;
-
 	if (bio_rw_flagged(bio, BIO_RW_SYNCIO))
 		req->cmd_flags |= REQ_RW_SYNC;
 	if (bio_rw_flagged(bio, BIO_RW_META))

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-06-19  2:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-17  7:54 [PATCH] block: fix DISCARD_BARRIER requests Christoph Hellwig
2010-06-17  8:10 ` Jens Axboe
2010-06-17 11:49   ` Matthew Wilcox
2010-06-17 12:06     ` Jens Axboe
2010-06-17 16:54   ` Christoph Hellwig
2010-06-17 19:22     ` Chris Mason
2010-06-18 13:29       ` Kyungmin Park
2010-06-19  2:22         ` Kyungmin Park
2010-06-18 15:29       ` Jamie Lokier
2010-06-18 20:30         ` Chris Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).