mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-26 06:33:19 -04:00
Allow elevators to sort/merge discard requests
But blkdev_issue_discard() still emits requests which are interpreted as soft barriers, because naïve callers might otherwise issue subsequent writes to those same sectors, which might cross on the queue (if they're reallocated quickly enough). Callers still _can_ issue non-barrier discard requests, but they have to take care of queue ordering for themselves. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
parent
d30a2605be
commit
e17fc0a1cc
8 changed files with 42 additions and 23 deletions
|
|
@ -188,8 +188,8 @@ struct bio {
|
|||
#define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST))
|
||||
#define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD))
|
||||
#define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META))
|
||||
#define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio))
|
||||
#define bio_discard(bio) ((bio)->bi_rw & (1 << BIO_RW_DISCARD))
|
||||
#define bio_empty_barrier(bio) (bio_barrier(bio) && !bio_has_data(bio) && !bio_discard(bio))
|
||||
|
||||
static inline unsigned int bio_cur_sectors(struct bio *bio)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -541,7 +541,7 @@ enum {
|
|||
#define blk_noretry_request(rq) ((rq)->cmd_flags & REQ_FAILFAST)
|
||||
#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED)
|
||||
|
||||
#define blk_account_rq(rq) (blk_rq_started(rq) && blk_fs_request(rq))
|
||||
#define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq)))
|
||||
|
||||
#define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND)
|
||||
#define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME)
|
||||
|
|
@ -598,7 +598,8 @@ static inline void blk_clear_queue_full(struct request_queue *q, int rw)
|
|||
#define RQ_NOMERGE_FLAGS \
|
||||
(REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER)
|
||||
#define rq_mergeable(rq) \
|
||||
(!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && blk_fs_request((rq)))
|
||||
(!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \
|
||||
(blk_discard_rq(rq) || blk_fs_request((rq))))
|
||||
|
||||
/*
|
||||
* q->prep_rq_fn return values
|
||||
|
|
|
|||
|
|
@ -87,7 +87,8 @@ extern int dir_notify_enable;
|
|||
#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC))
|
||||
#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNC))
|
||||
#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER))
|
||||
#define WRITE_DISCARD (WRITE | (1 << BIO_RW_DISCARD))
|
||||
#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD)
|
||||
#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER))
|
||||
|
||||
#define SEL_IN 1
|
||||
#define SEL_OUT 2
|
||||
|
|
|
|||
Loading…
Reference in a new issue