[Devel] [PATCH 2/2] fs/fuse kio: add support PCS_CS_IO_SYNC flag

Pavel Butsykin pbutsykin at virtuozzo.com
Mon Dec 24 18:58:10 MSK 2018


In case PCS_FATTR_IMMEDIATE_WRITE attribute is set, all write operations must
be synchronous, although now it's not and there is only PCS_CS_WRITE_SYNC_REQ
for PCS_REQ_T_WRITE. Adding PCS_CS_IO_SYNC flag makes it possible to handle any
write request synchronously.

Signed-off-by: Pavel Butsykin <pbutsykin at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_cs.c      | 3 +++
 fs/fuse/kio/pcs/pcs_cs_prot.h | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/fs/fuse/kio/pcs/pcs_cs.c b/fs/fuse/kio/pcs/pcs_cs.c
index 1a2e64270b9e..60e2dc545cc5 100644
--- a/fs/fuse/kio/pcs/pcs_cs.c
+++ b/fs/fuse/kio/pcs/pcs_cs.c
@@ -541,6 +541,9 @@ void pcs_cs_submit(struct pcs_cs *cs, struct pcs_int_request *ireq)
 	if (ireq->flags & IREQ_F_SEQ)
 		ioh->sync.misc = PCS_CS_IO_SEQ;
 
+	if (ireq->dentry->fileinfo.attr.attrib & PCS_FATTR_IMMEDIATE_WRITE)
+		ioh->sync.misc |= PCS_CS_IO_SYNC;
+
 	msg->size = ioh->hdr.len;
 	msg->rpc = NULL;
 	pcs_clear_error(&msg->error);
diff --git a/fs/fuse/kio/pcs/pcs_cs_prot.h b/fs/fuse/kio/pcs/pcs_cs_prot.h
index 7de7dd1bea6b..8ca6cbabf741 100644
--- a/fs/fuse/kio/pcs/pcs_cs_prot.h
+++ b/fs/fuse/kio/pcs/pcs_cs_prot.h
@@ -24,6 +24,10 @@ struct pcs_cs_sync_data
  */
 #define PCS_CS_IO_CACHED	(1ULL<<63)	/* Resp: result is read from cache or written ahead to journal */
 #define PCS_CS_IO_SEQ		(1ULL<<62)	/* Req: request is part of sequential flow */
+#define PCS_CS_IO_SYNC		(1ULL<<60)	/* Req: Write operations will be performed synchronously.
+						 *	This means that at the req completion time, the output
+						 *	data will be transferred to disk.
+						 */
 
 #define PCS_CS_RESET_TS_RECV(sdata, ts)	do { (sdata)->misc = ((u64)ts & 0xFFFFFFFFFFFFFULL); } while (0)
 #define PCS_CS_SET_TS_RECV(sdata, ts)	do { (sdata)->misc = ((sdata)->misc & ~0xFFFFFFFFFFFFFULL) | ((u64)ts & 0xFFFFFFFFFFFFFULL); } while (0)
-- 
2.15.1



More information about the Devel mailing list