summaryrefslogtreecommitdiffstats
path: root/drivers/block/rnbd/rnbd-proto.h
diff options
context:
space:
mode:
authorGioh Kim <gi-oh.kim@cloud.ionos.com>2020-12-10 11:18:24 +0100
committerJens Axboe <axboe@kernel.dk>2020-12-16 22:55:59 +0100
commit512c781fd28cb401ee9f2843e32bf4640732c671 (patch)
treefa2cd61c8dc15148e43eb41d979f7546fb988f94 /drivers/block/rnbd/rnbd-proto.h
parentblock/rnbd: Fix typos (diff)
downloadlinux-512c781fd28cb401ee9f2843e32bf4640732c671.tar.xz
linux-512c781fd28cb401ee9f2843e32bf4640732c671.zip
block/rnbd: Set write-back cache and fua same to the target device
The rnbd-client always sets the write-back cache and fua attributes of the rnbd device queue regardless of the target device on the server. That generates IO hang issue when the target device does not support both of write-back cacne and fua. This patch adds more fields for the cache policy and fua into the device opening message. The rnbd-server sends the information if the target device supports the write-back cache and fua and rnbd-client recevives it and set the device queue accordingly. Signed-off-by: Gioh Kim <gi-oh.kim@cloud.ionos.com> [jwang: some minor change, rename a few varables, remove unrelated comments.] Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/rnbd/rnbd-proto.h')
-rw-r--r--drivers/block/rnbd/rnbd-proto.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/block/rnbd/rnbd-proto.h b/drivers/block/rnbd/rnbd-proto.h
index ca166241452c..c1bc5c0fef71 100644
--- a/drivers/block/rnbd/rnbd-proto.h
+++ b/drivers/block/rnbd/rnbd-proto.h
@@ -108,6 +108,11 @@ struct rnbd_msg_close {
__le32 device_id;
};
+enum rnbd_cache_policy {
+ RNBD_FUA = 1 << 0,
+ RNBD_WRITEBACK = 1 << 1,
+};
+
/**
* struct rnbd_msg_open_rsp - response message to RNBD_MSG_OPEN
* @hdr: message header
@@ -124,6 +129,7 @@ struct rnbd_msg_close {
* @max_segments: max segments hardware support in one transfer
* @secure_discard: supports secure discard
* @rotation: is a rotational disc?
+ * @cache_policy: support write-back caching or FUA?
*/
struct rnbd_msg_open_rsp {
struct rnbd_msg_hdr hdr;
@@ -139,7 +145,8 @@ struct rnbd_msg_open_rsp {
__le16 max_segments;
__le16 secure_discard;
u8 rotational;
- u8 reserved[11];
+ u8 cache_policy;
+ u8 reserved[10];
};
/**