xen, blkfront: factor out flush-related checks from do_blkif_request()
authorArianna Avanzini <avanzini.arianna@gmail.com>
Fri, 22 Aug 2014 11:20:02 +0000 (13:20 +0200)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 1 Oct 2014 20:32:39 +0000 (16:32 -0400)
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>
drivers/block/xen-blkfront.c

index 5deb235bd18fe07adb2efb09a7c77508aadfaeec..6fc056ed1efd81fdc8f608b0727f424c30294da2 100644 (file)
@@ -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
@@ -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;
                }