Commit fbbf055692aeb25c54c49d9ca84532de836fbba0
Committed by
Jens Axboe
1 parent
79600aadcf
block: fix DISCARD_BARRIER requests
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> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Showing 1 changed file with 2 additions and 5 deletions Side-by-side Diff
block/blk-core.c
... | ... | @@ -1149,13 +1149,10 @@ |
1149 | 1149 | else |
1150 | 1150 | req->cmd_flags |= bio->bi_rw & REQ_FAILFAST_MASK; |
1151 | 1151 | |
1152 | - if (unlikely(bio_rw_flagged(bio, BIO_RW_DISCARD))) { | |
1152 | + if (bio_rw_flagged(bio, BIO_RW_DISCARD)) | |
1153 | 1153 | req->cmd_flags |= REQ_DISCARD; |
1154 | - if (bio_rw_flagged(bio, BIO_RW_BARRIER)) | |
1155 | - req->cmd_flags |= REQ_SOFTBARRIER; | |
1156 | - } else if (unlikely(bio_rw_flagged(bio, BIO_RW_BARRIER))) | |
1154 | + if (bio_rw_flagged(bio, BIO_RW_BARRIER)) | |
1157 | 1155 | req->cmd_flags |= REQ_HARDBARRIER; |
1158 | - | |
1159 | 1156 | if (bio_rw_flagged(bio, BIO_RW_SYNCIO)) |
1160 | 1157 | req->cmd_flags |= REQ_RW_SYNC; |
1161 | 1158 | if (bio_rw_flagged(bio, BIO_RW_META)) |