Skip to content

Commit

Permalink
xen, blkfront: factor out flush-related checks from do_blkif_request()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Arianna Avanzini authored and Konrad Rzeszutek Wilk committed Oct 1, 2014
1 parent 61cecca commit 0f1ca65
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/block/xen-blkfront.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,14 @@ static inline void flush_requests(struct blkfront_info *info)
notify_remote_via_irq(info->irq);
}

static inline bool blkif_request_flush_valid(struct request *req,
struct blkfront_info *info)
{
return ((req->cmd_type != REQ_TYPE_FS) ||
((req->cmd_flags & (REQ_FLUSH | REQ_FUA)) &&
!info->flush_op));
}

/*
* do_blkif_request
* read a block; request is in a request queue
Expand All @@ -604,9 +612,7 @@ static void do_blkif_request(struct request_queue *rq)

blk_start_request(req);

if ((req->cmd_type != REQ_TYPE_FS) ||
((req->cmd_flags & (REQ_FLUSH | REQ_FUA)) &&
!info->flush_op)) {
if (blkif_request_flush_valid(req, info)) {
__blk_end_request_all(req, -EIO);
continue;
}
Expand Down

0 comments on commit 0f1ca65

Please sign in to comment.