diff options
author | Arianna Avanzini <avanzini.arianna@gmail.com> | 2014-08-22 07:20:02 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2014-10-01 16:32:39 -0400 |
commit | 0f1ca65ee50df042051e8fa3a14f73b0c71d45b9 (patch) | |
tree | 65f3193a8a9c63a1af56d48d32d723634c9d9707 /drivers/block | |
parent | 61cecca865280bef4f8a9748d0a9afa5df351ac2 (diff) |
xen, blkfront: factor out flush-related checks from do_blkif_request()
This commit factors out some checks related to the request insertion
path, which can be done in an function instead of by itself.
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/xen-blkfront.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 5deb235bd18f..6fc056ed1efd 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -582,6 +582,14 @@ static inline void flush_requests(struct blkfront_info *info) | |||
582 | notify_remote_via_irq(info->irq); | 582 | notify_remote_via_irq(info->irq); |
583 | } | 583 | } |
584 | 584 | ||
585 | static inline bool blkif_request_flush_valid(struct request *req, | ||
586 | struct blkfront_info *info) | ||
587 | { | ||
588 | return ((req->cmd_type != REQ_TYPE_FS) || | ||
589 | ((req->cmd_flags & (REQ_FLUSH | REQ_FUA)) && | ||
590 | !info->flush_op)); | ||
591 | } | ||
592 | |||
585 | /* | 593 | /* |
586 | * do_blkif_request | 594 | * do_blkif_request |
587 | * read a block; request is in a request queue | 595 | * read a block; request is in a request queue |
@@ -604,9 +612,7 @@ static void do_blkif_request(struct request_queue *rq) | |||
604 | 612 | ||
605 | blk_start_request(req); | 613 | blk_start_request(req); |
606 | 614 | ||
607 | if ((req->cmd_type != REQ_TYPE_FS) || | 615 | if (blkif_request_flush_valid(req, info)) { |
608 | ((req->cmd_flags & (REQ_FLUSH | REQ_FUA)) && | ||
609 | !info->flush_op)) { | ||
610 | __blk_end_request_all(req, -EIO); | 616 | __blk_end_request_all(req, -EIO); |
611 | continue; | 617 | continue; |
612 | } | 618 | } |