Skip to content

Commit

Permalink
block: fix DISCARD_BARRIER requests
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed Jun 17, 2010
1 parent 79600aa commit fbbf055
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions block/blk-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1149,13 +1149,10 @@ void init_request_from_bio(struct request *req, struct bio *bio)
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))
Expand Down

0 comments on commit fbbf055

Please sign in to comment.