block: treat REQ_FUA and REQ_PREFLUSH as synchronous
authorChristoph Hellwig <hch@lst.de>
Tue, 1 Nov 2016 13:40:08 +0000 (07:40 -0600)
committerJens Axboe <axboe@fb.com>
Tue, 1 Nov 2016 15:43:26 +0000 (09:43 -0600)
Instead of requiring everyone to specify the REQ_SYNC flag aŃ• well.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
include/linux/blk_types.h
include/linux/fs.h

index 3fa62cabe8d219854a6c988749a0008bce8e32b6..107d23d18096647907484dd6ff42ab024bd4527f 100644 (file)
@@ -216,9 +216,15 @@ static inline bool op_is_write(unsigned int op)
        return (op & 1);
 }
 
+/*
+ * Reads are always treated as synchronous, as are requests with the FUA or
+ * PREFLUSH flag.  Other operations may be marked as synchronous using the
+ * REQ_SYNC flag.
+ */
 static inline bool op_is_sync(unsigned int op)
 {
-       return (op & REQ_OP_MASK) == REQ_OP_READ || (op & REQ_SYNC);
+       return (op & REQ_OP_MASK) == REQ_OP_READ ||
+               (op & (REQ_SYNC | REQ_FUA | REQ_PREFLUSH));
 }
 
 typedef unsigned int blk_qc_t;
index 5e0078fceed7980406d8e074969aad0b87736cc6..ccedccb28ec8bbe90ea212a348b2a14668a224b3 100644 (file)
@@ -199,9 +199,9 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
 #define READ_SYNC              0
 #define WRITE_SYNC             (REQ_SYNC | REQ_NOIDLE)
 #define WRITE_ODIRECT          REQ_SYNC
-#define WRITE_FLUSH            (REQ_SYNC | REQ_NOIDLE | REQ_PREFLUSH)
-#define WRITE_FUA              (REQ_SYNC | REQ_NOIDLE | REQ_FUA)
-#define WRITE_FLUSH_FUA                (REQ_SYNC | REQ_NOIDLE | REQ_PREFLUSH | REQ_FUA)
+#define WRITE_FLUSH            (REQ_NOIDLE | REQ_PREFLUSH)
+#define WRITE_FUA              (REQ_NOIDLE | REQ_FUA)
+#define WRITE_FLUSH_FUA                (REQ_NOIDLE | REQ_PREFLUSH | REQ_FUA)
 
 /*
  * Attribute flags.  These should be or-ed together to figure out what